Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

JSP files not running (Eclipse 3.4 + Tomcat 5.0)

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am new to jsp's. I created a new 'dynamic web project' and then created a jsp file under it. When I run it on the tomcat 5.0 server this is what happened
--------------------------

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)


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)


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


--------------------------------------------------------------------------------

Apache Tomcat/5.0.28






So, I googled a bit and came across some solutions that asked me to change the path of JAVA_HOME to the jdk etc etc. When I went to Windows->Preferences->Java->BuidPath->ClassPath variables ... there was no variable JAVA_HOME, so i added a new variable ans set the path. Still the error has persisted.

I asked a few of my friends and they said there was no need to install a plugin for jsp in eclipse. I am not able to figure out the error. Kindly help!!
 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What error are you getting after you added that variable?

I guess if your eclipse environment is supporting dynamic web project, jsp plugin should be already there. While launching your application, you will have to launch it as a server application and not standalone application. Are you doing this right?
 
namrata suri
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya even after I set the path of JAVA_HOME to jdk, I got the same error. So I removed that variable.

My next doubt was... the jsp file is getting located in the projectname/WebContent/Web-INF folder. But when I run the code, the location of the file does not feature the WebContent part in the url. So I copied the Web-INF folder out of the webcontent folder and pasted it on the path /projectname/web-inf. Even then the error persists.
 
manoj r patil
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can not move WEB-INF that way. Eclipse plugin has intelligence to put everything under WebContent under application root.

You better google on configuring eclipse dynamic web project and probably it will answer all your queries.
 
namrata suri
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya, I realize I cannot move the file like that so I have reverted back. Right now I have made no changes whatsoever to any settings in eclipse or Tomcat. As in setting paths or nething. The error screen I had mentioned in the earlier post mentioned 'not able to find javac compiler' set JAVA_HOME to jdk etc. I have done nothing regarding these. I simply executed my code which was located in /projectname/webcontent/webinf/Test.jsp and this is the error I got:


HTTP Status 404 - /jsp/WEB-INF/Test.jsp

--------------------------------------------------------------------------------

type Status report

message /jsp/WEB-INF/Test.jsp

description The requested resource (/jsp/WEB-INF/Test.jsp) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/5.0.28

Kindly help!!
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to check if tools.jar is set in classpath of Tomcat.

Not aware of Tomcat, but if you are using JBoss server then, open JBoss server from Workspace (from Server view)
Open Launch Configuration -> Select tab "Classpath" -> Expand User Entries -> Add External Jars -> Select path where tools.jar is located (preferably from <JDK installed directory>-> lib) -> Apply -> Restart server once.

This might give hint as to how to configure for Tomcat
 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A client can't access the contents of web-inf directly. If you keep your jsp under web-inf, you need to create an url map for that, or else keep your jsp outside web-inf, so in your case seems to be the jsp folder.
 
Onion rings are vegetable donuts. Taste this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic