1 Reply Latest reply on Mar 3, 2016 2:37 AM by Jay SenSharma

    The problem in the recently downloaded and installed JBoss Dev Studio 9 and the embedded server ESA 6.4

    Igor Livshin Newbie

      After installing the environment, I developed and published on the embedded server the EJB entity bean with the remote and home interface. Next I developed the EJB application client that should  call this remote EJB (the client is called Client_1). When running this client as application I am getting the following exception due to the missing a class:

       

      Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory

      at java.lang.Class.forNameImpl(Native Method)

      at java.lang.Class.forName(Class.java:343)

      at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:84)

      at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:73)

      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:683)

       

      Here is the code fragment that is relevant to this issue

       

      package com.titan.clients;

       

       

      import com.titan.cabin.CabinHomeRemote;

      import com.titan.cabin.CabinRemote;

      import javax.naming.InitialContext;

      import javax.naming.Context;

      import javax.naming.NamingException;

      import javax.rmi.PortableRemoteObject;

      import java.rmi.RemoteException;

      import java.util.Hashtable;

       

      public class Client_1

      {

         public static void main(String [] args)

         {

            try

            {

               Context jndiContext = getInitialContext();

               Object ref = jndiContext.lookup("CabinHomeRemote");

               CabinHomeRemote home = (CabinHomeRemote)

                  PortableRemoteObject.narrow(ref,CabinHomeRemote.class);  

             .....

             .....

      public static Context getInitialContext()

       

            throws javax.naming.NamingException

         {

              Hashtable jndiProperties = new Hashtable();

        jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");

        jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");

        jndiProperties.put(Context.PROVIDER_URL, "localhost:1099");   

        return new InitialContext(jndiProperties);

         }

       

       

       

      Seems like a simple problem, and I see on the Internet tons of people reporting the same issue. The solution is to include the jar file called jbossall-client.jar (which contains the NotFound class -  org.jnp.interfaces.NamingContextFactory)  into the client's path. However, the problem is that this file is no longer present within the JBoss 9/ EAT 6.4 installation directory. 

       

      According to the people discussing this issue, this jar file used to be located in the /client sub-directory of the older releases of server, but this installation does not have this directory, and I search the entire installation - this jar file is no longer there. Is it possible that this beta release just misses this jar/class file? And where I can get this jbossall-client.jar file or what is the workarownd?

       

      Note.

       

      Please see this discussion (there are there are several of them), but here is one.

       

      https://developer.jboss.org/thread/121035?start=0&tstart=0 


      Thanks for your help/advise.

       

      Regards

       

      Igor.Livshin@gmail.com

        • 1. Re: The problem in the recently downloaded and installed JBoss Dev Studio 9 and the embedded server ESA 6.4
          Jay SenSharma Master

          Sorry, but i did not hear about any product with name " JBoss 9/ EAT 6.4 "  you also used "ESA 6.4"  . Please pardon my ignorance.

           

          Do you mean JBoss EAP 6.4   (instead of EAT 6.4  or ESA 6.4)?   (NOTE: JBoss EAP6  is not same as JBossAS 6)

          If you are talking about JBoss EAP 6.4 server then it is clear that EAP6 does not use the "jnp" protocol of any of the JNP based API for the remote invocations like JNDI lookup.

           

          But if your "Client_1.java" is trying to invoke an EJB deployed on JBoss AS 6/5/4  then you should try including at least the following JARs in your "Client_1" classpath.

           

          Because if you are simply copying the "jbossall-client.jar" JAR in your client classpath then it wont work because it uses the relative path to point to the other respective JARs to the classpath.  Please see the file "jbossall-client.jar/META-INF/MANIFEST.MF"  for more details.    So your Client needs at least the following JARs in the classpath.

           

          CLIENT_JARS_DIR=/JBoss_All/jboss-eap-5.x/jboss-as/client
          
          export  CLASSPATH="${CLIENT_JARS_DIR}/jboss-logging-spi.jar:${CLIENT_JARS_DIR}/jnp-client.jar:${CLIENT_JARS_DIR}/jboss-ejb3-proxy-impl-client.jar:${CLIENT_JARS_DIR}/jboss-ejb3-common-client.jar::${CLIENT_JARS_DIR}/jboss-aspect-jdk50-client.jar:${CLIENT_JARS_DIR}/jboss-remoting.jar:${CLIENT_JARS_DIR}/jboss-aop-client.jar:${CLIENT_JARS_DIR}/jboss-common-core.jar:${CLIENT_JARS_DIR}/jboss-serialization.jar:${CLIENT_JARS_DIR}/jboss-ejb3-security-client.jar:${CLIENT_JARS_DIR}/jbosssx-client.jar:${CLIENT_JARS_DIR}/jboss-security-spi.jar:${CLIENT_JARS_DIR}/jboss-javaee.jar:${CLIENT_JARS_DIR}/ejb3-persistence.jar:${CLIENT_JARS_DIR}/jboss-ejb3-security-client.jar:${CLIENT_JARS_DIR}/jboss-ejb3-vfs-spi.jar:${CLIENT_JARS_DIR}/concurrent.jar:${CLIENT_JARS_DIR}/jboss-ejb3-proxy-spi-client.jar:${CLIENT_JARS_DIR}/jboss-ejb3-core-client.jar:${CLIENT_JARS_DIR}/jboss-integration.jar"
          

           

           

          Regards

          Jay SenSharma