• Post Reply Bookmark Topic Watch Topic
  • New Topic

Weblogic error when servlet calls sessionBean  RSS feed

 
meera kanekal
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to test a very basic scenario on WEblogic server 8.1 I have a servlet that calls a stateless session bean. I have deployed the EJB jar file and the servlet war file successfully. The servlet bombs when it tries to access my EJBHome withe following error -
java.lang.NoClassDefFoundError: empVerifySessionHome
at empControllerServlet.processRequest(empControllerServlet.java:82)
at empControllerServlet.doGet(empControllerServlet.java:103)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
-------------
The servlet code is as follows
/*
* empControllerServlet.java
*/

import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.naming.*;
import javax.rmi.PortableRemoteObject;

public class empControllerServlet extends HttpServlet {

public empVerifySession MyempVeri = null;
public empVerifySessionHome MyempVeriHome = null;
public void init(ServletConfig config) throws ServletException {
try {
InitialContext ctx = new InitialContext();

Object objref = ctx.lookup("java:comp/env/ejb/empVeri");
MyempVeriHome = (empVerifySessionHome)
PortableRemoteObject.narrow(objref, empVerifySessionHome.class);
} catch (Exception NamingException) {
NamingException.printStackTrace();
}

}

public void destroy() {

}

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>empVerify Testing</title>");
out.println("</head>");
out.println("<body>");

try{
MyempVeri = MyempVeriHome.create();
// ********* bombs in the above statement ************
out.println("<p align=\"center\"> Message from Session Bean is: <b>" +
MyempVeri.verifyEmployee("xxx", "yyy") + "</b></p>");
MyempVeri.remove();
}catch(Exception CreateException){
CreateException.printStackTrace();
}
out.println("</body>");
out.println("</html>");
out.close();
}

protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
public String getServletInfo() {
return "Short description";
}

}
----------
All deployment descriptors seem OK when viewed on the weblogic console from a browser although at the command line console I see this message
<Warning> <HTTP> <BEA-101174> <Did not find ejb-ref in web.xml matching empVeri.>
but the ejb-ref can be seen from the weblogic console!
Any help is greatly appreciated
thanks
Meera
 
Prakash Pillai
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Meera,

I guess it is unable to find class file i.e home interface .so in your startup bat file set CLASSPATH of classes folder.and try to run again the same program.

Prakash
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!