You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kevin Chen <ky...@ms27.url.com.tw> on 2002/12/04 12:39:02 UTC

get JNDI Context from client side

Hi all:

How can I get Tomcat JNDI context from client side??
I wanna write a client side java code that can lookup Tomcat JNDI context.
Here is the code i wrote:

Properties p = new Properties();
  p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.naming.java.javaURLContextFactory");
  p.put(Context.PROVIDER_URL, "rmi://localhost:1099");
  
  try
  {
       Context ic = new javax.naming.InitialContext(p);
       Object obj = ic.lookup("java:comp/env");
       ...
       ... 
  }
  

And I got the following error message:
javax.naming.NameNotFoundException: No object bound for java:comp/env

It seems like I didnt get the JNDI context of Tomcat.
Can anyone help??

Thanks!!