Different classpath for Servlet vs. JSP in the same containi
sash Aug 25, 2001 8:28 AMFirst up, kudos to JBoss's authors and maintainers. JBoss is superb.
I'm using:
- NT4
- J2SDK-1.3.0
- JBoss-2.2.2_Tomcat-3.2.2
I'm just starting to experiment with JBoss and have discovered something a little odd.
- When I want a Servlet to use an EJB (e.g. the Interest example), it can simply import and use it. This means (i) the home and remote classes are in my own classpath at compile time and (ii) they are in the relevant JBoss classloader's classpath once the .ear is deployed.
- When I want a JSP inside the same .war file inside the same .ear file to use the same EJB, it can't. Instead the stacktrace below appears. This suggests that, while the deployed environment for the contents of the .war file includes the EJBs declared in the .ear's application.xml (or thereabouts), the environment used for invoking the Java compiler to compile the .JSP files from the same .war file does not include those EJBs in its classpath. I have found that copying the EJB's .jar file into the .war's lib/ directory causes things to work again, but this duplication seems wasteful and (potentially) bug-inducing.
Is there a better way? Is this a JBoss bug? Is this simply a consequence of the J2EE spec?
Thanks.
--
Error: 500
Location: /Test.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSPE:\bin\jboss.org\JBoss-2.2.2_Tomcat-3.2.2\tomcat\work\localhost_8080\_0002fTest_0002ejspTest_jsp_1.java:13: Class org.jboss.docs.interest.Interest not found in import.
import org.jboss.docs.interest.Interest;
^
1 error
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:612)
at org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:542)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:258)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:268)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Unknown Source)