0 Replies Latest reply on Jul 17, 2002 2:56 PM by Jeff

    jsp -> servlet -> ejbBean = NoClassDefFound

    Jeff Newbie

      I'm having problems accessing an ejbBean from a servlet that is called from a jsp. I can access the bean from the jsp directly just fine, but not by calling the servlet from the jsp. I'm using JBoss2.4.4/Jetty3.1.7-1. I've seen from other messages that one soultion is to precompile the jsp, which should fix this, but I've done that and I still get the same error (at bottom of message)

      Is there anything special I have to do when precompiling the jsp to have the Classpath set properly other than putting -classpath $MY_CLASSPATH in the command, like:

      java -classpath $MY_CLASSPATH org.apache.jasper.JspC $*.jsp

      then I run

      javac -classpath $MY_CLASSPATH $*.java
      (I manually put the servlet into my web.xml)

      Or does the fact that it compiles fine, mean that the classpath is set properly, and should be in the $*.class file?

      A few notes:
      The class I am looking for is in City.jar, which is deployed fine, and the servlet can find this, as when I don't deploy City.jar, the servlet complains that City.jar isn't bound. This is how I'm trying to access the bean inside LaneTag.java, my lane.jsp code is also below (prior to compiling it using JspC)

      CityBeanHome cHome = (CityBeanHome) PortableRemoteObject.narrow(ctx.lookup("CityBeanHome"),CityBeanHome.class);

      I'm not using *.war, and simply have all my *.jar in my deploy directory.

      Or, does anyone have any suggestions? Anything would be appreciated!

      Thanks for any help,
      Jeff

      ****** error message *******
      10:40:04.241 WARN!! [SocketListener-1]org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:441)12>
      + Servlet Error for /lane.jsp
      + java.lang.NoClassDefFoundError: viking.trucking.location.CityBeanHome
      + at viking.trucking.jsp.tags.LaneTag.class$(LaneTag.java:20)
      + at viking.trucking.jsp.tags.LaneTag.doStartTag(LaneTag.java:152)
      + at viking.trucking.jsp.base.lane._jspService(lane.java:82)
      + at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
      + at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      + at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:488)
      + at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:403)
      + at org.mortbay.http.HandlerContext.handle(HandlerContext.java:1050)
      + at org.mortbay.http.HandlerContext.handle(HandlerContext.java:1003)
      + at org.mortbay.http.HttpServer.service(HttpServer.java:774)
      + at org.jboss.jetty.Jetty.service(Jetty.java:331)
      + at org.mortbay.http.HttpConnection.service(HttpConnection.java:745)
      + at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:918)
      + at org.mortbay.http.HttpConnection.handle(HttpConnection.java:760)
      + at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:155)
      + at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:287)
      + at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:775)
      + at java.lang.Thread.run(Thread.java:484)

      ********* lane.jsp code *************
      <%@ taglib uri="viking.tld" prefix="mt" %>

      display lanes
      <mt:lane />


      <%@ page
      language="java"
      info="lane"
      contentType="text/html"
      import="javax.naming.*, javax.ejb.*,
      java.util.*, viking.trucking.jsp.tags.*,
      viking.trucking.location.*, viking.utils.*"
      %>

      <BODY id=canvas>

      <TABLE border=0 WIDTH=100% HEIGHT=100%>
      <%=lanes%>