Bug 36198 - Class loading/compilation error
Summary: Class loading/compilation error
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Servlet & JSP API (show other bugs)
Version: 5.5.9
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL: http://136.142.92.26:8080/gnm/mode_sh...
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-15 23:04 UTC by mshst38
Modified: 2005-08-17 13:06 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mshst38 2005-08-15 23:04:34 UTC
I have encountered an odd error I have been unable to solve.  I have reviewed 
all the Tomcat documentation and searched Bugzilla for a solution but nothing 
has worked so far.  In summary I have created a set of JSPs and Java classes 
that are used to visualize pre-generated biological data for a research 
project.  These JSPs interact with the Java classes to perform some file IO and 
other activities.  The problem I have encountered is as follows: the JSPs spit 
out java.lang.NoClassDefFoundError errors when accessed, so I've concluded they 
cannot 'see' the Java classes I have created for them to use.  I have gone 
through a number of troubleshooting solutions including: Placing the classes in 
the 'WEB-INF/classes' directory of the web application root where the JSPs are 
stored, copying the classes to the working dorectory where the JSPs are 
compiled (both en masse and with the full package structure), and I have tried 
specifying the CLASSPATH used to compile the JSPs with the web.xml file in 
the 'WEB-INF' directory of the web application root.  None of these have solved 
the problem.  The exact error I'm getting is as follows: 

javax.servlet.ServletException: Replacer
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException
(PageContextImpl.java:848)
	org.apache.jasper.runtime.PageContextImpl.handlePageException
(PageContextImpl.java:781)
	org.apache.jsp.mode_005fshape_005fvisual_jsp._jspService
(org.apache.jsp.mode_005fshape_005fvisual_jsp:235)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:322)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause 

java.lang.NoClassDefFoundError: Replacer
	Mode_Shape_Session.<init>(Mode_Shape_Session.java:183)
	org.apache.jsp.mode_005fshape_005fvisual_jsp._jspService
(org.apache.jsp.mode_005fshape_005fvisual_jsp:143)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:322)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

To generate the problem go to the URL listed with this bug report and click on 
the "Go iGNM" button.

How do I configure Tomcat to look for my Java classes when compiling JSPs?  Or 
where do I place the compiled classes so the JSP compiler can see them when the 
JSPs are compiled?  This project will result in a article publication in a 
major scientific journal, and any help you can offer would surely be noted in 
said article.  

Thanks,
  Mark Holliman
Comment 1 Mark Thomas 2005-08-15 23:17:32 UTC
Are your classes in a package?

Did you review of the documentation include 
http://jakarta.apache.org/tomcat/faq/classnotfound.html ?
Comment 2 mshst38 2005-08-17 15:27:11 UTC
(In reply to comment #1)
> Are your classes in a package?
> Did you review of the documentation include 
> http://jakarta.apache.org/tomcat/faq/classnotfound.html ?

There is a single folder with a collection of classes that are not in a 
package, and then inside that folder there is a package of other classes.  

I have reviewed that documentation and it did not solve the problem.

The oddest part of this problem is that it has been occuring seemingly 
randomly.  I encountered it early in development and then started copying the 
classes into the working directory for the webapp which seemed to fix the 
problem for awhile.  Then after making a few alterations to the existing 
classes the problem has resurfaced.
Comment 3 Mark Thomas 2005-08-17 19:17:15 UTC
(In reply to comment #2)
> > Did you review of the documentation include 
> > http://jakarta.apache.org/tomcat/faq/classnotfound.html ?
> 
> There is a single folder with a collection of classes that are not in a 
> package, and then inside that folder there is a package of other classes.  

The FAQ makes clear that all classes should be in a package. I suspect that this
is the root cause of the issue. Please put all your classes in a package and retest.
Comment 4 mshst38 2005-08-17 21:06:40 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > > Did you review of the documentation include 
> > > http://jakarta.apache.org/tomcat/faq/classnotfound.html ?
> > 
> > There is a single folder with a collection of classes that are not in a 
> > package, and then inside that folder there is a package of other classes.  
> The FAQ makes clear that all classes should be in a package. I suspect that 
this
> is the root cause of the issue. Please put all your classes in a package and 
retest.

Thank you for your help, this appears to have fixed the problem.