Can't compile GWT app using 2.8.0-SNAPSHOT and Java 8 with gwt-maven-plugin

1

I am struggling to get my app to compile using GWT 2.8.0-SNAPSHOT and Mojo's gwt-maven-plugin 2.8.0-SNAPSHOT

I receive the same compiler errors each time:

[INFO] --- gwt-maven-plugin:2.8.0-SNAPSHOT:compile (default) @ UsavAppV7 ---
[ERROR] Jul 20, 2016 9:34:23 AM java.util.prefs.WindowsPreferences <init>
[ERROR] WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
[INFO] Compiling module com.utilitiessavings.usavappv7.Project
[INFO]    [ERROR] An internal compiler exception occurred
[INFO] com.google.gwt.dev.jjs.InternalCompilerException: Unexpected error during visit.
[INFO]  at com.google.gwt.dev.jjs.ast.JVisitor.translateException(JVisitor.java:111)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:276)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
[INFO]  at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:118)
[INFO]  at com.google.gwt.dev.jjs.ast.JDeclarationStatement.traverse(JDeclarationStatement.java:49)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor$ListContext.traverse(JModVisitor.java:88)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemove(JModVisitor.java:331)
[INFO]  at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:92)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
[INFO]  at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:139)
[INFO]  at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:135)
[INFO]  at com.google.gwt.dev.jjs.ast.JMethodBody.traverse(JMethodBody.java:83)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
[INFO]  at com.google.gwt.dev.jjs.ast.JMethod.visitChildren(JMethod.java:785)
[INFO]  at com.google.gwt.dev.jjs.ast.JMethod.traverse(JMethod.java:777)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
[INFO]  at com.google.gwt.dev.jjs.impl.UnifyAst.mainLoop(UnifyAst.java:1379)
[INFO]  at com.google.gwt.dev.jjs.impl.UnifyAst.exec(UnifyAst.java:875)
[INFO]  at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.unifyJavaAst(JavaToJavaScriptCompiler.java:1410)
[INFO]  at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.constructJavaAst(JavaToJavaScriptCompiler.java:1222)
[INFO]  at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:1140)
[INFO]  at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:255)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:255)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:202)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:143)
[INFO]  at com.google.gwt.dev.Compiler.compile(Compiler.java:204)
[INFO]  at com.google.gwt.dev.Compiler.compile(Compiler.java:155)
[INFO]  at com.google.gwt.dev.Compiler.compile(Compiler.java:144)
[INFO]  at com.google.gwt.dev.Compiler$1.run(Compiler.java:118)
[INFO]  at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:55)
[INFO]  at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:50)
[INFO]  at com.google.gwt.dev.Compiler.main(Compiler.java:125)
[INFO] Caused by: java.lang.AbstractMethodError: org.apache.xerces.dom.ElementNSImpl.setUserData(Ljava/lang/String;Ljava/lang/Object;Lorg/w3c/dom/UserDataHandler;)Ljava/lang/Object;
[INFO]  at com.google.gwt.uibinder.rebind.W3cDocumentBuilder.startElement(W3cDocumentBuilder.java:127)
[INFO]  at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
[INFO]  at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
[INFO]  at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
[INFO]  at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
[INFO]  at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
[INFO]  at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
[INFO]  at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
[INFO]  at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
[INFO]  at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
[INFO]  at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
[INFO]  at javax.xml.parsers.SAXParser.parse(SAXParser.java:392)
[INFO]  at com.google.gwt.uibinder.rebind.W3cDomHelper.documentFor(W3cDomHelper.java:74)
[INFO]  at com.google.gwt.uibinder.rebind.UiBinderGenerator.getW3cDoc(UiBinderGenerator.java:208)
[INFO]  at com.google.gwt.uibinder.rebind.UiBinderGenerator.generateOnce(UiBinderGenerator.java:183)
[INFO]  at com.google.gwt.uibinder.rebind.UiBinderGenerator.generate(UiBinderGenerator.java:128)
[INFO]  at com.google.gwt.core.ext.IncrementalGenerator.generateNonIncrementally(IncrementalGenerator.java:40)
[INFO]  at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:745)
[INFO]  at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:103)
[INFO]  at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:78)
[INFO]  at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:262)
[INFO]  at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:251)
[INFO]  at com.google.gwt.dev.PrecompilationContextCreator$1.getAllPossibleRebindAnswers(PrecompilationContextCreator.java:86)
[INFO]  at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createStaticRebindExpression(UnifyAst.java:493)
[INFO]  at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createRebindExpression(UnifyAst.java:463)
[INFO]  at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.handleMagicMethodCall(UnifyAst.java:588)
[INFO]  at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.endVisit(UnifyAst.java:293)
[INFO]  at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:268)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
[INFO]  ... 35 more
[INFO]       [ERROR] at com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java(132): GWT.create(ApplicationView$Binder.class)
[INFO]          com.google.gwt.dev.jjs.ast.JMethodCall
[INFO]       [ERROR] at com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java(132): Object created = GWT.create(ApplicationView$Binder.class)
[INFO]          com.google.gwt.dev.jjs.ast.JDeclarationStatement
[INFO]       [ERROR] at com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java(131): {
[INFO]   Object created = GWT.create(ApplicationView$Binder.class);
[INFO]   assert created instanceof ApplicationView$Binder;
[INFO]   ApplicationView$Binder result = (ApplicationView$Binder) created;
[INFO]   this.memberInject_Key$type$com$utilitiessavings$usavappv7$client$application$ApplicationView$Binder$_annotation$$none$$(result);
[INFO]   return result;
[INFO] }
[INFO]          com.google.gwt.dev.jjs.ast.JBlock
[INFO]       [ERROR] at com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java(131): {
[INFO]   Object created = GWT.create(ApplicationView$Binder.class);
[INFO]   assert created instanceof ApplicationView$Binder;
[INFO]   ApplicationView$Binder result = (ApplicationView$Binder) created;
[INFO]   this.memberInject_Key$type$com$utilitiessavings$usavappv7$client$application$ApplicationView$Binder$_annotation$$none$$(result);
[INFO]   return result;
[INFO] }
[INFO]          com.google.gwt.dev.jjs.ast.JMethodBody
[INFO]       [ERROR] at com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java(131): com.utilitiessavings.usavappv7.client.application.com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.get_Key$type$com$utilitiessavings$usavappv7$client$application$ApplicationView$Binder$_annotation$$none$$()Lcom/utilitiessavings/usavappv7/client/application/ApplicationView$Binder;
[INFO]          com.google.gwt.dev.jjs.ast.JMethod
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:38 min
[INFO] Finished at: 2016-07-20T09:34:52+01:00
[INFO] Final Memory: 65M/534M

