GWT 2.8.2 and Jetty Embedded - com.google.gwt.dev.jjs.InternalCompilerException: Error constructing Java AST

1,027 views
Skip to first unread message

Chris

unread,
Feb 26, 2018, 12:25:56 PM2/26/18
to GWT Users
I've got a real simple scaled down GWT application (to illustrate the issue) with Jetty Embedded Server (9.4.7.v20170914), it can be downloaded here:
This works fine when running under 2.7.0.  

Unfortunately, when I upgrade to 2.8.2, I'm getting an error during the GWT compilation stage.   See below.

Any suggestions in how I can fix this?   It seems like there is a conflict between Jetty deps and GWT 2.8.2 deps and I probably need some kind of exclude,
but I'm not super familiar with maven enough to tell it how to exclude what it needs so this compiles.  The simple application be be downloaded from:

Really appreciate any help in this.
Thanks,
Chris

Here is the GWTC output:
--- gwt-maven-plugin:2.8.2:compile (default) @ my-app ---

[INFO] Compiling module com.mycompany.app.MyWebApp

[INFO] [ERROR] An internal compiler exception occurred

[INFO] com.google.gwt.dev.jjs.InternalCompilerException: Error constructing Java AST

[INFO] at com.google.gwt.dev.jjs.impl.GwtAstBuilder.translateException(GwtAstBuilder.java:3997)

[INFO] at com.google.gwt.dev.jjs.impl.GwtAstBuilder$AstVisitor.endVisit(GwtAstBuilder.java:1569)

[INFO] at org.eclipse.jdt.internal.compiler.ast.MessageSend.traverse(MessageSend.java:1021)

[INFO] at org.eclipse.jdt.internal.compiler.ast.Assignment.traverse(Assignment.java:260)

[INFO] at org.eclipse.jdt.internal.compiler.ast.Block.traverse(Block.java:136)

[INFO] at org.eclipse.jdt.internal.compiler.ast.IfStatement.traverse(IfStatement.java:281)

[INFO] at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:347)

[INFO] at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1379)

[INFO] at com.google.gwt.dev.jjs.impl.GwtAstBuilder.processImpl(GwtAstBuilder.java:3933)

[INFO] at com.google.gwt.dev.jjs.impl.GwtAstBuilder.process(GwtAstBuilder.java:3971)


Here is what my dependency tree looks like this:

 mvn dependency:tree -Dverbose=true

[INFO] Scanning for projects...

