File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes chapter 3: servlet to Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "chapter 3: servlet to "call" the JSP(version three)" Watch "chapter 3: servlet to "call" the JSP(version three)" New topic
Author

chapter 3: servlet to "call" the JSP(version three)

Balamurugan Sriganesh Iyer
Greenhorn

Joined: Aug 14, 2008
Posts: 1
Hi,
In Chapter-3(Head First Servlet&JSP),I was trying to deploy the version 3 of the servlet(which adds jsp view to the version 2).
And I got the following error.

Please help me out...!!!


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.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
controller.SelectBeerServlet.doPost(SelectBeerServlet.java:21)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:96)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:342)
org.apache.jasper.compiler.AntCompiler.generateClass(AntCompiler.java:251)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
controller.SelectBeerServlet.doPost(SelectBeerServlet.java:21)
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:105)
org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:924)
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757)
org.apache.jasper.compiler.AntCompiler.generateClass(AntCompiler.java:219)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
controller.SelectBeerServlet.doPost(SelectBeerServlet.java:21)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11432
    
  85

Originally posted by Balamurugan Sriganesh Iyer:
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

Just a rough guess, but perhaps the root cause is that the container cannot find a javac compiler?

The solution is simple: Make sure your JAVA_HOME is pointing to the directory that contains your JDK before you start your container.

Unfortunately with no information on what operating system you are running on, where you have installed Java, or what web container you are running it is very hard to make further helpful hints.

But for the sake of just providing some attempts at helping, if you were running Windows, and you had installed the JDK into c:\java and you were running Tomcat from within the c:\tomcat directory, then I would recommend you run:

Alternatively, if you were running on a Unix system, had installed Java into /opt/java/java_current and were running JBoss from within the /opt/jboss-4.2.3.GA directory, then I would recommend you run:

Hopefully you will be able to use these examples to work out what you need to do in your situation.

Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: chapter 3: servlet to "call" the JSP(version three)