I don't know whether this is a problem with Java 8, GWT, or GWTP.

Any advice on how to investigate further or what could be causing it would be appreciated.

Edit:

pom.xml (snippets)

<properties>
    <!-- client -->
    <gwt.version>2.8.0-SNAPSHOT</gwt.version>
    <gwtp.version>1.5.1</gwtp.version>
    <gin.version>2.1.2</gin.version>

    <gwtbootstrap3.version>0.9.3</gwtbootstrap3.version>
    <gwtbootstrap3-extras.version>0.9.2</gwtbootstrap3-extras.version>

    <gwt-log.version>3.3.2</gwt-log.version>

    <!-- server -->
    <gae.version>1.9.38</gae.version>
    <guice.version>4.1.0</guice.version>
    <objectify.version>5.1.13</objectify.version>

    <persistence-api.version>1.0.2</persistence-api.version>
    <servlet-api.version>2.5</servlet-api.version>
    <javax.validation.version>1.0.0.GA</javax.validation.version>
    <hibernate-validator.version>4.1.0.Final</hibernate-validator.version>
    <slf4j.version>1.7.9</slf4j.version>
    <jackson.version>2.7.0-rc2</jackson.version>

    <guava-version>20.0-SNAPSHOT</guava-version>

    <!-- testing -->
    <junit.version>4.12</junit.version>
    <jukito.version>1.4.1</jukito.version>
    <cucumber.version>1.2.4</cucumber.version>

    <!-- maven -->
    <gwt-maven-plugin.version>2.8.0-SNAPSHOT</gwt-maven-plugin.version>
    <maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
    <maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>
    <maven-resources-plugin.version>2.5</maven-resources-plugin.version>
    <maven-processor-plugin.version>2.0.5</maven-processor-plugin.version>
    <maven-build-helper-plugin.version>1.10</maven-build-helper-plugin.version>

    <target.jdk>1.8</target.jdk>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>

    <gae.home>${settings.localRepository}/com/google/appengine/appengine-java-sdk/${gae.version}</gae.home>
    <mvn.gae.home>
        ${settings.localRepository}/com/google/appengine/appengine-java-sdk/${gae.version}/appengine-java-sdk/appengine-java-sdk-${gae.version}
    </mvn.gae.home>

