Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT Compilation Error - IncompatibleClassChangeError

Tags:

gwt

When compiling the project, I get this obscure Exception

Looking for precompiled archives.  To disable, use -Dgwt.usearchives=false
Loading archived module: jar:file:<base>/.m2/repository/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar!/com/google/gwt/user/User.gwtar
[WARN] Unable to read: jar:file:<base>/.m2/repository/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar!/com/google/gwt/user/User.gwtar. Skipping: java.io.InvalidClassException: com.google.gwt.dev.util.DiskCacheToken; local class incompatible: stream classdesc serialVersionUID = 3824090149180578568, local class serialVersionUID = -2622986784335128516
Loading archived module: jar:file:<base>/.m2/repository/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar!/com/google/gwt/core/Core.gwtar
[WARN] Unable to read: jar:file:<base>/.m2/repository/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar!/com/google/gwt/core/Core.gwtar. Skipping: java.io.InvalidClassException: com.google.gwt.dev.util.DiskCacheToken; local class incompatible: stream classdesc serialVersionUID = 3824090149180578568, local class serialVersionUID = -2622986784335128516
Loading archived module: jar:file:<base>/.m2/repository/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar!/com/google/gwt/regexp/RegExp.gwtar
[WARN] Unable to read: jar:file:<base>/.m2/repository/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar!/com/google/gwt/regexp/RegExp.gwtar. Skipping: java.io.InvalidClassException: com.google.gwt.dev.util.DiskCacheToken; local class incompatible: stream classdesc serialVersionUID = 3824090149180578568, local class serialVersionUID = -2622986784335128516
Loading archived module: jar:file:<base>/.m2/repository/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar!/com/google/web/bindery/event/Event.gwtar
Loading archived module: jar:file:<base>/.m2/repository/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar!/com/google/gwt/xml/XML.gwtar
[WARN] Unable to read: jar:file:<base>/.m2/repository/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar!/com/google/gwt/xml/XML.gwtar. Skipping: java.io.InvalidClassException: com.google.gwt.dev.util.DiskCacheToken; local class incompatible: stream classdesc serialVersionUID = 3824090149180578568, local class serialVersionUID = -2622986784335128516
Loading archived module: jar:file:<base>/.m2/repository/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar!/com/google/gwt/json/JSON.gwtar
[WARN] Unable to read: jar:file:<base>/.m2/repository/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar!/com/google/gwt/json/JSON.gwtar. Skipping: java.io.InvalidClassException: com.google.gwt.dev.util.DiskCacheToken; local class incompatible: stream classdesc serialVersionUID = 3824090149180578568, local class serialVersionUID = -2622986784335128516
Found 0 cached/archived units.  Used 0 / 4578 units from cache.
Compiling...
  0% complete (ETR: 93 seconds)
  10% complete (ETR: 56 seconds)
  20% complete (ETR: 37 seconds)
  30% complete (ETR: 25 seconds)
  40% complete (ETR: 18 seconds)
  50% complete (ETR: 14 seconds)
  60% complete (ETR: 10 seconds)
  70% complete (ETR: 7 seconds)
  80% complete (ETR: 5 seconds)
  90% complete (ETR: 2 seconds)
  100% complete (ETR: 0 seconds)
  Compilation completed in 28.40 seconds
[ERROR] Unexpected internal compiler error
java.lang.IncompatibleClassChangeError: class com.google.gwt.dev.javac.BytecodeSignatureMaker$CompileDependencyVisitor has interface com.google.gwt.dev.asm.ClassVisitor as super class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at com.google.gwt.dev.javac.BytecodeSignatureMaker.visitCompileDependenciesInBytecode(BytecodeSignatureMaker.java:217)
at com.google.gwt.dev.javac.BytecodeSignatureMaker.getCompileDependencySignature(BytecodeSignatureMaker.java:199)
at com.google.gwt.dev.javac.CompiledClass.getSignatureHash(CompiledClass.java:152)
at com.google.gwt.dev.javac.Dependencies$Ref.<init>(Dependencies.java:42)
at com.google.gwt.dev.javac.Dependencies$Ref.<init>(Dependencies.java:37)
at com.google.gwt.dev.javac.Dependencies.resolve(Dependencies.java:114)
at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:311)
at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:511)
at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:434)
at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:420)
at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:485)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:241)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:223)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:139)
at com.google.gwt.dev.Compiler.run(Compiler.java:167)
at com.google.gwt.dev.Compiler.run(Compiler.java:132)
at com.google.gwt.dev.Compiler$1.run(Compiler.java:99)
at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:55)
at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:50)
at com.google.gwt.dev.Compiler.main(Compiler.java:106)
Shutting down PersistentUnitCache thread

Where could I start looking for the issue?

like image 677
Manu Avatar asked Apr 19 '14 22:04

Manu


4 Answers

I had same issue when I migrated gwt from 2.6.1 to 2.8. Actually this error caused by asm dependency. Some of your server dependency has internal dependency to asm. In my case its cglib. So I changed cglib to cglib-nodep and it worked :-)

   <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib-nodep</artifactId>
        <version>3.2.1</version>
    </dependency>
like image 151
Nava Avatar answered Nov 14 '22 22:11

Nava


Please try it again after removing all the generated stub and re-compiling the project again.

I have highlighted all the stubs that needs to be deleted as shown in below snapshot.

enter image description here

Here is the list of folders (name can vary based on your GWT project compilation module name) that need to be removed.

  • gwt-unitCache
  • test-classes
  • war > gwtproject
  • war > WEB-INF > classes
  • war > WEB-INF > deploy
like image 40
Braj Avatar answered Nov 14 '22 21:11

Braj


In my case I had to remove the asm 3.1 from my classpath and there are few jars which has internal dependency on asm 3.1. Which i had to exclude from the dependency in my pom. example:

<dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>2.7.18</version>
        <exclusions>
          <exclusion> <!-- exclude version 3 of asm -->
            <groupId>asm</groupId>
            <artifactId>asm</artifactId>
          </exclusion>

        </exclusions>
      </dependency>

There were other jars which has such internal dependency, use maven dependency tree to identify. and exclude asm dependency.

Note: you can even upgrade these jars to higher versions which in fact support higher versions of ASM(>4.0), which should be fine with GWT 2.7 or 2.8

like image 40
Bikas Katwal Avatar answered Nov 14 '22 22:11

Bikas Katwal


In my case I had to exclude an asm artefact coming from a hibernate validator library so you should be fine excluding any asm artefact in your maven configs for your gwt module.

like image 21
Albert Scholtz Avatar answered Nov 14 '22 22:11

Albert Scholtz