I want to obtain the IntialContext in a standalone Java class from the Tomcat which is running on port 8080 on local m/c. When I try something like this Hashtable ht = new Hashtable(); ht.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.naming.java.javaURLContextFactory"); ht.put("java.naming.factory.url.pkgs", "org.apache.naming"); Context ctx = new InitialContext(ht); It gives error Cannot instantiate class: org.apache.naming.java.javaURLContextFactory. What should be passed as parameter when Intial context is to be abtained from Tomcat outside the webapplication( not in servlet or JSP page)? Thanks!
Hello Vijay, Did you have any success on this? I am trying to do the same thing and i am getting the same problem. Could you please mail me if you solved this problem with how you did that. Thanks Elango. You can send me email at "firstname.lastname@example.org".
subject: How to get Intialcontext in a Java Class Outside container?