EJB 3.0 client
javion May 10, 2006 1:28 AMhi,
I am trying to execute a client for an EJB 3.0 program that I deployed using JBoss 4.0.4 RC2.
there is some problem and am not able to figure it out.
here is the exception
javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: org.jboss.proxy.ejb.EJBMetaDataImpl (no security manager: RMI class loader disabled)]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at client.CalculatorClient.main(CalculatorClient.java:45)
Caused by: java.lang.ClassNotFoundException: org.jboss.proxy.ejb.EJBMetaDataImpl (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:371)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1538)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:652)
... 3 more
javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: org.jboss.proxy.ejb.EJBMetaDataImpl (no security manager: RMI class loader disabled)]
this is my client program
/**
*
*/
package client;
import calc.Calculator;
//import calc.CalculatorRemote;
import javax.naming.Context;
import javax.naming.InitialContext;
import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable;
public class CalculatorClient {
public static void main(String[] args) throws Exception
{
// Look up home interface
Hashtable env = new Hashtable();
//env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
//Host at which JBoss server is listening
//env.put(Context.PROVIDER_URL, "localhost:11099");
//env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
System.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
System.setProperty(Context.PROVIDER_URL, "localhost:1099");
System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
try
{
/* Context ctx = new InitialContext();
Calculator calculator = (Calculator) ctx.lookup("leaving/StatelessCalculator/local");
System.out.println("1 + 1 = " + calculator.add(1, 1));*/
InitialContext ctx = new InitialContext();
Calculator calculator = (Calculator) ctx.lookup("leaving/StatelessCalculator/remote");
System.out.println("1 + 1 = " + calculator.add(1, 1));
//System.out.println("1 - 1 = " + calculator.subtract(1, 1));
}catch (Exception e)
{
e.printStackTrace();
System.out.println(e);
}
}
}
can you please help me write a proper client program.