Solved

Tomcat Problem

Posted on 2004-10-21
3,444 Views
Last Modified: 2008-01-09
Hi Everbody,

I have installed Tomcat 5.0 with JDK 5.0 . I can view HTML pages but not JSP pages. When I point to a JSP page the page gives the following error

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:434)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:492)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:471)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:459)
      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:105)
      org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:929)
      org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:758)
      org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:402)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:492)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:471)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:459)
      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.29 logs.




I have set Java_Home variable from System->Enviromental Variables to JDK base directory. I also added bin directory to classpath so in every directory I can use Java related commands. But still c an not overcome the problem. What may be going wrong?

Thanks
0
Question by:MacroLand
    10 Comments
     
    LVL 8

    Expert Comment

    by:kiranhk
    you need to put the JDK home directory in the path variable (dont put the JRE) like
    path=C:\jdk1.5.0


    probably ur path is pointing to a JRE?? check this out and change it to ur JDK installation
    0
     
    LVL 4

    Author Comment

    by:MacroLand
    u mean the path in enviromental variables ?
    0
     
    LVL 4

    Author Comment

    by:MacroLand
    my path command is as PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\SI Technologies\ATI Control Panel;C:\Program File\Tools\WinNT;C:\Program Files\Microsoft Visual Sram Files\Microsoft Visual Studio\Common\Tools;C Studio\VC98\bin;C:\Program Files\Java\jdk1.5.0

    In Apache Tomcat Properties

    JVM Points to C:\Program Files\Java\jre1.5.0\bin\client\jvm.dll
    Java Classpath points to C:\Program Files\Java\jre1.5.0\lib\tools.jar;C:\Program Files\Apache Software Foundation\Tomcat 5.0\bin\bootstrap.jar

    everything seems fine for me so far, what is wrong? It gives the same error again
    0
     
    LVL 8

    Accepted Solution

    by:
    try putting
    JAVA_HOME=C:\Progra~1\Java\jdk1.5.0 in your startup.bat file
    0
     
    LVL 4

    Author Comment

    by:MacroLand
    I have set them all and copied tools.jar from JDK to common\libs


    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:434)
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:492)
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:471)
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:459)
          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

    Compile failed; see the compiler error output for details.
          org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:938)
          org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:758)
          org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:402)
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:492)
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:471)
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:459)
          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)

    the interesting thing is when I start the server with startup.bat and run a JSP file it gives the error  target release 1.3 conflicts with default source release 1.5

    does that mean I should install JDK1.3 instead of 1.5
    0
     
    LVL 8

    Expert Comment

    by:kiranhk
    no, i think tomcat 5.xx is requires JDK 1.5
    do you have 1.3 also installed, if yes, try uninstalling that and keep only the 1.5
    0
     
    LVL 4

    Author Comment

    by:MacroLand
    well I found the problem. The problem arouses with JDK1.5. I have uninstalled it and installed JDK1.3.1 and everything worked out. I dont understand this cause in the manual of Apache, it says server works with any version of J2SE.
    0
     

    Expert Comment

    by:nitinics
    I think the path should be pointed upto the bin directory so that it gets the javac compiler.
    ------------------------------------
    PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\SI Technologies\ATI Control Panel;C:\Program File\Tools\WinNT;C:\Program Files\Microsoft Visual Sram Files\Microsoft Visual Studio\Common\Tools;C Studio\VC98\bin;C:\Program Files\Java\jdk1.5.0
    ---------------------------------------
    PATH=C:\Program Files\Java\jdk1.5.0\bin

    Try this .. it should compile the jsp pages
    0
     

    Expert Comment

    by:mbenzi
    Actuallly I had the same problem.  

    I bet you are using Tomcat 5.0.29

    This message on the TomcatDev list describes the problem:
    http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg64080.html (follow the threads for more details)

    A much better solution than using JDK1.3.1 with Tomcat 5.0.29 would be to use JDK 1.5 with Tomcat 5.0.28.  

    This is a bug that will be fixed with the next version of  Tomcat,  whereas JDK1.5 is a huge improvement over JDK1.3.1
    0
     
    LVL 4

    Author Comment

    by:MacroLand
    You are right. I am using Tomcat 5.0.29
    I tried JDK1.5 but it did not work. So I switched to JDK 1.3 and everything was smooth

    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Suggested Solutions

    Title # Comments Views Activity
    html form inside div 3 80
    Exception creating bean of class 5 137
    servlet init param and contect param 3 42
    java operators 3 54
    Before you start a podcast of your own, you’ll need to get the right equipment. To help you get started off on the right foot, here’s a list of the four critical items you’ll need to start your own podcast.
    Skype is a P2P (Peer to Peer) instant messaging and VOIP (Voice over IP) service – as well as a whole lot more.
    Want to pick and choose which updates you receive? Feel free to check out this quick video on how to manage your email notifications.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    933 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now