• 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 find java compiler for compiling JSP

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,
Howdy all,

I have to work on JSPs using Tomcat 5.0. I have set the below environment variables
1. JAVA_HOME = C:\Program Files\Java\jdk1.6.0_10
2. CATALINA_HOME = C:\Program Files\Apache Software Foundation\Tomcat 5.0\binC:\Program Files\Apache Software
Foundation\Tomcat 5.0
3. PATH = C:\Program Files\Java\jdk1.6.0_10\bin

When I am accesing a JSP with the below code:

Error message is:

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)

Even though I have set the JAVA_HOME variable, the error reports about JAVA_HOME
Please let me know the reason.

Thanks in Advance,
Ram

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please be sure to ask Tomcat questions in the Tomcat forum. I have moved this post there for you.
 
JavaMonitor Support
Posts: 251
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Ram,

Just a shot in the dark: make sure JAVA_HOME is quoted properly, because the is a space in it. Use the silly 8.3 notation if you are not sure (.i.e. progra~1 instead of Program Files).

On a general note: installing Tomcat in places that have spaces in the names gives strange problems. I try to avoid such names.
 
Ranch Hand
Posts: 37
Oracle Tomcat Server Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is Tomcat installed as a Windows service?

Running Tomcat as a service, I've had trouble getting it to recognize my settings in configuration files before. I have never found an explanation for this behavior.

This is a terrible practice to get into, but what worked for me was changing settings directly in the windows registry.

1)Start->run->type in "regedit" and hit enter
2)Find the parameters for your tomcat instance (mine are under HKEY_LOCAL_MACHINE->SOFTWARE->Apache Software Foundation->Procrun 2.0->{Tomcat instance name}->Parameters)
3)Change the jvm setting to point to a valid jdk (mine is D:\Program Files\Java\jdk1.5.0_16\jre\bin\server\jvm.dll)

Hope this helps!
 
Ramaprasad Kolla
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kees,

It didnot work

Eli,
Same with your suggestion too..
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ramaprasad Kolla wrote:
2. CATALINA_HOME = C:\Program Files\Apache Software Foundation\Tomcat 5.0\binC:\Program Files\Apache Software Foundation\Tomcat 5.0


According to the above setting, Tomcat is residing at two places. That doesn't make sense.

C:\Program Files\Apache Software Foundation\Tomcat 5.0\bin should be in the PATH, because the bin directory (by convention) points to the executable files.
C:\Program Files\Apache Software Foundation\Tomcat 5.0 is the correct CATALINA_HOME

I don't know if its a typo or something else, but file paths should be separated by a semi-colon.

FWIW, I don't even have the CATALINA_HOME setting on my XP PRO SP3 PC.

I would definitely try out the Koster's advise regarding paths with spaces. Uninstall JDK and Tomcat from current locations. Re-install them into locations with no spaces like c:\jdk1.6.0_10 & c:\Tomcat-5.0

This link might have suggestions - http://wiki.apache.org/tomcat/FAQ/Miscellaneous#Q1
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kalyan Ram wrote:
FWIW, I don't even have the CATALINA_HOME setting on my XP PRO SP3 PC.


It is only required when you run Tomcat standalone (and thus not from within some external tool like an IDE or so).
 
Kalyan Ram
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bauke Scholtz wrote:

Kalyan Ram wrote:
FWIW, I don't even have the CATALINA_HOME setting on my XP PRO SP3 PC.


It is only required when you run Tomcat standalone (and thus not from within some external tool like an IDE or so).


Please elucidate.

I am using Tomcat with Notepad++ as my code editor.

I have a shortcut to tomcat5w.exe on my desktop for situations needing a server restart.

regards
/k
 
Ramaprasad Kolla
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi Kalyan,

That was a typo mistake. I have even tried installing the things in no-space named folders but still of no use.

Thanks,
Ramaprasad Kolla

 
Kalyan Ram
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ramaprasad Kolla wrote:
Hi Kalyan,

That was a typo mistake. I have even tried installing the things in no-space named folders but still of no use.

Thanks,
Ramaprasad Kolla


Couple of quick questions -
* what is the path to your JSP file?
For instance, if your JSP is put in TC_HOME\webapps\jsp-examples and accessed via http://localhost:8080/jsp-examples/your_jsp.jsp does it still fail?
* What did you use to install tomcat, the installer or the archive?
* try acidjnk's work around @ http://forums.sun.com/thread.jspa?threadID=494649
Does that too fail?
* did you find any clues in the logs @ TC_HOME\logs

regards
/k
 
Ramaprasad Kolla
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My jsp path is:

http://localhost:8080/MyWebApp/index.jsp
It is at the context root.

I have installed tomcat afresh in C Drive as C:\tomcat5.0 (non-spaced) and now I'm getting a new error as below:
exception

javax.servlet.ServletException: Wrapper cannot find servlet class org.apache.jsp.index_jsp or a class it depends on
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Thread.java:619)


root cause

java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Thread.java:619)

Now my environment variables are:
CATALINA_HOME=C:\Tomcat5.0
JAVA_HOME=C:\Progra~1\Java\jdk1.6.0_10 (As suggested by one of the ranchers)
CLASSPATH=C:\Tomcat5.0\common\lib\servlet-api.jar

Web Application:
Tomcat5.0
|__webapps
|__MyWebApp
|__index.jsp (trying to access this jsp)
|__WEB-INF
|__classes
|__web.xml
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic