shinchillahh
shinchillahh

Reputation: 515

Vaadin Widgetset Compilation Error After Vaadin8 Migration

I just migrated my Vaadin project from 7.7.6 to 8.0.5. First I wanted to use the Vaadin8 migration tool but my IDE used too many vaadin.* imports so I just did it manually. After hours of work (compatibility package imports) the maven build worked again and I wanted to open the WebApp in my browser but I got the "Failed to load the Widgetset..." error message. I thought that I have to recompile the Widgetset but the vaadin-maven-plugin throws an error:

EDIT 04.05.2017: I removed the QueryDSL dependency "querydsl-apt" and the widgetset is compiling... Does anyone know why this happens?

c:\dev\workspace_intellij\wsi>mvn vaadin:compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building wsi 2.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.querydsl:querydsl-core:jar:3.7.4 is missing, no dependency information available
[INFO]
[INFO] --- vaadin-maven-plugin:8.0.5:compile (default-cli) @ wsi ---
[INFO] auto discovered modules [WsiWidgetset]
[INFO] Using com.vaadin:vaadin-client-compiler version 8.0.5
[INFO] Compiling module WsiWidgetset
[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:3944)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.getInternalCompilerException(GwtAstBuilder.java:4351)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.createMembers(GwtAstBuilder.java:4043)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.processImpl(GwtAstBuilder.java:3883)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.process(GwtAstBuilder.java:3918)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater$UnitProcessorImpl.process(CompilationStateBuilder.java:129)
[INFO]  at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.process(JdtCompiler.java:384)
[INFO]  at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:470)
[INFO]  at com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:1092)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:325)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:548)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:479)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:465)
[INFO]  at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:423)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:222)
[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.NoSuchMethodError: org.eclipse.jdt.internal.compiler.lookup.MethodBinding.isDefaultMethod()Z
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.createMethod(GwtAstBuilder.java:4138)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.createMembers(GwtAstBuilder.java:4033)
[INFO]  ... 21 more
[INFO]    [ERROR] at SVGPathSegLinetoVerticalAbs.java(30): public interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg
[INFO]       org.eclipse.jdt.internal.compiler.ast.TypeDeclaration
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.929 s
[INFO] Finished at: 2017-05-02T15:04:34+02:00
[INFO] Final Memory: 35M/434M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:8.0.5:compile (default-cli) on project wsi: Command [[
[ERROR] C:\Program Files\Java\jdk1.8.0_102\jre\bin\java -Xmx1G -Dgwt.persistentunitcache=false com.google.gwt.dev.Compiler -logLevel INFO -style OBF -war c:\dev\workspace_intellij\wsi\target\classes\VAADIN\widgetsets -localWorkers 4 -failOnError -XfragmentCount -1 -sourceLevel auto -gen c:\dev\workspace_intellij\wsi\target\.generated WsiWidgetset
[ERROR] ]] failed with status 1
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

My pom.xml looks like this:

<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    [...]

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.2.RELEASE</version>
        <relativePath />
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>

        <vaadin.version>8.0.5</vaadin.version>
        <vaadin.plugin.version>8.0.5</vaadin.plugin.version>
        <vaadin.charts.version>4.0.0</vaadin.charts.version>
        <vaadin.spring.version>2.0.1</vaadin.spring.version>
        <vaadin.context.menu.version>2.0.0</vaadin.context.menu.version>
        <vaadin.fontawesome.version>1.3.4</vaadin.fontawesome.version>
        <vaadin.componentrenderer.version>2.0.0</vaadin.componentrenderer.version>

        [...]

    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-ldap</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-spring-boot-starter</artifactId>
            <version>${vaadin.spring.version}</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.0</version>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-push</artifactId>
        </dependency>

        <dependency>
            <groupId>org.vaadin.addons</groupId>
            <artifactId>fontawesomelabel</artifactId>
            <version>${vaadin.fontawesome.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.directory.server</groupId>
            <artifactId>apacheds-server-jndi</artifactId>
            <version>1.5.5</version>
        </dependency>

        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-core</artifactId>
            <version>4.0.1</version><!--$NO-MVN-MAN-VER$-->
        </dependency>

        <dependency>
            <groupId>org.imgscalr</groupId>
            <artifactId>imgscalr-lib</artifactId>
            <version>4.2</version>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jms</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-broker</artifactId>
        </dependency>

         <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-core</artifactId>
            <version>4.1.4</version>
        </dependency>
        <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-apt</artifactId>
            <version>4.1.4</version>
        </dependency>
        <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-jpa</artifactId>
            <version>4.1.4</version>
        </dependency>

        <dependency>
            <groupId>org.vaadin.addons</groupId>
            <artifactId>mediaelementjs-player</artifactId>
            <version>1.3.3</version>
        </dependency>
        <dependency>
            <groupId>org.vaadin.patrik</groupId>
            <artifactId>GridFastNavigation</artifactId>
            <version>0.2.1</version>
        </dependency>

        <!-- Eigenes Kompilat, da Sourcen nicht attached waren -->
        <dependency>
            <groupId>org.vaadin.addons.lazyquerycontainer</groupId>
            <artifactId>vaadin-lazyquerycontainer</artifactId>
            <version>7.6.1.3</version>
        </dependency>

        <!-- WIDGETSET -->

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-charts</artifactId>
            <version>${vaadin.charts.version}</version>
        </dependency>

        <dependency>
           <groupId>com.vaadin</groupId>
           <artifactId>vaadin-context-menu</artifactId>
           <version>${vaadin.context.menu.version}</version>
        </dependency>

        <dependency>
            <groupId>de.datenhahn.vaadin</groupId>
            <artifactId>componentrenderer</artifactId>
            <version>${vaadin.componentrenderer.version}</version>
        </dependency>

        <!-- WIDGETSET END -->

        [...]

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-compatibility-server</artifactId>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-compatibility-client</artifactId>
        </dependency>

    </dependencies>

    <repositories>
        <repository>
            <id>vaadin-addons</id>
            <url>http://maven.vaadin.com/vaadin-addons</url>
        </repository>
    </repositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-bom</artifactId>
                <version>${vaadin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <!-- Clean up also any pre-compiled themes -->
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>src/main/webapp/VAADIN/themes</directory>
                            <includes>
                                <include>**/styles.css</include>
                                <include>**/styles.scss.cache</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <!-- Exclude some unnecessary files generated by the GWT compiler. -->
                    <packagingExcludes>WEB-INF/classes/VAADIN/gwt-unitCache/**, WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>${vaadin.plugin.version}</version>

                <configuration>
                    <extraJvmArgs>-Xmx1G</extraJvmArgs>
                </configuration>

                <executions>
                    <execution>
                        <goals>
                            <goal>update-theme</goal>
                            <goal>update-widgetset</goal>
                            <goal>compile</goal>
                            <!-- Comment out compile-theme goal to use on-the-fly theme compilation -->
                            <goal>compile-theme</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.mysema.maven</groupId>
                <artifactId>apt-maven-plugin</artifactId>
                <version>1.1.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/generated-sources</outputDirectory>
                            <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    [...]

</project>

My Widgetset.gwt.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN"
        "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
<module>
    <!--
     Uncomment the following to compile the widgetset for one browser only.

     Multiple browsers can be specified as a comma separated list. The supported user agents at the moment of writing were:
     ie8,ie9,gecko1_8,safari,opera

     The value gecko1_8 is used for Firefox and safari is used for webkit based browsers including Google Chrome.
    -->
    <!-- <set-property name="user.agent" value="safari"/> -->

    <!--
    To enable SuperDevMode, uncomment this line.
    See https://vaadin.com/wiki/-/wiki/Main/Using%20SuperDevMode for more information and instructions.
    -->
    <!-- <set-configuration-property name="devModeRedirectEnabled" value="true" /> -->

    <!--<inherits name="com.vaadin.DefaultWidgetSet"/>-->

    <inherits name="com.vaadin.v7.Vaadin7WidgetSet" />

    <inherits name="com.vaadin.addon.charts.Widgetset"/>

    <inherits name="de.datenhahn.vaadin.componentrenderer.ComponentRendererWidgetSet"/>

    <inherits name="com.vaadin.contextmenu.WidgetSet" />

    <inherits name="org.vaadin.patrik.GridFastNavigation" />
</module>

Does anyone know whats going wrong?

Best regards

Upvotes: 2

Views: 1762

Answers (2)

Amulya Jagadeesh
Amulya Jagadeesh

Reputation: 1

That worked> Thanks a lot. I added :

 <exclusion>
    <groupId>org.eclipse.jdt.core.compiler</groupId>
    <artifactId>ecj</artifactId>
</exclusion>

in my pom dependency.

Upvotes: 0

Morfic
Morfic

Reputation: 15508

Generally NoSuchMethodError indicates a classpath problem, in the sense that the library that you have in your cp when writing the code (and your IDE is compiling inline your code to check it for errors) is a different version from the one in the maven compile-time cp. So a method that is available when writing the code is no longer found when compiling or running the code (see late binding).

In your particular case, this is most likely an indirect consequence due to the QueryDSL dependency that uses a JDT version, and the Vaadin maven plugin using a GWT plugin that references another JDT version.

As a workaround, you can explicitly exclude the JDT transitive dependency from either your QueryDSL version or the Vaadin maven plugin, and try to see if that works.

P.S. To see who exactly is referencing the JDT dependency you can run mvn dependency:tree

Upvotes: 2

Related Questions