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
Are your classes in a package? Did you review of the documentation include http://jakarta.apache.org/tomcat/faq/classnotfound.html ?
(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.
(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.
(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.