0 Replies Latest reply on Mar 17, 2003 3:48 PM by jb_jik

    javax.naming.NoInitialContextException: Need to specify clas

    jb_jik

      Hi:

      We just started using JBoss (3.0.6) and have a servlet invoking an EJB in our application. But we are getting the above mentioned exception after JBoss runs fine for some time.

      We have bundled the servlet and ejb in an ear class and are making the ejb object lookup call as follows:

      javax.naming.InitialContext initial = new javax.naming.InitialContext();
      Object objref = initial.lookup("TestObject");

      The ear file is deployed successfully, and the request and responses work fine for some time eventually resulting in the above mentioned exception, thereafter the only way to continue forward is to restart the jboss.

      Our ejb-jar.xml for the ejb is like this:
      <ejb-jar>
      <enterprise-beans>

      <ejb-name>TestObject</ejb-name>
      com.company.ejb.TestObjectHome
      com.company.ejb.TestObject
      <ejb-class>com.company.ejb.TestObjectEJB</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>

      </enterprise-beans>
      <assembly-descriptor>
      </assembly-descriptor>
      </ejb-jar>


      The application.xml in the ear file just specifies the the ejb in the tag as follows:

      ejbFile.jar


      We have used the default jboss's jndi.properties as it did not work (gave the same exception) have changed it to the following with no result:
      #java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      #java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs=org.jnp.interfaces
      java.url.provider.url=localhost:1099
      # Do NOT uncomment this line as it causes in VM calls to go over
      # RMI!
      #java.naming.provider.url=localhost

      If the problem is with jndi initialization, then why would the JBoss run well for a while, before starts giving the NoInitialContextException ? Most likely some setup/configuration issue, which am not able to fathom.

      Any insight into the problem is highly appreciated.

      Thank you.