File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HTTP 500 error when compiling JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HTTP 500 error when compiling JSP" Watch "HTTP 500 error when compiling JSP" New topic
Author

HTTP 500 error when compiling JSP

Tim Rawerts
Ranch Hand

Joined: Mar 08, 2005
Posts: 38
Working on HFSJSP, chapter 3, "Deploying and testing the web app". Everything has worked up to this point, and it fails when I hit the submit button so I assume the JSP is not compiling.

Running Windows 2000. Under mycomputer->properties->environment variables
I have set the following:

JAVA_HOME=D:\j2sdk1.4.1
CLASSPATH=D:\tomcat\common\lib\servlet-api.jar;D:\tomcat\common\lib\jsp-api.jar

I pasted the error below. I have seen this a lot on the web, but I am just missing the boat on this one.

Thanks in advance.

Tim Rawerts




type Exception report

message

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

exception

org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:346)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:414)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.example.web.BeerSelect.doPost(BeerSelect.java:43)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:106)
org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:935)
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.example.web.BeerSelect.doPost(BeerSelect.java:43)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.

Kerry Wilson
Ranch Hand

Joined: Oct 29, 2003
Posts: 254
You need set the CLASSPATH variable so that tomcat can run the javac command.


http://www.goodercode.com
SCJP 1.4
Tim Rawerts
Ranch Hand

Joined: Mar 08, 2005
Posts: 38
CLASSPATH is now D:\tomcat\common\lib\servlet-api.jar;D:\tomcat\common\lib\jsp-api.jar;D:\j2sdk1.4.1\bin

and I still have the same problem. Thanks anyway. Back out to the net and search.

Tim Rawerts

Aruneesh Salhotra
Ranch Hand

Joined: May 12, 2004
Posts: 167
Use the following jar in your classpath.
C:\Program Files\Java\jdk1.5.0_03\lib\tools.jar

That contains the class that is used for java->class conversion.
Tim Rawerts
Ranch Hand

Joined: Mar 08, 2005
Posts: 38
I am confused.

Here is the path I found on my system.

C:\Program Files\Java\j2re1.4.1 and tools.jar is not in there anywhere.

I did find tools.jar under D:\j2sdk1.4.1\lib. I will try and add this to my CLASSPATH and see what happens.

I have been searching the net and there are a lot of folks with this problem.

Thanks,
Tim Rawerts
Tim Rawerts
Ranch Hand

Joined: Mar 08, 2005
Posts: 38
It did not seem to work. CLASSPATH is now D:\tomcat\common\lib\servlet-api.jar;D:\tomcat\common\lib\jsp-api.jar;D:\j2sdk1.4.1\bin;D:\j2sdk1.4.1\lib\tools.jar


Back out to the web, but I am willing to try anything at this point.

Tim Rawerts
Tim Rawerts
Ranch Hand

Joined: Mar 08, 2005
Posts: 38
I tried a bunch of things that I found on the web, and here is what fixed the problem.

I copied tools.jar to D:\tomcat\common\lib and things started working.

Is this a bad work around?

Thanks to all for your help.

Tim Rawerts
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: HTTP 500 error when compiling JSP
 
Similar Threads
Jasper Exception
Please help me solving this error
Beginner to JSP problem
JSP Beginner Question
JasperException Error