3 Replies Latest reply on Jan 16, 2004 7:14 PM by jdelozier

    NoInitialContextException

    naumankhanca

      Hi,
      I am using JBoss 3.22 and JBoss-3.0.8 and I just deployed the simple stateless session bean, bean is deployed and everything seems ok but when i call the bean through client class, it throws the below exception and I am unable to figure out why this exception is coming up.
      So please help me to resolve this problem.

      javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interf
      aces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: o
      rg.jnp.interfaces.NamingContextFactory]
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
      52)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243
      )
      at javax.naming.InitialContext.init(InitialContext.java:219)
      at javax.naming.InitialContext.(InitialContext.java:195)
      at FirstEJBClient.main(FirstEJBClient.java:16)
      Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFac
      tory
      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.jav
      a:42)
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
      49)
      ... 4 more


      Regards,

      --------------------

      Nauman Khan

        • 1. Re: NoInitialContextException
          jonlee

          You probably need to include jbossall-client.jar in the classpath for the client.

          • 2. Re: NoInitialContextException
            naumankhanca

            I did include this file in classpath but I'm having this problem only in JBoss-3.2.2,However if I use jboss-3.2.1,it works fine. and I don't get any error from client.

            Regards,
            Nauman

            • 3. Re: NoInitialContextException
              jdelozier

              I was getting a similar error while using JBoss 3.2.3.
              I changed my class path to include the following ...

              %JBOSS_HOME%\client\jboss-client.jar;
              %JBOSS_HOME%\client\jboss-common-client.jar;
              %JBOSS_HOME%\client\jnp-client.jar;
              %JBOSS_HOME%\client\jbosssx-client.jar;
              %JBOSS_HOME%\client\log4j.jar

              ... and like magic I got a different error instead ...

              javax.naming.NameNotFoundException: comp not bound.

              But at least I now have an Initial Context.

              :-)