users@glassfish.java.net

Re: v2 B24 + JDK 1.6 Beta 2 - Jsp Compile Problem

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Fri, 03 Nov 2006 10:58:40 -0800

Hi David,

David Harrigan wrote On 11/03/06 07:48,:

>Hi,
>
>When I try to access a JSP using JDK 1.6 Beta 2, I get this error:
>
>[#|2006-11-02T13:43:52.668+0000|SEVERE|sun-appserver-pe9.1|javax.enterprise.system.container.web|_ThreadID=11;_ThreadName=TP-Processor3;_RequestID=614077c6-d345-493b-a036-b9fa945e0b08;|ApplicationDispatcher[]
>PWC1231: Servlet.service() for servlet jsp threw exception
>java.lang.NoSuchMethodError:
>javax.tools.ToolProvider.getSystemJavaCompiler()Ljavax/tools/JavaCompiler;
>at org.apache.jasper.compiler.Jsr199JavaCompiler.compile(Unknown Source)
>at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:313)
>at org.apache.jasper.compiler.Compiler.compile(Compiler.java:360)
>at
>org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:581)
>at
>org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:344)
>at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:464)
>at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:358)
>at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>...
>...
>...
>...
>
>
>I do not get the same problem if I run JDK 1.5.0_09
>
>
>Obviously, it's taking some advantage of the new javax tools javacompiler
>interface in JDK 1.6, and I can confirm that my instance of GF is running
>with JDK 1.6 beta 2. Anyone know anything about this problem?
>
>

Right, the JSP container checks for javax.tools.ToolProvider and uses
its presence as an indication of a JDK 1.6 runtime, which triggers
in-memory compilations of JSPs.

When I disassemle javax.tools.ToolProvider from 1.6.0-beta2, I get this:

  javap -public javax/tools/ToolProvider
  Compiled from "ToolProvider.java"
  public class javax.tools.ToolProvider extends java.lang.Object{
      public static javax.tools.JavaCompilerTool
getSystemJavaCompilerTool();
      public static java.lang.ClassLoader getSystemToolClassLoader();
  }

whereas when I disassemble the version of this class in the latest 1.6
release
candidate, I get:

  javap -public javax/tools/ToolProvider
  Compiled from "ToolProvider.java"
  public class javax.tools.ToolProvider extends java.lang.Object{
      public static javax.tools.JavaCompiler getSystemJavaCompiler();
      public static java.lang.ClassLoader getSystemToolClassLoader();
  }

As you can see, getSystemJavaCompilerTool() has been renamed to
getSystemJavaCompiler(), and javax.tools.JavaCompilerTool has been
changed to javax.tools.JavaCompiler.

Obviously, the version of
org.apache.jasper.compiler.Jsr199JavaCompiler that's bundled in
GlassFish v2 b24's appserv-rt.jar uses the newer symbols.

We'll have to change, recompile, and rebundle this class to make it
compatible
with 1.6.0-beta2 for the time being, until a newer JDK 1.6 beta has been
released. This should happen in time for b25, so stay tuned.

Thanks,

Jan



>-=david=-
>
>