</properties>

<build>

    <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>

    <resources>
        <resource>
            <directory>src/main/resources</directory>
        </resource>
        <resource>
            <directory>src/main/super</directory>
        </resource>
        <resource>
            <directory>${project.build.directory}/generated-sources/apt</directory>
        </resource>
        <resource>
            <directory>${project.build.directory}/generated-sources/gwt</directory>
        </resource>
    </resources>

    <plugins>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>versions-maven-plugin</artifactId>
            <version>2.2</version>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>display-dependency-updates</goal>
                        <goal>display-plugin-updates</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven-compiler-plugin.version}</version>
            <configuration>
                <source>${target.jdk}</source>
                <target>${target.jdk}</target>
                <encoding>${project.build.sourceEncoding}</encoding>
                <proc>none</proc>
            </configuration>
        </plugin>

        <!-- GWT -->
        <!-- 'mvn gwt:run' - runs development mode -->
        <!-- 'mvn gwt:debug' - runs debug mode -->
        <!-- 'mvn gwt:compile' - compiles gwt -->
        <!-- 'mvn integration-test' - runs the gwt tests (*GwtTest.java) -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>${gwt-maven-plugin.version}</version>

            <configuration>
                <strict>true</strict>
                <testTimeOut>180</testTimeOut>
                <mode>htmlunit</mode>
                <logLevel>INFO</logLevel>
                <style>PRETTY</style>

                <copyWebapp>true</copyWebapp>
                <hostedWebapp>${webappDirectory}</hostedWebapp>
                <server>com.google.appengine.tools.development.gwt.AppEngineLauncher</server>
                <appEngineVersion>${gae.version}</appEngineVersion>
                <extraJvmArgs>-Ddatastore.default_high_rep_job_policy_unapplied_job_pct=20 -Xmx2g -Dappengine.sdk.root=${mvn.gae.home}
                </extraJvmArgs>
                <port>8888</port>
                <incremental>false</incremental>
                <bindAddress>0.0.0.0</bindAddress>
                <runTarget>Project.html</runTarget>
                <modules>
                    <module>com.utilitiessavings.usavappv7.Project</module>
                </modules>
            </configuration>

            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>com.google.appengine</groupId>
            <artifactId>gcloud-maven-plugin</artifactId>
            <configuration>
                <verbosity>info</verbosity>
                <runtime>java</runtime>
            </configuration>
            <version>2.0.9.106.v20160420</version>
        </plugin>

Libraries

  • Java 1.8.0_92
  • Maven 3.3.9
  • GWT 2.8.0-SNAPSHOT
  • GWTP 1.5.1
  • Guava 20.0-SNAPSHOT
  • Guice 4.1.0
  • Gin 2.1.2
gwt
java-8
gwtp
gwt-maven-plugin
gwt-2.8
asked on Stack Overflow Jul 19, 2016 by slugmandrew • edited Jul 20, 2016 by slugmandrew

2 Answers

2

Upgrading my own comment to an answer.

I discovered the library excel-streaming-reader had a dependency on xercesImpl 2.4.0 (from 2006).

I declared an additional dependency to 2.11.0 to solve the issue:

<dependency>
    <groupId>xerces</groupId>
    <artifactId>xercesImpl</artifactId>
    <version>2.11.0</version>
</dependency>

I have notified the owner of the problem. Github issue: https://github.com/monitorjbl/excel-streaming-reader/issues/44

answered on Stack Overflow Jul 26, 2016 by slugmandrew • edited May 23, 2017 by Community
0

Updated answer. As question author found out based on comments, the problem was with incompatible Xerces library that was pulled by excel-streaming-reader.

To resolve similar issues, passing -X to Maven to examine all libraries used during compilation and turning on logging via logLevel property in maven-compiler-plugin helps to narrow down the problems like this.

In my original answer I also recommended to manually create HKEY_LOCAL_MACHINE\Software\JavaSoft\Prefs or HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Prefs on 64bit WinPC. You can find additional details e.g. in this post how to create Prefs root node

GWT tries to access Windows registry to store or retrieve encryption key data via java.util.prefs.WindowsPreferences. This warning is annoying, but mostly harmless, you can skip this part unless you like your logs clean.

answered on Stack Overflow Jul 19, 2016 by Alex Pakka • edited May 23, 2017 by Community

User contributions licensed under CC BY-SA 3.0