hi
I am working with EJB3 in
jboss container using a eclipse id. I created a
test session bean(stateless) and created a remote interface. I have my
ejb in a separate ear and i am trying to access the ejb through from UserInterface ear (differrent ear but they share the same jvm). I get a class cast exception
Object ob = context.lookup("pfmbusinessenterprise/CalculatorBean/remote");
CalculatorRemote calc = (CalculatorRemote) PortableRemoteObject.narrow(ob, CalculatorRemote.class);
I explicitly created CalculatorRemote interface in the UserInterface ear.
I dont get this error when i explicitly add the ejb application as a dependency. I dont want to do this as i wanted to have the 2 ears separate.
JNDI look up is fine but its the casting that is causing a problem. I dont know what i am missing..
java.lang.ClassCastException
18:33:18,996 ERROR [STDERR] at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(Unknown Source)
18:33:18,996 ERROR [STDERR] at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
18:33:18,996 ERROR [STDERR] at business.test.clienttest.test(clienttest.java:13)
@ Stateless
public class CalculatorBean implements CalculatorRemote {
public
String test (){
return "You are ok";
}
}
import javax.ejb.Remote;
@Remote
public interface CalculatorRemote {
public String test ();
}
Any help would be great.