2 Replies Latest reply on Feb 17, 2004 7:41 PM by rasoul

    javax.naming.NoInitialContextException

    rasoul Newbie

      Hi there,
      I need help with debugging the following error that I get on a remote machine. JBoss resides on a different JVM and the client on another redhat box. Here is the error:

      javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:652)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
      at javax.naming.InitialContext.init(InitialContext.java:219)
      at javax.naming.InitialContext.(InitialContext.java:195)
      at com.rhythm.clients.Remote_Client.getInitialContext(Remote_Client.java:274)
      at com.rhythm.clients.Remote_Client.start(Remote_Client.java:203)
      at com.rhythm.clients.Remote_Client.main(Remote_Client.java:283)
      Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
      at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:219)
      at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:649)

      And here is my client's getInitialContext code:
      public static Context getInitialContext() throws Exception {
      Properties prop = new Properties();
      prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      //prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.HttpNamingContextFactory");
      prop.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
      prop.put(Context.PROVIDER_URL,"http://lid32.rhythm.com:8080/invoker/JNDIFactory");
      return new InitialContext(prop);
      }

      The following are in my CLASSPATH on the client side:
      j2ee.jar j2ee-svc.jar jbossall-client.jar jboss-client.jar jboss-common-client.jar jbosssx-client.jar jboss-system-client.jar jnp-client.jar log4j.jar

      Thanks in advance.
      -r