views:

2226

answers:

3

As this thread shows, there seems to be an issue getting JSPs to compile in GWT hosted mode with the new Jetty server:

2. ERROR in /tmp/Jetty_0_0_0_0_8080_war____ut4fm1/jsp/org/apache/jsp/ 
test_jsp.java (at line 53) 
        new java.util.ArrayList<String>(); 
                                ^^^^^^ 
Syntax error, parameterized types are only available if source level 
is 1.5

Does anyone have a workaround? It's possible that this commit might be related. I don't know what equivalent to org.eclipse.jdt.core.JDTCompilerAdapter should be used for building outside of Eclipse (e.g. on the command line). This is a real blocker for us adopting GWT 1.6, so any pointers are highly appreciated.

A: 

How are you compiling? What JDK version you using?

This error means some where compliance level is set below 1.5.

Bhushan
java version "1.6.0_07"Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153)Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode)This is in a project that has been using 1.5 for well over a year. Somehow the compiler that is being used in Jetty (which is new for us in GWT 1.6) is not being set to 1.5.
Caffeine Coma
+3  A: 

This problem is generated by the default values used by JspServlet, which compiles using 1.4 for source/target values.

  1. You can cofigure this servlet by adding

    <servlet>
        <servlet-name>jsp</servlet-name>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        <init-param>
            <param-name>compilerSourceVM</param-name>
            <param-value>1.5</param-value>
        </init-param>
        <init-param>
            <param-name>compilerTargetVM</param-name>
            <param-value>1.5</param-value>
        </init-param>
        <load-on-startup>3</load-on-startup>
    </servlet>
    
  2. There is one more issue as you can't configure JspServlet with the current jasper-compiler-5.0.28. You should download jasper-compiler-5.0.30 and make sure is in your classpath before gwt. There are other latest jasper compiler jars out-there but i'm not sore of how compatible are with jakarta-tomcat-5.0.28. I solved this problem by adding a dependency on jakarta-tomcat-5.0.30 in GWT 1.6.4. You can download the GWT compiled with this dependency from http://raisercostin.googlecode.com/files/gwt-windows-1.6.4.raisercostin.zip

I described the solution at http://code.google.com/p/raisercostin/wiki/GwtEclipsePluginDebug too.

raisercostin
A: 

I am having the same issue resulting in a failure to compile a JSP file. The JSP file is part of a GWT application.

My debugging environment is Eclipse-based, with Google Plugin for Eclipse installed. I created a GWT application using the functionality of the plugin and was hoping to get it running in the hosted mode of GWT 1.6.4 (which came bundled with the plugin).

As soon as the GET request for my JSP page is made the parameterized types error shows up. Since the page was newly created I made it 1.4 source-compliant by removing generics. I realized this might not do when an application with pre-existing JSPs is being ported to or augmented with GWT.

Another hack I managed to pull off is conversion of a GWT App project to a Dynamic Web Module project, thus getting the ability to publish to a Tomcat server withing Eclipse. This lifted the 1.4 JSP source compliance impediment.