javax naming CommunicationException
919081Jun 10 2012 — edited Jun 10 2012i,
I am calling an interface from my client ( simple java) from eclipse.
My client.java
package ejb.client;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import ejb.interfaces.AreaRemoteBI;
public class Client {
public static void main(String[] a) {
Object ref = null;
Context ctx;
try {
ctx = getInitialContext();
ref = ctx.lookup("AreaBean/remote");
} catch (NamingException e) {
e.printStackTrace();
}
AreaRemoteBI biCall = (AreaRemoteBI)ref;
String result = null;
result = biCall.searchArea("IND");
System.out.println("\n The resul is:::"+result);
}
public static Context getInitialContext()
throws javax.naming.NamingException
{
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.NamingContextFactory");
properties.put(Context.PROVIDER_URL, "jnp://localhost:1099");
properties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
return new InitialContext(properties);
}
}
I kept my remote interface in the same package of client ( client side). jndi.properties placed at the root folder of client...
I have both local and remote in the serverside. The local and remote interfaces, bean and entity have been bundled in a jar and deployed in JBOSS.
Now when I run my client as java program i am getting following exception
javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: com.oic.hcs.interfaces.area.AreaRemoteBI (no security manager: RMI class loader disabled)]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:786)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at javax.naming.InitialContext.lookup(Unknown Source)
at ejb.client.Client.main(Client.java:27)
Caused by: java.lang.ClassNotFoundException: com.oic.hcs.interfaces.area.AreaRemoteBI (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader.loadProxyClass(Unknown Source)
at sun.rmi.server.MarshalInputStream.resolveProxyClass(Unknown Source)
at java.io.ObjectInputStream.readProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.rmi.MarshalledObject.get(Unknown Source)
at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:710)
... 3 more
Exception in thread "main" java.lang.NullPointerException
at ejb.client.Client.main(Client.java:35)
Please help....