Session Bean Lookup Error
gurrie09 Feb 16, 2006 3:27 AMHiAll,
I am trying to gettting a very simple application running, involving a stateless session bean and the client. I have managed to get the session bean deployed and it is running. My problem comes when I lookup the session bean from the client application. I get the following error.
java.lang.ClassCastException: org.jnp.interfaces.NamingContext
at com.gurrie.simple.client.SimpleSessionBeanClient.main(SimpleSessionBeanClient.java:14)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
The code for my client is as follows :
public class SimpleSessionBeanClient {
public static void main(String[] args) {
try {
InitialContext ctx = new InitialContext();
SimpleSession simpleSession = (SimpleSession) ctx.lookup("SessionTest");
for (int i = 0; i < args.length; i++) {
String returnedString = simpleSession.echoString(args);
System.out.println("sent string: " + args + ", received string: " + returnedString);
}
} catch (Throwable e) {
e.printStackTrace();
}
}
}
My class path contains the following jars :
C:\Program Files\jboss-4.0.4RC1\lib\concurrent.jar
C:\Program Files\jboss-4.0.4RC1\server\default\deploy\jboss-aop-jdk50.deployer\jboss-aop-jdk50.jar
C:\Program Files\jboss-4.0.4RC1\server\default\deploy\jboss-aop-jdk50.deployer\jboss-aspect-library-jdk50.jar
C:\Program Files\jboss-4.0.4RC1\lib\jboss-common.jar
C:\Program Files\jboss-4.0.4RC1\server\default\deploy\ejb3.deployer\jboss-ejb3.jar
C:\Program Files\jboss-4.0.4RC1\server\default\deploy\ejb3.deployer\jboss-ejb3x.jar
C:\Program Files\jboss-4.0.4RC1\server\default\lib\jboss-remoting.jar
C:\Program Files\jboss-4.0.4RC1\server\default\lib\jboss-transaction.jar
C:\Program Files\jboss-4.0.4RC1\server\default\lib\jboss.jar
C:\Program Files\jboss-4.0.4RC1\server\default\lib\jnpserver.jar
Any help would be greatly appreciated!
Regards,
Brian