You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Christopher Stacy <cs...@world.std.com> on 2000/03/14 00:25:28 UTC

need help: JSP examples don't work (config issue?)

Hi,

The web pages do not seem to direct me to any kind of on-line 
reasource where I could find someone who might help me use Tomcat.  
I am having a problem which is most likely not a bug, but a misunderstanding
of how to install the software.  I know that this is the developer mailing list
and I aplogize if this is not a reasonable place to send this message, but after
hours and hours of searching around, this is the best place I could come up with. 

On NT4 SP6a, Apache 1.3.12, Tomcat 3.1M1, JAVA 2 JRE and JDK Standard Edition v1.3:

The Servlet examples (such as HelloWorldExample) work, but none of the JSP.
The form is presented, but then the result page gets HTTP 500.
This is my first experience with all this stuff, and I do not know how
to proceed because I could not figure out what the error is.
I have read the various README files and the FAQs, 
but still can't figure out the problem.

Is this a configuration problem?  I think I followed all the instructions.
I don't entirely understand the log files or transcripts, which I have below.
Is the java.lang.NoClassDefFoundError referring to a missing error handler,
or was that the original error?

Note that I put the JDK bin dirctory with "javac" in my PATH, but I do
not have any CLASSPATH variable (because I am under the impression that 
the tomcat startup script takes care of all CLASSPATH issues.)

Starting the JSP container:

 Using classpath: ..\classes;..\lib\webserver.jar;..\lib\jasper.jar;..\lib\xml.jar;..\lib\servlet.jar;\lib\tools.jar
 Starting tomcat. Check logs/tomcat.log for error messages
 Unhandled error! You might want to consider having an error page to report such errors more gracefully
 java.lang.NoClassDefFoundError: sun/tools/javac/Main
	 at org.apache.jasper.compiler.SunJavaCompiler.compile(SunJavaCompiler.java:128)
	 at org.apache.jasper.compiler.Compiler.compile(Compiler.java:231)
	 at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:412)
	 at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:147)
	 at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:159)
	 at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:259)
	 at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:367)
	 at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
	 at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:390)
	 at org.apache.tomcat.core.ContextManager.service(ContextManager.java:523)
	 at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
								(Ajp12ConnectionHandler.java:147)
	 at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:334)
	 at java.lang.Thread.run(Thread.java:484)

tomcat.log:
 <l:addContext path="/examples"  docBase="webapps/examples" />
 <l:addContext path=""  docBase="webapps/ROOT" />
 <l:addContext path="/test"  docBase="webapps/test" />
 <l:tomcat home="H:\Apache Group\jakarta-tomcat" classPath="..\classes;..\lib\webserver.jar;
                 ..\lib\jasper.jar;..\lib\xml.jar;..\lib\servlet.jar;\lib\tools.jar" />
 <l:addContext path="/admin"  docBase="webapps/admin" />
 <l:startEndpoint port="8080" handler="org.apache.tomcat.service.http.HttpConnectionHandler" />
 <l:startEndpoint port="8007" handler="org.apache.tomcat.service.connector.Ajp12ConnectionHandler" />

jasper.log:
 <JASPER_LOG> Mon Mar 13 18:01:31 EST 2000 Scratch dir for the JSP engine is: work\localhost_8080%2Fexamples</JASPER_LOG> 
 <JASPER_LOG> Mon Mar 13 18:01:31 EST 2000 IMPORTANT: Do not modify the generated servlets</JASPER_LOG> 
 <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000 JspEngine --> /jsp/colors/colrs.jsp</JASPER_LOG> 
 <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000 	     ServletPath: /jsp/colors/colrs.jsp</JASPER_LOG> 
 <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000 	        PathInfo: /colors/colrs.jsp</JASPER_LOG> 
 <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000 	        RealPath: H:\Apache Group\jakarta-tomcat\webapps\examples\jsp\colors\colrs.jsp</JASPER_LOG> 
 <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000 	      RequestURI: /examples/jsp/colors/colrs.jsp?color1=red&color2=green&action=Submit</JASPER_LOG> 
 <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000 	     QueryString: color1=red&color2=green&action=Submit</JASPER_LOG> 
 <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000 	  Request Params: </JASPER_LOG> 
 <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000 		 color2 = green</JASPER_LOG> 
 <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000 		 color1 = red</JASPER_LOG> 
 <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000 		 action = Submit</JASPER_LOG> 
 <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000 Classpath according to the Servlet Engine is: H:\Apache Group\jakarta-tomcat\webapps\examples\WEB-INF\classes</JASPER_LOG> 

