Hi!

Jay Walters wrote:
> For what it's worth, you guys can get rid of the System.setProperty code and
> rewrite getInitialContext as follows...
> 
>     public static Context getInitialContext()
>      throws javax.naming.NamingException
>     {
>         Hashtable h = new Properties();
>         h.put(Context.INITIAL_CONTEXT_FACTORY,
>           "org.jnp.interfaces.NamingContextFactory");
>         h.put(Context.PROVIDER_URL,"localhost:1099");
> 
>         //  I don't need the line below in my clients, but I'm
>         //  not sure what you're doing and whether you need it
>         //  or not.
>         h.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");
>         //
> 
>         Context ctx = new javax.naming.InitialContext(h);
>         return ctx;
>     }

FWIW, here is my getInitialContext code:
     public static Context getInitialContext()
      throws javax.naming.NamingException
     {
         return new InitialContext()x;
     }
:-) Much simpler isn't it?

All settings are contained in the file jndi.properties which is present
in the classpath. The URL_PKG_PREFIXES settings is only require if you
want to be able to do "jnp://" lookups, i.e. by using URL prefixes
(duh). This is useful if you want to use several servers from different
vendors at once.

/Rickard

-- 
Rickard �berg

Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to