tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jay Glanville" <>
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:
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:
	at javax.servlet.http.HttpServlet.service(
        [deleted ...]
----- Root Cause -----
java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp (wrong name:
	at java.lang.ClassLoader.defineClass0(Native Method)
	at java.lang.ClassLoader.defineClass(
	at java.lang.ClassLoader.defineClass(

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



PS: I should also point out that I have tried the recommended way of
precompiling my JSP by converting to servlets
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:
For additional commands, e-mail:

View raw message