Hi
I have created a helloWorld
EJB and deploy it on the Sun Application Server. However I can not get my
Servlet to call the business method on the Servlet. So I create a
java application just to call the EJB. It really surprise me that the java app can call the helloworld app successfully. I wonder if the there is some servlet deployment problem I encounter? I am using tomcat-5_5_8.
The code that I am using to call the EJB is the same as in the servlet and the java app.
code :
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
env.put("java.naming.provider.url", "iiop://127.0.0.1:3780");
env.put("java.naming.security.principal", "user");
env.put("java.naming.security.credentials", "password");
Context con = new InitialContext(env);
Object obj = con.lookup("ejb/HelloWorldBean");
HelloWorldRemoteHome home = (HelloWorldRemoteHome) PortableRemoteObject.narrow(obj, HelloWorldRemoteHome.class);
HelloWorldRemote businObj = home.create();
String msg = businObj.getHelloWorldMsg();
businObj.remove();
//end of code.
the code that has error is this line :
HelloWorldRemoteHome home = (HelloWorldRemoteHome) PortableRemoteObject.narrow(obj, HelloWorldRemoteHome.class);
The error code is noClassDefFound error
: can not find the class com.sample.HelloWorldRemoteHome
However I have include the same client.jar in my java app and servlet.
So I dont think the problem is the client.jar file.
Thanks for the interest in reading my long question.
Thanks
Chee Yong
LPP (Lowest Paid Programmer)