• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to compile class for JSP

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
When i try to access the login page for my application I get the following error. Other jsps render well but not the login.jsp.

org.apache.jasper.JasperException: Unable to compile class for JSP

No Java compiler was found to compile the generated source for the JSP.
This can usually be solved by copying manually $JAVA_HOME/lib/tools.jar from the JDK
to the common/lib directory of the Tomcat server, followed by a Tomcat restart.
If using an alternate Java compiler, please check its installation and access path.

org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

Any information will be appreciated.


Regards
Pavan.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're running tomcat from the startup.sh or startup.bat file, this means that you either don't have a full JDK (you're running with only a JRE) or your JAVA_HOME environment variable isn't set properly.

The quickest way to test is to type (from the command line):
$JAVA_HOME/bin/javac
or if on windows:
%JAVA_HOME%\bin\javac

If you see "file or program not found", it's not set properly.

If you've installed it as a Windows service, the installer may have found the wrong JRE on your machine. This can be fixed by updating the Java entry in the Tomcat Config screen (if you've installed it). If you haven't installed the the start menu items, you can edit this yourself with regedit or just uninstall and re-install Tomcat. Be sure to verify that it found the right path to your JDK installation.

I've read that having the JAVA_HOME env variable properly set before installing as a Windows service can help prevent this but I don't know how much truth there is to it.
[ December 26, 2004: Message edited by: Ben Souther ]
 
Pavan Tummala
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ben,
My JAVA_HOME is pointing to the right directory. I start tomcat through Eclipse. Tomcat is not installed as a service in my machine.
I did a fresh tomcat install and it has no problems now.

Thanks
Pavan.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic