David said:
This is probably best asked in a websphere-specific newsgroup or forum. I
can tell you that I have been using WAS 5 and Sun's JDK 1.4.2 and could not
perform JNDI lookups, while lookups in IBM's JDK worked just fine. I don't
know if there is a workaround for that problem, or if I was doing something
wrong. It would be nice if there were a solution to the problem, because
then our JWS apps could be more powerful.
I might have something to contribute to this discussion. One of the
things I found when running multiple JNDI servers is that both the
protocol AND the implementing classes are significant. There are
also a couple of different ways to specify the parameters. Here's
some sample code:
/* didn't work */
Properties props = new Properties();
props.put( Context.PROVIDER_URL, "iiop://localhost:18099" );
props.put( Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory" );
Context context = new InitialContext( props );
/* did work */
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
env.put("java.naming.provider.url", "localhost:18099");
Context context = new InitialContext( env );
I wish I had the definitive table of the correct classes and methods
to use for the different JNDI implementations at hand. I've got some
code and lots of notes but I would recommend some trial-and-error to
arrive at a solution which works in your particular environment.
Unless you want to pay me for my time, of course... ;-)