The problem in the recently downloaded and installed JBoss Dev Studio 9 and the embedded server ESA 6.4
i262666 Mar 3, 2016 1:37 AMAfter 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);
.....
.....
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