8 Replies Latest reply on Aug 28, 2004 1:34 PM by Radu Rendec

    org.apache.jasper.JasperException: Unable to compile class f

    amir_n Newbie

      hi

      I am a beginner in j2ee. I have installed the JBoss on my PC. I decided to test it. but when I try to connect to "http://localhost:8080/jmx-console/index.jsp" I get the following error messages.



      org.apache.jasper.JasperException: Unable to compile class for JSP

      An error occurred at line: -1 in the jsp file: null

      Generated servlet error:
      [javac] Compiling 1 source file



      at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
      at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
      at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:353)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
      at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.jboss.web.catalina.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:229)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:509)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
      at java.lang.Thread.run(Unknown Source)



      Is there anybody to help me ?

      thanks

        • 1. Re: org.apache.jasper.JasperException: Unable to compile cla
          Juha Lindfors Master

          Make sure you haven't installed neither JBoss or your JDK to a directory with spaces in the path name, if you're running on Windows.

          • 2. Re: org.apache.jasper.JasperException: Unable to compile cla
            johnybravo2002 Newbie

            I am new commer as well... how do i solve the problem


            I have typed the following in the browser and get

            http://localhost:8080/jmx-console/index.jsp

            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

            An error occurred at line: -1 in the jsp file: null

            Generated servlet error:
            [javac] Compiling 1 source file



            at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
            at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
            at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:353)
            at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
            at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
            at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
            at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
            at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
            at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
            at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
            at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
            at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
            at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
            at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
            at java.lang.Thread.run(Unknown Source)



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

            Apache Tomcat/4.1.29

            • 3. Re: org.apache.jasper.JasperException: Unable to compile cla
              pedalian Newbie

              I get the same error, but it is not due to spaces in the JAVA_HOME environment variable in my case (I've checked). I have been trying to run a simple "Hello World" WAR file on Linux (ver. 2.4.18, 1.4.2_03 JDK) using the Jboss-Tomcat 3.2.3 version for a week now, but it still does not work. Servlets run fine, but JSP's get this error. I have no problem running under standalone Tomcat minus Jboss. Also, the same WAR application runs fine when this package is installed under windows XP.

              Jboss starts with no problem, no errors in the boot.log or server.log, no classpath issues, but it will not compile the JSP for some reason. When I look under MainEngine/localhost/hw/ (hw is my Hello-World test app) I find the constructed .java file there, and it looks fine. This appears to be some kind of bug.

              Also, I am using mod_jk to send requests from Apache to Jboss/Tomcat as well (although this shouldn't be an issue). The Linux environment I'm using is on an ISP's private virtual server, so I'm beginning to think that may be causing some kind of problem. But, it appears to be a bug. Hopefully, someone can tell us what the problem is. In the meantime, I am starting to experiment with Orion.

              • 4. Re: org.apache.jasper.JasperException: Unable to compile cla
                Scott Stark Master

                This occurs when JAVA_HOME points to a JRE which does not have the required javac compiler. You need JAVA_HOME pointing to a JDK installation.

                • 5. Re: org.apache.jasper.JasperException: Unable to compile cla
                  pedalian Newbie

                  I have installed the JDK, and JAVA_HOME points directly at it. It is the same environment setting on the same machine that works fine when I run Tomcat by itself, and it has no problem finding the compiler. There is a JRE subdirectory under JAVA_HOME, but that is OK, right? Under JAVA_HOME I have these subdirectories: bin, demo, docs, include, jre, lib. The javac compiler is under the bin directory.

                  One thing I have noticed, on the boot.log listing, I see this line:
                  21:44:05,656 DEBUG [ServerInfo] java.home: /usr/java/j2sdk1.4.2_03/jre

                  This would imply that my JAVA_HOME is pointing to the jre subdirectory, but it isn't. It is pointing at /usr/java/j2sdk1.4.2_03. Also, when I run under Windows XP, the boot log shows the same entry, but everything works fine. So, I'm not sure what is wrong. That is why I think there is a bug.

                  FWIW, I am starting Jboss using the -server java flag (on the Linux machine). Any further ideas would be appreciated.

                  --Tim

                  • 6. Re: org.apache.jasper.JasperException: Unable to compile cla
                    Radu Rendec Newbie

                     

                    "pedalian" wrote:
                    I have installed the JDK, and JAVA_HOME points directly at it. It is the same environment setting on the same machine that works fine when I run Tomcat by itself, and it has no problem finding the compiler. There is a JRE subdirectory under JAVA_HOME, but that is OK, right? Under JAVA_HOME I have these subdirectories: bin, demo, docs, include, jre, lib. The javac compiler is under the bin directory.


                    I got the same errors with jboss-3.2.3 on linux, with JAVA_HOME set up properly. After a few hours of "headaches" I figured out there was no problem with the java compiler itself. Apparently, when the compilation starts, ant needs to create some temporary files. I don't know why, but it tries to create the temporary files one level upper than the jboss install directory.

                    For instance, I installed jboss in /opt/jboss-3.2.3 and ant wanted to create the temporary files in /opt. After I made /opt world-writeable, everything worked fine.

                    Hope this is helpful. Maybe someone knows how to set ant so that it creates temporary files under a certain directory.

                    • 7. Re: org.apache.jasper.JasperException: Unable to compile cla
                      Radu Rendec Newbie

                       

                      "rrendec" wrote:

                      Hope this is helpful. Maybe someone knows how to set ant so that it creates temporary files under a certain directory.


                      Well... I digged some more. The relevant lines from ant source code:

                      String userDirName = System.getProperty("user.dir");
                      File userDir = new File(userDirName);
                      tmpFile = fileUtils.createTempFile("files", "", userDir);

                      Looks like ant creates those temporary files in the current user's home directory, as reported by System.getProperty("user.dir"). Obviously, for my setup it reports "/opt" ;)

                      • 8. Re: org.apache.jasper.JasperException: Unable to compile cla
                        Radu Rendec Newbie

                         

                        "rrendec" wrote:
                        Looks like ant creates those temporary files in the current user's home directory, as reported by System.getProperty("user.dir"). Obviously, for my setup it reports "/opt" ;)


                        Oops... System.getProperty("user.dir") is the "current directory", not the "home directory". As for JBoss, it's the "current" directory at the time it's started (in other words, the current directory from which run.sh is invoked).

                        Sorry for the "spam" :)