|
Home > Archive > WebSphere Application Server > July 2007 > Cannot call EJB from Servlet
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Cannot call EJB from Servlet
|
|
|
| I am developing J2EE project in which a servlet calls an EJB on WAS 5.1.x using RSA 6. In the web project, I have made a reference to the EJB project such that there is no syntax error in the web project. A snippet of code is shown as follows:
Object oRef = ic.lookup("ejb/ejbs/HdlrHome");
// Error occurs here
HdlrHome abc = (HdlrHome) PortableRemoteObject.narrow
( oRef, HdlrHome.class );
Hdlr k = abc.create();
String str = k.getString();
The content of the /WebContent/META-INF/MANIFEST.MF is shown below, indicating the web project will reference the EJB Client JAR file "HdlrClient.jar":
Manifest-Version: 1.0
Class-Path: HdlrClient.jar
Finally, I look into the EAR file which already included the WAR file as "Modules" and the EJB Client JAR "HdlrClient.jar" as "Project Utility JARs" that I think the web servlet should be able to call the EJB as the client .class files are already include
in the EAR file as a whole.
However, when I run the servlet after deploying the EAR file, WAS server complained the Class "HdlrHome" cannot be found:
E SRVE0026E: [Servlet Error]-[ejbs.HdlrHome]: java.lang.NoClassDefFoundError: ejbs.HdlrHome
Anyone knows why it is so and how to resolve it? (The EAR file is attached for reference)
| |
| Brian S Paskin 2007-07-24, 1:26 pm |
| Hi, I deployed you .ear file and it worked correctly for me. I received a message "Hello World" back.
Brian
|
|
|
|
|