When you compiled you should have produced a number of files,
several of the form Validate$<Number>.class - these are the files you need
to copy over to the WEB-INF/classes/main directory. If Tomcat couldn't find
the Query class it would have told you so, but it can't find the anonymous
class definitions.
Randy
> -----Original Message-----
> From: [ .--- --- .... -. / -... --- .-- . -. ]
> [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 26, 2001 8:06 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Completely frustrated with NoClassDefFoundError...
>
>
> Randy Layman:
> > It would seem that you haven't copied anonymous class
> #5 in Validate
> > over. The actual class it can't find is main.Validate$5, the $
> > indicates an inner class. I believe that the 5 indicates the fifth
> > anonymous (class without a name) class.
>
> Thanks for the help in diagnosing the output. You're right, when I
> comment out some code, the number changes based on which
> anonymous class it
> is.
>
> My main.Validate class does create an anonymous inner class
> of a Query
> object, found and imported from a file Query.class in the "database"
> package.
>
> Here's my dir structure:
> /WEB-INF
> /classes
> /database
> Query.class
> /main
> Validate.class
>
> Basic calling code in Validate.class looks like:
>
> return new Query()
> {
> private int getResults()
> {
> try
> {
> execute();
> return userValue;
> }
> catch( SQLException sqle )
> {
> return -1;
> }
> }
> }.getResults();
>
> At the beginning of Validate.class, I do have "import
> database.Query;"
> declared. Do I need some special imports for other non-JDK
> packages? Is
> there something else I need to put into Meta-Inf that tells
> Tomcat where to
> find these other packages? [I assumed since everything was
> .class files
> under the /classes directory, it would all fall perfectly into place].
>
> I can't believe I'm so stuck on this.
>
> - John
>
> -----------------
> Original message starting it all:
> > Environment:
> >
> > I've got Tomcat 3.2.2 under IIS 5 as an NT in-process with
> > JavaService and
> > am using JDK1.3.
> >
> > I installed the JavaService with the "hotspot" option,
> > rather than the
> > "classic" option.
> >
> > I compile everything under JBuilder 4 on another machine,
> also using
> > JDK1.3.
> >
> > Tried creating both a /streamer directory under webapps,
> > and also putting
> > it in another directory and adding a context in server.xml.
> > Tomcat service
> > starts up and runs non-bean JSPs just fine. However, anytime
> > I try and use
> > a bean in a JSP [<jsp:useBean id="validator" class="main.Validate"
> > scope="request" />], I get a 500 error. The file
> > webapps/streamer/WEB-INF/classes/main/Validate.class DOES
> > exist, the line
> > "package main;" is appropriately in the source code, and I've
> > made sure both
> > the class declaraction and the methods in the bean are public.
> >
> > Strange thing is that I could have sworn this all worked
> > when I tested
> > Tomcat out - perhaps this was before I installed JavaService? Even
> > stranger, when I open up jasper.log, it says "Classpath
> > according to the
> > servlet engine is:
> > E:\tomcat\webapps\streamer\WEB-INF\classes" among other
> > things. So, Tomcat's classpath seems right, my .class file
> > in the right
> > package, I've rechecked case-sensitivity at least two dozen
> > times, why can't
> > it see this or any other .class file?
> >
> > ANY help on this would be greatly appreciated, I'm tearing
> > my limbs off
> > here.
> >
> > Full error message underneath my signature.
> >
> > Thanks in advance.
> > - John
> >
> >
> > ---
> > Error: 500
> > Location: /streamer/authenticate.jsp
> > Internal Servlet Error:
> >
> > javax.servlet.ServletException: main/Validate$5
> > at
> > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:508)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > at
> > org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper
> > .java:405)
> > at org.apache.tomcat.core.Handler.service(Handler.java:287)
> > at
> >
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> > at
> > org.apache.tomcat.core.ContextManager.internalService(ContextM
> > anager.java:79
> > 7)
> > at
> >
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
> > at
> > org.apache.tomcat.service.connector.Ajp12ConnectionHandler.pro
> > cessConnection
> > (Ajp12ConnectionHandler.java:166)
> > at
> > org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoin
> > t.java:416)
> > at
> > org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPo
> > ol.java:501)
> > at java.lang.Thread.run(Thread.java:484)
> >
> > Root cause:
> > java.lang.NoClassDefFoundError: main/Validate$5
> > at java.lang.Class.newInstance0(Native Method)
> > at java.lang.Class.newInstance(Class.java:237)
> > at java.beans.Beans.instantiate(Beans.java:207)
> > at java.beans.Beans.instantiate(Beans.java:51)
> > at
> > _0002fauthenticate_0002ejspauthenticate_jsp_7._jspService(_000
> > 2fauthenticate
> > _0002ejspauthenticate_jsp_7.java:72)
> > at
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > at
> > org.apache.jasper.servlet.JspServlet$JspCountedServlet.service
> > (JspServlet.ja
> > va:130)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > at
> > org.apache.jasper.servlet.JspServlet$JspServletWrapper.service
> > (JspServlet.ja
> > va:282)
> > at
> > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet
> > .java:429)
> > at
> > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > at
> > org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper
> > .java:405)
> > at org.apache.tomcat.core.Handler.service(Handler.java:287)
> > at
> >
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> > at
> > org.apache.tomcat.core.ContextManager.internalService(ContextM
> > anager.java:79
> > 7)
> > at
> >
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
> > at
> > org.apache.tomcat.service.connector.Ajp12ConnectionHandler.pro
> > cessConnection
> > (Ajp12ConnectionHandler.java:166)
> > at
> > org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoin
> > t.java:416)
> > at
> > org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPo
> > ol.java:501)
> > at java.lang.Thread.run(Thread.java:484)
> >
>