Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

MVC question  RSS feed

 
Rajesh Vijaya
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I'm trying to execute the MVC program from Head First Servlets &JSP book ....and i'm getting the following error anyone have a clue....




my JAVA_HOME=c:\j2sdk1.4.2_09
PATH=c:\j2sdk1.4.2_09\bin
classpath=c:\j2sdk1.4.2_09\lib\rt.jar

HTTP Status 500 -

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.BeerSelect3.doPost(BeerSelect3.java:33)
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.BeerSelect3.doPost(BeerSelect3.java:33)
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.
Apache Tomcat/5.0.28


Any help in this regard is greatly appreciated

Thanks

Rajesh
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like your running Tomcat with only a JRE.
A full JDK (J2SE) is required for Tomcat 5.0.

If you've installed one, it's possible that Tomcat is not seeing it but instead running from a JRE on your machine.

How did you install Tomcat?
From the zip file or did you run the Tomcat.exe installer?
 
Rajesh Vijaya
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ben ,

I do have the full version installed on my system.I do not remember exactly how i installed Tomcat 5.0.28 .I have few servlets running on it ...ITs only after i inculded a JSP i'm getting this error .

My Environment varaible settings are :

CLASSPATH c:\j2sdk1.4.2_09\jre\lib\rt.jar;.;C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar

JAVA_HOME c:\j2sdk1.4.2_09

PATH %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\j2sdk1.4.2_09\bin;C:\Program Files\QuickTime\QTSystem\

TOMCAT_HOME C:\Program Files\Apache Software Foundation\Tomcat 5.0

Hope u can find the solution

thanks

Rajesh
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ghanta Rajesh:
I do not remember exactly how i installed Tomcat 5.0.28


How do you start Tomcat; from the batch scripts, as a Windows service, or from the Start menu items?
 
Rajesh Vijaya
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ben ,

I think i installed the Tomcat using tomcat installer.And i start and stop the Tomcat using Start menu items ..ie.Monitor Tomcat option ...

thanks

Rajesh
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, that means you installed it with the *.exe installer.

The CLASSPATH and JAVA_HOME environment variables don't matter with this form of installation. Tomcat builds it's own classpath and the pointer to your Java directory is stored in the registry.

It sounds like the installer found a JRE instead of your JDK.
You can chnage this by going to Start -> Programs -> Apache Tomcat -> Configure Tomcat -> Java (tab).
Make sure the "Java Classpath" field includes the path to the tools.jar contained within your JDK.

Example..............
Java Classpath:
Files\Java\jdk1.5.0_02\lib\tools.jar;f:\davison\tomcat\bin\bootstrap.jar
 
Rajesh Vijaya
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ben ,

I figured out the problem.I using request.getAttribute for getting multiple parameters in my JSP ...i shud have used getAttributes instead ...thanks

Rajesh
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!