Could someone please give me a clue as to what the problem might be?

Thanks!
Chris


Re: need help: JSP examples don't work (config issue?)

Posted by Christopher Stacy <cs...@spacy.Boston.MA.US>.
OK, I figured it out.  Being a newbie, it took me half a day!
So I think this should be in the Tomcat FAQ: JAVA_HOME.



Re: need help: JSP examples don't work (config issue?)

Posted by Arion <ar...@talentinfo.com.hk>.
Hi!

Have you put the $JAVA_HOME\lib\tools.jar in your classpath? The compiler within is required for compiling JSP files.

Most likely, you haven't configure the environment variable $JAVA_HOME and the classpath for the tools.jar becomes \lib\tools.jar (missing $JAVA_HOME prefix).

Hope this help.

Arion

Christopher Stacy wrote:

> Hi,
>
> The web pages do not seem to direct me to any kind of on-line
> reasource where I could find someone who might help me use Tomcat.
> I am having a problem which is most likely not a bug, but a misunderstanding
> of how to install the software.  I know that this is the developer mailing list
> and I aplogize if this is not a reasonable place to send this message, but after
> hours and hours of searching around, this is the best place I could come up with.
>
> On NT4 SP6a, Apache 1.3.12, Tomcat 3.1M1, JAVA 2 JRE and JDK Standard Edition v1.3:
>
> The Servlet examples (such as HelloWorldExample) work, but none of the JSP.
> The form is presented, but then the result page gets HTTP 500.
> This is my first experience with all this stuff, and I do not know how
> to proceed because I could not figure out what the error is.
> I have read the various README files and the FAQs,
> but still can't figure out the problem.
>
> Is this a configuration problem?  I think I followed all the instructions.
> I don't entirely understand the log files or transcripts, which I have below.
> Is the java.lang.NoClassDefFoundError referring to a missing error handler,
> or was that the original error?
>
> Note that I put the JDK bin dirctory with "javac" in my PATH, but I do
> not have any CLASSPATH variable (because I am under the impression that
> the tomcat startup script takes care of all CLASSPATH issues.)
>
> Starting the JSP container:
>
>  Using classpath: ..\classes;..\lib\webserver.jar;..\lib\jasper.jar;..\lib\xml.jar;..\lib\servlet.jar;\lib\tools.jar
>  Starting tomcat. Check logs/tomcat.log for error messages
>  Unhandled error! You might want to consider having an error page to report such errors more gracefully
>  java.lang.NoClassDefFoundError: sun/tools/javac/Main
>          at org.apache.jasper.compiler.SunJavaCompiler.compile(SunJavaCompiler.java:128)
>          at org.apache.jasper.compiler.Compiler.compile(Compiler.java:231)
>          at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:412)
>          at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:147)
>          at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:159)
>          at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:259)
>          at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:367)
>          at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
>          at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:390)
>          at org.apache.tomcat.core.ContextManager.service(ContextManager.java:523)
>          at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
>                                                                 (Ajp12ConnectionHandler.java:147)
>          at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:334)
>          at java.lang.Thread.run(Thread.java:484)
>
> tomcat.log:
>  <l:addContext path="/examples"  docBase="webapps/examples" />
>  <l:addContext path=""  docBase="webapps/ROOT" />
>  <l:addContext path="/test"  docBase="webapps/test" />
>  <l:tomcat home="H:\Apache Group\jakarta-tomcat" classPath="..\classes;..\lib\webserver.jar;
>                  ..\lib\jasper.jar;..\lib\xml.jar;..\lib\servlet.jar;\lib\tools.jar" />
>  <l:addContext path="/admin"  docBase="webapps/admin" />
>  <l:startEndpoint port="8080" handler="org.apache.tomcat.service.http.HttpConnectionHandler" />
>  <l:startEndpoint port="8007" handler="org.apache.tomcat.service.connector.Ajp12ConnectionHandler" />
>
> jasper.log:
>  <JASPER_LOG> Mon Mar 13 18:01:31 EST 2000 Scratch dir for the JSP engine is: work\localhost_8080%2Fexamples</JASPER_LOG>
>  <JASPER_LOG> Mon Mar 13 18:01:31 EST 2000 IMPORTANT: Do not modify the generated servlets</JASPER_LOG>
>  <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000 JspEngine --> /jsp/colors/colrs.jsp</JASPER_LOG>
>  <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000           ServletPath: /jsp/colors/colrs.jsp</JASPER_LOG>
>  <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000              PathInfo: /colors/colrs.jsp</JASPER_LOG>
>  <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000              RealPath: H:\Apache Group\jakarta-tomcat\webapps\examples\jsp\colors\colrs.jsp</JASPER_LOG>
>  <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000            RequestURI: /examples/jsp/colors/colrs.jsp?color1=red&color2=green&action=Submit</JASPER_LOG>
>  <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000           QueryString: color1=red&color2=green&action=Submit</JASPER_LOG>
>  <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000        Request Params: </JASPER_LOG>
>  <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000               color2 = green</JASPER_LOG>
>  <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000               color1 = red</JASPER_LOG>
>  <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000               action = Submit</JASPER_LOG>
>  <JASPER_LOG> Mon Mar 13 18:02:04 EST 2000 Classpath according to the Servlet Engine is: H:\Apache Group\jakarta-tomcat\webapps\examples\WEB-INF\classes</JASPER_LOG>
>
> Could someone please give me a clue as to what the problem might be?
>
> Thanks!
> Chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: need help: JSP examples don't work (config issue?)

