tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Exception running precompiled JSP
Date Fri, 21 Jan 2011 22:28:08 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

All,

I'm playing around with the JSP precompiler in TC 7 and I'm having
trouble running the compiled JSP.

The JSP itself is trivial:

<%@page pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
  <body>
    <h1>Example Pre-compiled JSP</h1>

    <ol>
    <c:forEach var="num" items="{1,2,3,4}">
      <li>Item #<c:out value="${num}" /></li>
    </c:forEach>
    </ol>
  </body>
</html>

It compiles without a problem. I have it packaged into a .jar file with
a META-INF/web-fragment.xml file that looks like this:

<?xml version="1.0" encoding="UTF-8"?>

<web-fragment xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"
version="3.0">
<!--
Automatically created by Apache Tomcat JspC 1/21/11 5:16 PM.
- -->

    <servlet>
        <servlet-name>org.apache.jsp.Test_jsp</servlet-name>
        <servlet-class>org.apache.jsp.Test_jsp</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>org.apache.jsp.Test_jsp</servlet-name>
        <url-pattern>/Test.jsp</url-pattern>
    </servlet-mapping>

</web-fragment>

When I invoke the JSP from my web browser, I get the runtime error whose
full stack trace is at the end of this post.

Basically, the error is this:

java.lang.NoClassDefFoundError: org/apache/jasper/runtime/JspSourceDependent

I checked, and that class can be found in CATALINA_BASE/lib/jasper.jar.

There are no instructions in
http://tomcat.apache.org/tomcat-7.0-doc/jasper-howto.html that suggest
that jasper.jar needs to be copied into the webapp's WEB-INF/lib
directory, and that seems dangerous anyway.

Is there something I'm missing? I'd appreciate any thoughts on why this
might not be working.

Thanks,
- -chris

The full stack trace:

javax.servlet.ServletException: Error instantiating servlet class
org.apache.jsp.Test_jsp
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:380)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
	java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	java.lang.Thread.run(Thread.java:662)

root cause

java.lang.NoClassDefFoundError: org/apache/jasper/runtime/JspSourceDependent
	java.lang.ClassLoader.defineClass1(Native Method)
	java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
	java.lang.ClassLoader.defineClass(ClassLoader.java:616)
	java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
	org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2775)
	org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1115)
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1610)
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1488)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:380)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
	java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	java.lang.Thread.run(Thread.java:662)

root cause

java.lang.ClassNotFoundException:
org.apache.jasper.runtime.JspSourceDependent
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1643)
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1488)
	java.lang.ClassLoader.defineClass1(Native Method)
	java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
	java.lang.ClassLoader.defineClass(ClassLoader.java:616)
	java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
	org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2775)
	org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1115)
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1610)
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1488)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:380)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
	java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	java.lang.Thread.run(Thread.java:662)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk06CHgACgkQ9CaO5/Lv0PCyhQCgoVDBryW+xw22U9kF8T2NRrut
r78An0EwKiHyexKOjCooz9bEscTs2sCz
=YxXn
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message