Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: Re: Trouble with jsp finding .class file in Tomcat 3.2


Message #1 by "Anson C." <ansonc@l...> on Thu, 11 Apr 2002 17:17:41
I haven't figured out completely the why yet, but it seems to have 
something to do with the WEB-INF directory (WEB-INF is found in the root 
of your webapp directory)  There needs to be another folder 
called 'classes', to which you put the projsp folder (containing  
SpellCheck.class.)

> I am working with the 'spellcheck' example in Chapter 2 (p 46 in my
> book), and cannot get the JSP file to 'find' the SpellCheck class file.
> 
> 
> I am using Tomcat 3.2.2 via IIS on an NT workstation. I am able to run
> the earlier JSP-only examples from the book without errors, and to run
> the JSP-to-Bean examples provided with the Tomcat installation. My java
> file compiles without errors, and if I stick a main method in it I can
> run it from the command line. The class is not part of a package. In
> wordpro.jsp, I'm including these lines to get at the class:
> 
> <jsp:useBean id="spellcheck" scope="request" class="SpellCheck" />
> <jsp:setProperty name="spellcheck" property="*" />
> 
> then later in the JSP I get at methods etc with syntax like this:
> 'out.println(spellcheck.check());'
> 
> When I run the example, the error I get is this:
> 
> --------------------------
> 
> Location: /wench_test/jsp/46/wordpro.jsp
> Internal Servlet Error:
> 
> org.apache.jasper.JasperException: Unable to compile class for
> JSPD:\jakarta-tomcat-3.2.2\work\localhost_8080%
2Fwench_test\_0002fjsp_0002f_00034_00036_0002fwordpro_0002ejspwordpro_jsp_0
.java:60:
> Class jsp._00034_00036.SpellCheck not found.
>                 SpellCheck spellcheck = null;
>                 ^
> D:\jakarta-tomcat-3.2.2\work\localhost_8080%
2Fwench_test\_0002fjsp_0002f_00034_00036_0002fwordpro_0002ejspwordpro_jsp_0
.java:63:
> Class jsp._00034_00036.SpellCheck not found.
>                     spellcheck= (SpellCheck)
>                                  ^
> D:\jakarta-tomcat-3.2.2\work\localhost_8080%
2Fwench_test\_0002fjsp_0002f_00034_00036_0002fwordpro_0002ejspwordpro_jsp_0
.java:68:
> Class jsp._00034_00036.SpellCheck not found.
>                             spellcheck = (SpellCheck)
> Beans.instantiate(this.getClass().getClassLoader(), "SpellCheck");
>                                           ^
> 3 errors
> 
> 	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
> 	at org.apache.jasper.servlet.JspServlet.doLoadJSP
(JspServlet.java:612)
> 	at
> org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
> 	at org.apache.jasper.servlet.JspServlet.loadJSP
(JspServlet.java:542)
> 	at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary
(JspServlet.java:258)
> 	at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.service
(JspServlet.java:268)
> 	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
(ContextManager.java:797)
> 	at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
> 	at
> 
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnectio
n(Ajp12ConnectionHandler.java:166)
> 	at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
> 	at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run
(ThreadPool.java:501)
> 	at java.lang.Thread.run(Thread.java:484)
> 
> --------------------------
> 
> My classpath (displayed when I startup Tomcat) is:
> 'Using CLASSPATH:
> d:\jakarta-tomcat-3.2.2\classes;
> d:\jakarta-tomcat-3.2.2\lib\ant.jar;
> d:\jakarta-tomcat-3.2.2\lib\jasper.jar;
> d:\jakarta-tomcat-3.2.2\lib\jaxp.jar;
> d:\jakarta-tomcat-3.2.2\lib\parser.jar;
> d:\jakarta-tomcat-3.2.2\lib\servlet.jar;
> d:\jakarta-tomcat-3.2.2\lib\webserver.jar;
> d:\orant816\jdbc\lib\classes12.zip;
> d:\orant816\jdbc\lib\nls_charset12.zip;
> d:\jakarta-tomcat-3.2.2\webapps\;.;;
> c:\jdk1.3.0_02\lib\tools.jar'
> 
> It also says 'Including all jars in d:\jakarta-tomcat-3.2.2\lib in your
> CLASSPATH.'
> 
> My JSP & HTML file for this example is in
> d:\jakarta-tomcat-3.2.2\webapps\wench_test\jsp\46\
> 
> I have left my compiled SpellCheck.class there, and also put a copy of
> it in 
> d:\jakarta-tomcat-3.2.2\webapps\ROOT\WEB-INF\classes\ (because I read
> that any class files in there would be automatically found by Tomcat --
> s'not true).
> 
> I had also read that the class file HAD to be JAR'd and put in various
> places (including d:\jakarta-tomcat-3.2.2\lib\), which also didn't
> work.
> 
> Any help would be appreciated. I've been messing with this for a few
> days and reading anything I can find on the issue, and the basics (make
> sure the class and/or jar file is in the classpath, etc) isn't helping
> me.
> 

  Return to Index