Posted by Christopher Stacy <cs...@spacy.Boston.MA.US>.
>>>>> On Mon, 13 Mar 2000 20:23:43 -0800, Hans Bergsten ("Hans") writes:
 Hans> See the FAQ,
 Hans> <http://jakarta.apache.org/jyve-faq/Turbine/screen/DisplayQuestionAnswer/action/SetAll/project_id/2/faq_id/12/topic_id/43/question_id/414>

Actually, I am the author of that FAQ, after having figured out the problem myself.

(Thanks, though!)


Re: need help: JSP examples don't work (config issue?)

Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Christopher Stacy wrote:
> 
> Hi,
> 
> The web pages do not seem to direct me to any kind of on-line
> reasource where I could find someone who might help me use Tomcat.
> I am having a problem which is most likely not a bug, but a misunderstanding
> of how to install the software.  I know that this is the developer mailing list
> and I aplogize if this is not a reasonable place to send this message, but after
> hours and hours of searching around, this is the best place I could come up with.
> 
> On NT4 SP6a, Apache 1.3.12, Tomcat 3.1M1, JAVA 2 JRE and JDK Standard Edition v1.3:
> 
> The Servlet examples (such as HelloWorldExample) work, but none of the JSP.
> The form is presented, but then the result page gets HTTP 500.
> This is my first experience with all this stuff, and I do not know how
> to proceed because I could not figure out what the error is.
> I have read the various README files and the FAQs,
> but still can't figure out the problem.
> 
> Is this a configuration problem?  I think I followed all the instructions.
> I don't entirely understand the log files or transcripts, which I have below.
> Is the java.lang.NoClassDefFoundError referring to a missing error handler,
> or was that the original error?
> 
> Note that I put the JDK bin dirctory with "javac" in my PATH, but I do
> not have any CLASSPATH variable (because I am under the impression that
> the tomcat startup script takes care of all CLASSPATH issues.)
> 
> Starting the JSP container:
> 
>  Using classpath: ..\classes;..\lib\webserver.jar;..\lib\jasper.jar;..\lib\xml.jar;..\lib\servlet.jar;\lib\tools.jar
>  Starting tomcat. Check logs/tomcat.log for error messages
>  Unhandled error! You might want to consider having an error page to report such errors more gracefully
>  java.lang.NoClassDefFoundError: sun/tools/javac/Main

See the FAQ,
<http://jakarta.apache.org/jyve-faq/Turbine/screen/DisplayQuestionAnswer/action/SetAll/project_id/2/faq_id/12/topic_id/43/question_id/414>

You need to set the JAVA_HOME environment variable to point to the JDK
installation.

Hans
-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com