This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Problem compiling JSPs on Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Problem compiling JSPs on Tomcat" Watch "Problem compiling JSPs on Tomcat" New topic
Author

Problem compiling JSPs on Tomcat

Anjusha Boddapati
Greenhorn

Joined: Oct 14, 2004
Posts: 6
I am having problem compiling JSP pages on Tomcat. The html and servlets work fine but I get error 500 when I try accessing JSPs. I am trying to access a simple jsp but get a long list of errors. I am using Tomcat 4.0.6.

Thanks
Anju


Anju<br />SCJP 1.4
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

what's the error ?
Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hi Anjusha

Welcome to Javaranch....hope you have a nice time Ranching..

Where did u place the JSPs in you Tomcat?
Anjusha Boddapati
Greenhorn

Joined: Oct 14, 2004
Posts: 6
The error i get is HTTP status 500- Internal server Error
--------------------------------------------------------------------------------

type Exception report

message Internal Server Error

description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: sun/tools/javac/Main
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:481)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:484)


root cause

java.lang.NoClassDefFoundError: sun/tools/javac/Main
at org.apache.jasper.compiler.SunJavaCompiler.compile(SunJavaCompiler.java:136)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:272)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:548)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:188)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:484)
Anjusha Boddapati
Greenhorn

Joined: Oct 14, 2004
Posts: 6
I am just testing the jsps and servlets. I placed a simple Hello.jsp in the ROOT folder in webapps. And I am accessing it as
http://localhost:8080/Hello.jsp
but the got the error above.

Thanks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
The first question for any JSP compilation problem: "Can you get the Tomcat initial page (index.jsp) to work?"
Next question: "can you get the example JSP pages to work?"
Bill
Anjusha Boddapati
Greenhorn

Joined: Oct 14, 2004
Posts: 6
The initial index.jsp page is not working. The example jsp pages are also not working. But the index.html page that we get after installation of Tomcat is working. Also servlets are working.
Thanks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
The initial index.jsp page is not working. The example jsp pages are also not working. But the index.html page that we get after installation of Tomcat is working. Also servlets are working.

This clearly shows that Tomcat can't find the javac compiler which comes in the tools.jar file of a typical SDK installation.
This might occur if you have JAVA_HOME pointing to a JRE installation directory instead of a SDK -or- if you don't have JAVA_HOME set and the startup script finds a JRE first. (JRE = Java Runtime Environment which does not include tools.jar)
1. Which version of the Java SDK do you have installed?
2. What is your JAVA_HOME environment variable setting?
3. Which operating system?
Bill
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Just as a note: William is right, when servlets work , but JSPs don't, it's usually a problem with JAVA_HOME and/or jre/jdk confusion.

However, (and I realize it's not a problem for this poster, but I'm putting this here for others)... this is no longer a reliable test for newer versions of Tomcat (5.x). With Tomcat 5, the example JSPs come pre-compiled. So you might think everything's fine, but... "all the examples work, how come mine won't?" It **still** might be a problem with finding a compiler.
Anjusha Boddapati
Greenhorn

Joined: Oct 14, 2004
Posts: 6
Thanks for all your input. I will look for the JAVA_HOME and reply. I was on vacation all weekend so couldnt reply.

Anju
Anjusha Boddapati
Greenhorn

Joined: Oct 14, 2004
Posts: 6
The JAVA_HOME variable is set to
C:\Documents and Settings\lakshimi.sripada\My Documents\5614\jdk1.3.1;

I am using jdk1.3.1 on windows 2000

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem compiling JSPs on Tomcat
 
Similar Threads
Problem running a Tomcat 4.1 project from Eclipse
JSP - Out of Memory exception
JSP / Servlet Question
How to debug JSP Compile Time Error
OutOfMemoryError