[WARNING

[WARNING] Some problems were encountered while building the effective model for com.mycompany.app:my-app:jar:1.0-SNAPSHOT

[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-resources-plugin is missing. @ line 173, column 21

[WARNING

[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.

[WARNING

[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.

[WARNING

[INFO

[INFO] ------------------------------------------------------------------------

[INFO] Building Maven Archetype for GWT 1.0-SNAPSHOT

[INFO] ------------------------------------------------------------------------

[INFO

[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ my-app ---

[INFO] com.mycompany.app:my-app:jar:1.0-SNAPSHOT

[INFO] +- junit:junit:jar:4.11:test

[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test

[INFO] +- org.eclipse.jetty:jetty-server:jar:9.4.7.v20170914:compile

[INFO] |  +- javax.servlet:javax.servlet-api:jar:3.1.0:compile

[INFO] |  +- org.eclipse.jetty:jetty-http:jar:9.2.14.v20151106:compile (version managed from 9.4.7.v20170914)

[INFO] |  |  \- (org.eclipse.jetty:jetty-util:jar:9.2.14.v20151106:compile - omitted for conflict with 9.4.7.v20170914)

[INFO] |  \- org.eclipse.jetty:jetty-io:jar:9.2.14.v20151106:compile (version managed from 9.4.7.v20170914)

[INFO] |     \- (org.eclipse.jetty:jetty-util:jar:9.2.14.v20151106:compile - omitted for duplicate)

[INFO] +- org.eclipse.jetty:jetty-annotations:jar:9.4.7.v20170914:compile

[INFO] |  +- org.eclipse.jetty:jetty-plus:jar:9.2.14.v20151106:compile (version managed from 9.4.7.v20170914)

[INFO] |  |  +- (org.eclipse.jetty:jetty-webapp:jar:9.2.14.v20151106:compile - version managed from 9.4.7.v20170914; omitted for duplicate)

[INFO] |  |  \- org.eclipse.jetty:jetty-jndi:jar:9.2.14.v20151106:compile

[INFO] |  |     \- (org.eclipse.jetty:jetty-util:jar:9.2.14.v20151106:compile - omitted for duplicate)

[INFO] |  +- (org.eclipse.jetty:jetty-webapp:jar:9.2.14.v20151106:compile - version managed from 9.4.7.v20170914; omitted for conflict with 9.4.7.v20170914)

[INFO] |  +- javax.annotation:javax.annotation-api:jar:1.2:compile

[INFO] |  +- org.ow2.asm:asm:jar:5.0.3:compile (version managed from 5.1)

[INFO] |  \- org.ow2.asm:asm-commons:jar:5.0.3:compile (version managed from 5.1)

[INFO] |     \- org.ow2.asm:asm-tree:jar:5.0.3:compile

[INFO] |        \- (org.ow2.asm:asm:jar:5.0.3:compile - version managed from 5.1; omitted for duplicate)

[INFO] +- org.eclipse.jetty:jetty-webapp:jar:9.4.7.v20170914:compile

[INFO] |  +- org.eclipse.jetty:jetty-xml:jar:9.2.14.v20151106:compile (version managed from 9.4.7.v20170914)

[INFO] |  |  \- (org.eclipse.jetty:jetty-util:jar:9.2.14.v20151106:compile - omitted for duplicate)

[INFO] |  \- (org.eclipse.jetty:jetty-servlet:jar:9.2.14.v20151106:compile - version managed from 9.4.7.v20170914; omitted for conflict with 9.4.7.v20170914)

[INFO] +- org.eclipse.jetty:jetty-servlet:jar:9.4.7.v20170914:compile

[INFO] |  \- org.eclipse.jetty:jetty-security:jar:9.2.14.v20151106:compile (version managed from 9.4.7.v20170914)

[INFO] |     \- (org.eclipse.jetty:jetty-server:jar:9.2.14.v20151106:compile - omitted for conflict with 9.4.7.v20170914)

[INFO] +- org.eclipse.jetty:jetty-util:jar:9.4.7.v20170914:compile

[INFO] +- org.eclipse.jetty:jetty-servlets:jar:9.4.7.v20170914:compile

[INFO] |  +- org.eclipse.jetty:jetty-continuation:jar:9.2.14.v20151106:compile (version managed from 9.4.7.v20170914)

[INFO] |  +- (org.eclipse.jetty:jetty-http:jar:9.2.14.v20151106:compile - version managed from 9.4.7.v20170914; omitted for duplicate)

[INFO] |  +- (org.eclipse.jetty:jetty-util:jar:9.2.14.v20151106:compile - version managed from 9.4.7.v20170914; omitted for conflict with 9.4.7.v20170914)

[INFO] |  \- (org.eclipse.jetty:jetty-io:jar:9.2.14.v20151106:compile - version managed from 9.4.7.v20170914; omitted for duplicate)

[INFO] +- org.eclipse.jetty:apache-jsp:jar:9.4.7.v20170914:compile

[INFO] |  +- (org.eclipse.jetty:jetty-util:jar:9.2.14.v20151106:compile - version managed from 9.4.7.v20170914; omitted for conflict with 9.4.7.v20170914)

[INFO] |  +- org.eclipse.jetty.toolchain:jetty-schemas:jar:3.1:compile

[INFO] |  +- (javax.servlet:javax.servlet-api:jar:3.1.0:compile - omitted for duplicate)

[INFO] |  +- org.mortbay.jasper:apache-jsp:jar:8.5.9.1:compile

[INFO] |  |  +- (org.eclipse.jetty.toolchain:jetty-schemas:jar:3.1:compile - omitted for duplicate)

[INFO] |  |  \- org.mortbay.jasper:apache-el:jar:8.5.9.1:compile

[INFO] |  +- org.eclipse.jdt.core.compiler:ecj:jar:4.4.2:compile

[INFO] |  \- (org.eclipse.jetty:jetty-annotations:jar:9.2.14.v20151106:compile - version managed from 9.4.7.v20170914; omitted for conflict with 9.4.7.v20170914)

[INFO] +- org.eclipse.jetty:apache-jstl:pom:9.4.7.v20170914:compile

[INFO] |  +- org.apache.taglibs:taglibs-standard-spec:jar:1.2.5:compile

[INFO] |  \- org.apache.taglibs:taglibs-standard-impl:jar:1.2.5:compile

[INFO] +- com.google.gwt:gwt-servlet:jar:2.8.2:runtime

[INFO] +- com.google.gwt:gwt-user:jar:2.8.2:provided

[INFO] |  +- com.google.jsinterop:jsinterop-annotations:jar:1.0.2:provided

[INFO] |  +- com.google.jsinterop:jsinterop-annotations:jar:sources:1.0.2:provided

[INFO] |  +- javax.validation:validation-api:jar:1.0.0.GA:provided

[INFO] |  +- javax.validation:validation-api:jar:sources:1.0.0.GA:provided

[INFO] |  +- (javax.servlet:javax.servlet-api:jar:3.1.0:provided - omitted for duplicate)

[INFO] |  \- org.w3c.css:sac:jar:1.3:provided

[INFO] \- com.google.gwt:gwt-dev:jar:2.8.2:provided

[INFO]    +- com.google.code.findbugs:jsr305:jar:1.3.9:provided

[INFO]    +- com.google.code.gson:gson:jar:2.6.2:provided

[INFO]    +- (org.ow2.asm:asm:jar:5.0.3:provided - version managed from 5.1; omitted for duplicate)

[INFO]    +- org.ow2.asm:asm-util:jar:5.0.3:provided

[INFO]    |  \- (org.ow2.asm:asm-tree:jar:5.0.3:provided - omitted for duplicate)

[INFO]    +- (org.ow2.asm:asm-commons:jar:5.0.3:provided - version managed from 5.1; omitted for duplicate)

[INFO]    +- colt:colt:jar:1.2.0:provided

[INFO]    +- ant:ant:jar:1.6.5:provided

[INFO]    +- commons-collections:commons-collections:jar:3.2.2:provided

[INFO]    +- commons-io:commons-io:jar:2.4:provided

[INFO]    +- com.ibm.icu:icu4j:jar:50.1.1:provided

[INFO]    +- tapestry:tapestry:jar:4.0.2:provided

[INFO]    +- net.sourceforge.htmlunit:htmlunit:jar:2.19:provided

[INFO]    |  +- xalan:xalan:jar:2.7.2:provided

[INFO]    |  |  \- xalan:serializer:jar:2.7.2:provided

[INFO]    |  |     \- (xml-apis:xml-apis:jar:1.3.04:provided - omitted for conflict with 1.4.01)

[INFO]    |  +- (commons-collections:commons-collections:jar:3.2.2:provided - version managed from 3.2.1; omitted for duplicate)

[INFO]    |  +- org.apache.commons:commons-lang3:jar:3.4:provided

[INFO]    |  +- org.apache.httpcomponents:httpclient:jar:4.5.1:provided

[INFO]    |  |  +- org.apache.httpcomponents:httpcore:jar:4.4.3:provided

[INFO]    |  |  +- (commons-logging:commons-logging:jar:1.2:provided - omitted for duplicate)

[INFO]    |  |  \- (commons-codec:commons-codec:jar:1.9:provided - omitted for conflict with 1.10)

[INFO]    |  +- org.apache.httpcomponents:httpmime:jar:4.5.1:provided

[INFO]    |  |  \- (org.apache.httpcomponents:httpclient:jar:4.5.1:provided - omitted for duplicate)

[INFO]    |  +- commons-codec:commons-codec:jar:1.10:provided

[INFO]    |  +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.17:provided

[INFO]    |  +- xerces:xercesImpl:jar:2.11.0:provided

[INFO]    |  |  \- xml-apis:xml-apis:jar:1.4.01:provided

[INFO]    |  +- net.sourceforge.nekohtml:nekohtml:jar:1.9.22:provided

[INFO]    |  +- net.sourceforge.cssparser:cssparser:jar:0.9.18:provided

[INFO]    |  |  \- (org.w3c.css:sac:jar:1.3:provided - omitted for duplicate)

[INFO]    |  +- (commons-io:commons-io:jar:2.4:provided - omitted for duplicate)

[INFO]    |  +- commons-logging:commons-logging:jar:1.2:provided

[INFO]    |  \- org.eclipse.jetty.websocket:websocket-client:jar:9.2.13.v20150730:provided

[INFO]    |     +- (org.eclipse.jetty:jetty-util:jar:9.2.14.v20151106:provided - version managed from 9.2.13.v20150730; omitted for conflict with 9.4.7.v20170914)

[INFO]    |     +- (org.eclipse.jetty:jetty-io:jar:9.2.14.v20151106:provided - version managed from 9.2.13.v20150730; omitted for duplicate)

[INFO]    |     \- org.eclipse.jetty.websocket:websocket-common:jar:9.2.14.v20151106:provided (version managed from 9.2.13.v20150730)

[INFO]    |        +- org.eclipse.jetty.websocket:websocket-api:jar:9.2.14.v20151106:provided

[INFO]    |        +- (org.eclipse.jetty:jetty-util:jar:9.2.14.v20151106:provided - version managed from 9.2.13.v20150730; omitted for conflict with 9.4.7.v20170914)

[INFO]    |        \- (org.eclipse.jetty:jetty-io:jar:9.2.14.v20151106:provided - version managed from 9.2.13.v20150730; omitted for duplicate)

[INFO]    +- (org.eclipse.jetty:jetty-webapp:jar:9.2.14.v20151106:provided - version managed from 9.4.7.v20170914; omitted for conflict with 9.4.7.v20170914)

[INFO]    +- (org.eclipse.jetty:jetty-servlets:jar:9.2.14.v20151106:provided - omitted for conflict with 9.4.7.v20170914)

[INFO]    +- (org.eclipse.jetty:jetty-annotations:jar:9.2.14.v20151106:provided - version managed from 9.4.7.v20170914; omitted for conflict with 9.4.7.v20170914)

[INFO]    \- (org.eclipse.jetty:apache-jsp:jar:9.2.14.v20151106:provided - omitted for conflict with 9.4.7.v20170914)


Here is the POM file:


<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven Archetype for GWT</name>

<properties>
<!-- Convenience property to set the GWT version -->
<gwt.version>2.8.2</gwt.version>

<!-- GWT 2.8 requires 1.8 -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

<version.jetty>9.4.7.v20170914</version.jetty>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt</artifactId>
<version>${gwt.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>

<!--Jetty-->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${version.jetty}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId>
<version>${version.jetty}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${version.jetty}</version>
</dependency>

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${version.jetty}</version>
</dependency>

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${version.jetty}</version>
</dependency>

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${version.jetty}</version>
</dependency>

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jsp</artifactId>
<version>${version.jetty}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jstl</artifactId>
<version>${version.jetty}</version>
<type>pom</type>
</dependency>

<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<scope>provided</scope>
</dependency>


</dependencies>

<build>
<finalName>MyWebApp</finalName>

<!-- Output classes directly into the webapp, so that IDEs and "mvn process-classes" update them in DevMode -->
<!--<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>-->
<outputDirectory>target/MyWebApp</outputDirectory>


<plugins>

<!-- Mojo's Maven Plugin for GWT -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt.version}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
<goal>generateAsync</goal>
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see
gwt-maven-plugin documentation at codehaus.org -->
<configuration>
<runTarget>MyWebApp.html</runTarget>
<modules>
<module>com.mycompany.app.MyWebApp</module>
</modules>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>com.mycompany.app.JettyServer</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>

<execution>
<id>web_files</id>
<phase>compile</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>target/MyWebApp</outputDirectory>
<resources>
<resource>
<directory>src/main/webapp</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>

</project>

Thomas Broyer

unread,
Feb 26, 2018, 2:03:29 PM2/26/18
to GWT Users
apache-jsp brings Eclipse JDT, which causes the conflict.

As you're using Mojo's plugin for GWT,you can configure it to put GWT dependencies first in the classpath; that should fix the conflict.

But you really should split this project into two or three modules, with separate dependency trees for client and server code. That would automatically clean all such conflicts.

Chris

unread,
Feb 26, 2018, 2:53:57 PM2/26/18
to GWT Users
Thanks Thomas, can you point me to any examples of GWT projects split into multiple maven modules?
I'll head that route.

Thanks again.
Chris

Thomas Broyer

unread,
Feb 27, 2018, 7:18:12 AM2/27/18
to GWT Users
See https://github.com/tbroyer/gwt-maven-archetypes
You'll have to update things a bit of course as these generate WARs that you run in development with the jetty-maven-plugin; for instance, using an embedded server would require a dependency:unpack{,-dependencies} and/or using the maven-assembly-plugin instead of using a war overlay.

Chris

unread,
Feb 27, 2018, 9:07:07 AM2/27/18
to GWT Users
Thank you Thomas.   This is super helpful.
Chris
Reply all
Reply to author
Forward
0 new messages