5 Replies Latest reply on Nov 4, 2003 4:57 PM by jonlee

    jsp compiler bug?

    n_ton

      Hi,

      I'm getting a really strange intermittent problem. Every once in a while, one of my JSP page throws this error (full stack trace below):

      org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
      error: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
      1 error, 1 warning

      Sometimes a re-deploy works, sometimes it doesn't. Even a complete restart of JBoss doesn't always work.

      Anyone have any idea why this might be happening?

      I'm running JBoss 3.0.6 on RH7.3 with the default jetty installation within JBoss.

      Thanx in advance for your help.

      Norton


      Full stack trace:

      2003-10-27 14:37:10,347 ERROR [STDERR] sun.tools.java.CompilerError: checkMeet(), no abstract method
      2003-10-27 14:37:10,351 ERROR [STDERR] at sun.tools.java.MemberDefinition.checkMeet(MemberDefinition.java:660)
      2003-10-27 14:37:10,352 ERROR [STDERR] at sun.tools.java.ClassDefinition.collectOneClass(ClassDefinition.java:1354)
      2003-10-27 14:37:10,353 ERROR [STDERR] at sun.tools.java.ClassDefinition.collectInheritedMethods(ClassDefinition.java:1501)
      2003-10-27 14:37:10,353 ERROR [STDERR] at sun.tools.java.BinaryClass.basicCheck(BinaryClass.java:73)
      2003-10-27 14:37:10,354 ERROR [STDERR] at sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java:130)
      2003-10-27 14:37:10,354 ERROR [STDERR] at sun.tools.java.BinaryClass.initInnerClasses(BinaryClass.java:344)
      2003-10-27 14:37:10,355 ERROR [STDERR] at sun.tools.java.BinaryClass.loadNested(BinaryClass.java:221)
      2003-10-27 14:37:10,355 ERROR [STDERR] at sun.tools.java.BinaryClass.loadNested(BinaryClass.java:203)
      2003-10-27 14:37:10,356 ERROR [STDERR] at sun.tools.javac.BatchEnvironment.loadDefinition(BatchEnvironment.java:743)
      2003-10-27 14:37:10,356 ERROR [STDERR] at sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java:120)
      2003-10-27 14:37:10,357 ERROR [STDERR] at sun.tools.java.BinaryClass.initInnerClasses(BinaryClass.java:352)
      2003-10-27 14:37:10,357 ERROR [STDERR] at sun.tools.java.BinaryClass.loadNested(BinaryClass.java:221)
      2003-10-27 14:37:10,358 ERROR [STDERR] at sun.tools.java.BinaryClass.loadNested(BinaryClass.java:203)
      2003-10-27 14:37:10,358 ERROR [STDERR] at sun.tools.javac.BatchEnvironment.loadDefinition(BatchEnvironment.java:743)
      2003-10-27 14:37:10,359 ERROR [STDERR] at sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java:120)
      2003-10-27 14:37:10,359 ERROR [STDERR] at sun.tools.java.ClassDefinition.collectOneClass(ClassDefinition.java:1219)
      2003-10-27 14:37:10,360 ERROR [STDERR] at sun.tools.java.ClassDefinition.collectInheritedMethods(ClassDefinition.java:1484)
      2003-10-27 14:37:10,360 ERROR [STDERR] at sun.tools.java.BinaryClass.basicCheck(BinaryClass.java:73)
      2003-10-27 14:37:10,361 ERROR [STDERR] at sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java:130)
      2003-10-27 14:37:10,361 ERROR [STDERR] at sun.tools.java.BinaryClass.initInnerClasses(BinaryClass.java:344)
      2003-10-27 14:37:10,362 ERROR [STDERR] at sun.tools.java.BinaryClass.loadNested(BinaryClass.java:221)
      2003-10-27 14:37:10,362 ERROR [STDERR] at sun.tools.java.BinaryClass.loadNested(BinaryClass.java:203)
      2003-10-27 14:37:10,363 ERROR [STDERR] at sun.tools.javac.BatchEnvironment.loadDefinition(BatchEnvironment.java:743)
      2003-10-27 14:37:10,363 ERROR [STDERR] at sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java:120)
      2003-10-27 14:37:10,364 ERROR [STDERR] at sun.tools.java.BinaryClass.initInnerClasses(BinaryClass.java:352)
      2003-10-27 14:37:10,364 ERROR [STDERR] at sun.tools.java.BinaryClass.loadNested(BinaryClass.java:221)
      2003-10-27 14:37:10,365 ERROR [STDERR] at sun.tools.java.BinaryClass.loadNested(BinaryClass.java:203)
      2003-10-27 14:37:10,365 ERROR [STDERR] at sun.tools.javac.BatchEnvironment.loadDefinition(BatchEnvironment.java:743)
      2003-10-27 14:37:10,366 ERROR [STDERR] at sun.tools.java.Environment.loadDefinition(Environment.java:167)
      2003-10-27 14:37:10,366 ERROR [STDERR] at sun.tools.java.Environment.loadDefinition(Environment.java:167)
      2003-10-27 14:37:10,367 ERROR [STDERR] at sun.tools.java.Environment.loadDefinition(Environment.java:167)
      2003-10-27 14:37:10,367 ERROR [STDERR] at sun.tools.java.ClassDeclaration.getClassDefinitionNoCheck(ClassDeclaration.java:161)
      2003-10-27 14:37:10,368 ERROR [STDERR] at sun.tools.java.Imports.resolve(Imports.java:205)
      2003-10-27 14:37:10,368 ERROR [STDERR] at sun.tools.javac.SourceClass.basicCheck(SourceClass.java:1072)
      2003-10-27 14:37:10,369 ERROR [STDERR] at sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java:130)
      2003-10-27 14:37:10,369 ERROR [STDERR] at sun.tools.javac.Main.compile(Main.java:501)
      2003-10-27 14:37:10,370 ERROR [STDERR] at org.apache.jasper.compiler.SunJavaCompiler.compile(SunJavaCompiler.java:162)
      2003-10-27 14:37:10,370 ERROR [STDERR] at org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
      2003-10-27 14:37:10,371 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:548)
      2003-10-27 14:37:10,371 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176)
      2003-10-27 14:37:10,372 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:188)
      2003-10-27 14:37:10,372 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
      2003-10-27 14:37:10,373 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
      2003-10-27 14:37:10,373 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      2003-10-27 14:37:10,374 ERROR [STDERR] at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360)
      2003-10-27 14:37:10,374 ERROR [STDERR] at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:280)
      2003-10-27 14:37:10,375 ERROR [STDERR] at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:553)
      2003-10-27 14:37:10,375 ERROR [STDERR] at org.mortbay.http.HttpContext.handle(HttpContext.java:1717)
      2003-10-27 14:37:10,376 ERROR [STDERR] at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:549)
      2003-10-27 14:37:10,377 ERROR [STDERR] at org.mortbay.http.HttpContext.handle(HttpContext.java:1667)
      2003-10-27 14:37:10,377 ERROR [STDERR] at org.mortbay.http.HttpServer.service(HttpServer.java:862)
      2003-10-27 14:37:10,378 ERROR [STDERR] at org.jboss.jetty.Jetty.service(Jetty.java:497)
      2003-10-27 14:37:10,378 ERROR [STDERR] at org.mortbay.http.HttpConnection.service(HttpConnection.java:759)
      2003-10-27 14:37:10,379 ERROR [STDERR] at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:923)
      2003-10-27 14:37:10,379 ERROR [STDERR] at org.mortbay.http.HttpConnection.handle(HttpConnection.java:776)
      2003-10-27 14:37:10,380 ERROR [STDERR] at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:202)
      2003-10-27 14:37:10,380 ERROR [STDERR] at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
      2003-10-27 14:37:10,381 ERROR [STDERR] at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)
      2003-10-27 14:37:10,418 WARN [org.jboss.jbossweb] WARNING: Exception for /jspreports/manifestdates.jsp
      org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
      error: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
      1 error, 1 warning

      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:289)
      at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:548)
      at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176)
      at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:188)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:280)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:553)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1717)
      at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:549)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1667)
      at org.mortbay.http.HttpServer.service(HttpServer.java:862)
      at org.jboss.jetty.Jetty.service(Jetty.java:497)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:759)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:923)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:776)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:202)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
      at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)

        • 1. Re: jsp compiler bug?
          jonlee

          This looks like a compiler bug with your JDK - javac and the underlying compiler tools have a problem, perhaps memory or thread contention or some other resource related problem. Have you tried a different JDK and what JDK are you using? You could possibly configure Jasper without spawning/forking but this wouldn't be the recommended long-term fix.

          • 2. Re: jsp compiler bug?
            n_ton

            I haven't tried a different JDK, but this same code works on other machines with the same JDK.

            What strikes me as strange is that this isn't a consistent problem. It only happens on occassion and can occur or not occur with no code changes.

            Any other ideas? What does checkMeet() do?

            Thanx for your help and quick reply.

            Norton

            • 3. Re: jsp compiler bug?
              jonlee

              It is intended to check the compatibility between methods - in this case the intersection or meeting of two legally co-existing methods. It is part of MemberDefinition. I think Duke University still has a paste of old JDK 1.3 javac tools code otherwise you can check the Blackdown source probably. It is a run-time issue with the compiler.

              As I stated previously, probably some condition for the interface between the JVM, javac that has been spawned within the JVM and your OS has caused javac to break. And the javac designers have signalled that this is a fault that should not occur and should be reported to be rectified. What is happening is relatively complex. Jasper receives the request (Jasper is running inside the JVM), and it invokes javac via Ant to start compilation of the Java source after Jasper has translated the JSP to Java source. This javac compilation is done as a separate (forked) thread inside the same JVM as JBoss. As you might appreciate, this is quite a complex situation. Now it could be that the underlying OS thread implementation is not properly catered for by the JVM, or there could be some other hardware, IRQ, etc that is normal for the OS but that otherwise disturbs the running of the JVM. Note the JVM should be compliant with the underlying OS, not the other way around.

              So the JVM may have a dependency that shouldn't have been implemented - maybe there is a race condition. There are plenty of things to go wrong with quite a lot happening in concurrent threads. That will also explain your intermittent problem. You need an occurrence of a specific set of conditions for the problem to occur. It may not happen in other machines.

              Previous instances of this problem/error for JDK 1.2.2 and EAServer were noted a while back but this is the first occurrence I have seen for JBoss.

              Have you tried setting Jasper so it doesn't spawn the compiler as a separate process?
              e.g. In the Tomcat primary web.xml
              <init-param>
              <param-name>fork</param-name>
              <param-value>false</param-value>
              </init-param>

              Your only other option apart from changing the JDK is probably replacing the underlying OS that provides the JVM with its thread implementation.

              • 4. Re: jsp compiler bug?
                n_ton

                Thanx for that very informative answer.

                I tried to upgrade to Sun's JDK 1.4.2_02, but it didn't help.

                Since I'm using the default Jetty configuration, is there a no-fork setting for that? And where can I find it? I did some quick searching and didn't see where I could turn forking off.

                Also, I saw in a webdefault.xml file that I could define Jikes as a default JSP compiler. However, I got a compiler error when I tried to run the JSP:

                2003-11-04 13:50:12,075 WARN [org.jboss.jbossweb] WARNING: Exception for /
                org.apache.jasper.JasperException: Unable to compile class for JSP
                at org.apache.jasper.compiler.Compiler.compile(Compiler.java:289)
                at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:548)
                at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176)
                .
                .
                .

                I assumed it was because the classpath wasn't set correctly, but the Jikes compiler class was in the jasper jar in the jbossweb.sar directory. Would using the Jikes compiler be a good alternative, and if so, any idea why it wouldn't work?

                Thanx much for your help.

                Norton

                • 5. Re: jsp compiler bug?
                  jonlee

                  Both Jetty and Tomcat use Jasper to compile and run JSPs. Their JSP-handling servlets are the same - the following is my Jikes inclusion.

                  <servlet-name>jsp</servlet-name>
                  <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
                  <init-param>
                  <param-name>development</param-name>
                  <param-value>false</param-value>
                  </init-param>
                  <init-param>
                  <param-name>checkInterval</param-name>
                  <param-value>900</param-value>
                  </init-param>
                  <init-param>
                  <param-name>compiler</param-name>
                  <param-value>jikes</param-value>
                  </init-param>
                  <init-param>
                  <param-name>javaEncoding</param-name>
                  <param-value>iso-8859-1</param-value>
                  </init-param>
                  <load-on-startup>3</load-on-startup>


                  You need the javaEncoding param set for Jikes. Jikes must be in your PATH - normally put it in the same directory as your javac although some prefer it in /usr/bin. YMMV. Jikes is a faster compiler than javac which is the reason people use it. Not sure about your error as I haven't seen that when running Jikes.

                  The following shows the fork off setting.


                  <servlet-name>jsp</servlet-name>
                  <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
                  <init-param>
                  <param-name>development</param-name>
                  <param-value>false</param-value>
                  </init-param>
                  <init-param>
                  <param-name>fork</param-name>
                  <param-value>false</param-value>
                  </init-param>
                  <init-param>
                  <param-name>checkInterval</param-name>
                  <param-value>900</param-value>
                  </init-param>
                  <load-on-startup>3</load-on-startup>