tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jay Glanville" <jay.glanvi...@naturalconvergence.com>
Subject Problems running pre-compiled JSP classes when in subdirectories
Date Wed, 07 Jan 2004 13:20:01 GMT
I originally posted this question back in mid-December, but without any
responses.  In the hopes that someone will have a hit or a solution, I'm
reposting the question again.


I'm having a problem when I try to use my pre-compiled JSP files: I
receive a NoClassDefFoundError exception.  Here's what I'm doing ...

I have pre-compiled my JSP classes using the JspC plugin from ant.  My
files compile without complaint.  However, when I try to access the
files through tomcat, I receive some NoClassDefFoundError exceptions.
But these exceptions only occur when I'm accessing JSPs in the
subdirectories off of the web root.

Here's my application's background.  I have two files:
  <WEBROOT>/index.jsp
  <WEBROOT>/dir/index.jsp
The contents of the two files are just simple HTML.  I precompiled the
JSP using the JspC ant target, then compiled using javac.  Finally, I
created a context pointing the work directory to the location of my java
and class files.  When I tried to access the first file
(http://localhost/context/index.jsp) everything went fine.  However,
when I tried to access the second file
(http://localhost/context/dir/index.jsp), I received the
NoClassDefFoundError.  The log file looks like this:

2003-12-15 20:11:25 StandardWrapperValve[jsp]: Servlet.service() for
servlet jsp threw exception
javax.servlet.ServletException: org/apache/jsp/index_jsp (wrong name:
org/apache/jsp/dir/index_jsp)
	at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        [deleted ...]
----- Root Cause -----
java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp (wrong name:
org/apache/jsp/dir/index_jsp)
	at java.lang.ClassLoader.defineClass0(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
	at
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:215)
        [deleted]

Now, according to my research on this mailing list, the most frequent
reason for a NoClassDef error is capitalization.  However, this isn't
the case in my situation as the two package names are completely
different: org/apache/jsp/index_jsp vs. org/apache/jsp/dir/index_jsp.

I'm using Tomcat 4.1.29.

Any suggestions on how to alleviate this situation would be greatly
appreciated.

Thanks

JDG

PS: I should also point out that I have tried the recommended way of
precompiling my JSP by converting to servlets
(http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper-howto.html#Web%2
0Application%20Compilation).  However, I have a problem with this
method: it makes it that much harder to patch my application.  With the
non-servlet approach, I just simply deliver the modified JSP files. With
the servlet approach, I need to deliver the classes, plus ensure that
the web.xml is correct (add new entries, remove old ones, modify where
needed), plus restart the context.




--
Jay Glanville



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


Mime
View raw message