Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Balamurugan Sriganesh Iyer
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 11866
194
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic