You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Swaminathan Gurumoorthy <sw...@yahoo.com> on 2003/12/20 00:48:04 UTC
Accessing JNDI Context from outside Tomcat
I am trying to do some standalone unit testing on my business logic layer from outside Tomcat . I am hitting across a snag and I am relatively new to JNDI.
Within my application I do a
initCtx = new InitialContext();
and Tomcat creates me a initial context for lookups. Now I did some reverse engineering and found out the parameters that Tomcat uses to configure the initial context.
Based on that, I wrote standalone code to create a initial context:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.naming.java.javaURLContextFactory");
env.put(Context.URL_PKG_PREFIXES,"org.apache.naming");
Context ctx = new InitialContext(env);
If I run this I get
javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.naming.java.javaURLContextFactory. Root exception is java.lang.ClassNotFoundException: org.apache.naming.java.javaURLContextFactory.
Is there no way to access JNDI resources set up in Tomcat from outside? Is there a provider URL that I need to use? If yes, what is the value?
TIA
Swami
---------------------------------
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing