I updated my project Vaadin version from 7.3.10 to 7.4.0 and after that I cannot compile project:
[INFO]
[ERROR]
Unexpected internal compiler error
[INFO]
java.lang.IncompatibleClassChangeError: class com.google.gwt.dev.javac.BytecodeSignatureMaker$CompileDependencyVisitor has interface org.objectweb.asm.ClassVisitor as super class
[INFO]
at java.lang.ClassLoader.defineClass1(Native Method)
[INFO]
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
[INFO]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
[INFO]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
[INFO]
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
[INFO]
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
[INFO]
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[INFO]
at java.security.AccessController.doPrivileged(Native Method)
[INFO]
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[INFO]
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
[INFO]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
[INFO]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
[INFO]
at com.google.gwt.dev.javac.BytecodeSignatureMaker.visitCompileDependenciesInBytecode(BytecodeSignatureMaker.java:227)
[INFO]
at com.google.gwt.dev.javac.BytecodeSignatureMaker.getCompileDependencySignature(BytecodeSignatureMaker.java:209)
[INFO]
at com.google.gwt.dev.javac.CompiledClass.getSignatureHash(CompiledClass.java:166)
[INFO]
at com.google.gwt.dev.javac.Dependencies$Ref.(Dependencies.java:42)
[INFO]
at com.google.gwt.dev.javac.Dependencies$Ref.(Dependencies.java:37)
[INFO]
at com.google.gwt.dev.javac.Dependencies.resolve(Dependencies.java:114)
[INFO]
at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:366)
[INFO]
at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:580)
[INFO]
at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:513)
[INFO]
at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:499)
[INFO]
at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:668)
[INFO]
at com.google.gwt.dev.Precompile.precompile(Precompile.java:255)
[INFO]
at com.google.gwt.dev.Precompile.precompile(Precompile.java:229)
[INFO]
at com.google.gwt.dev.Precompile.precompile(Precompile.java:145)
[INFO]
at com.google.gwt.dev.Compiler.run(Compiler.java:206)
[INFO]
at com.google.gwt.dev.Compiler.run(Compiler.java:158)
[INFO]
at com.google.gwt.dev.Compiler$1.run(Compiler.java:120)
[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:127)
I had the same problem with Apache tika-1.7.jar, which also includes an older version of asm.
I can work around the issue by
taking the compiler command line from the GWT compiler verbose debug output (“Executing compiler with command line:”), and
remove tika-app-1.7.jar from the [very long]
-classpath parameter
cd into my project directory
call the gwt compiler from the commandline by pasting the modified compiler command line
However, this is not pretty. I’d prefer to use the Vaadin Eclipse plugin for widget set compilation.
Maybe a solution could be if the Vaadin Eclipse plugin would order the jars in the classpath of the compiler command line more intelligently (i.e. asm-5.0.3.jar before other jars)?
Also, the above ‘solution’ successfully compiled the widgetset, but it does not get deployed. I assume that the Vaadin Eclipse plugin does something else after compiling.
So here’s an equally ugly workaround, that not only helps me to avoid the gwt compiler error, but also automagically integrated the newly compiled widgetset into the application:
compile widgetset (with error) via eclipse plugin
rename the offending jar in file system (in my case the tika jar) to anything else (because the classpath seems to be cached in the plugin, this is sufficient)
compile widgetset again via plugin (this time without error)
rename the offending jar back to its original name
I confirm that this solution works if you add it before the dependency which relies on a old version of asm (in my case org.apache.cxf:cxf-rt-frontend-jaxws:2.7.12).
Another solution would be to add an exclusion on the dependency which depends on an old version of ASM.
For example, for com.group:offending-dependency:x.y which depends on ASM 3.3.1 or less, you would have to add the exclusions block for widgetset compilation to succeed:
<dependency>
<groupId>com.group</groupId>
<artifactId>offending-dependency</artifactId>
<version>x.y</version>
<exclusions>
<exclusion>
<artifactId>asm</artifactId>
<groupId>asm</groupId>
</exclusion>
</exclusions>
</dependency>
Special thanks to one of my colleagues for suggesting this approach!
Looking at the source code makes me believe that this problem won’t be visible for projects using Ivy, as the comment says:
// first add all dependencies from Ivy configuration
// widgetset-compile
So if these dependencies are correctly definied, asm is among them.
Similar logic should be implemented for all project configurations, i.e. also for projects not using Ivy. Unfortunately I currently have not the time to open a ticket for this.
But at least, looking at the code, I found a less intrusive workaround:
[line 817]
// might be a Vaadin JAR directly in the project
if (path.lastSegment().startsWith("vaadin-")) {
otherLocations.add(getRawLocation(project, path));
}
So for now, I have renamed my asm*.jars to vaadin-asm*, which prioritizes them in the class path. Widgetset compiling works. I just have to remember to rename the jars each time I update vaadin by hand…
Does anyone found a solution of this problem while switching to vaddin 7.5.x , I’m facing the same problem when I try to update from 7.3.x to 7.4.x Or 7.5.x , Only 7.3.10 builds correctly but all latest versions of vaadin gives the same build error mentioned at top of this post
Nazmul, (and possibly Aminul), if you use Maven, the best solution for you is probably the one of
Frank Waßewitz above. Make sure that asm 5.0.3 is above any other dependency that includes an older version of
asm .
[code]
My solution is to add following dependency into my pom.xml
org.ow2.asm
asm
5.0.3
compile
[/code](or the exclusion-solution as described by Valentin Descamps, but for that you have to know which dependencies include an old version of asm).
If you manage your jar files by hand like me, rename all
asm*.jars to
vaadin-asm*.jar , so they get added to the classpath first.
If you use Ivy, I assume you should not see this problem, so using Ivy is probably also a solution.
I’m using maven and I’ve tried of
Frank Waßewitz’s solution and add that dependency snippet mentioned by him at the very beginning of the dependencies tree but cant get the rid of the error. Am I wrong here? Is the exclution-solution is the only solution??
If you have exactly the error message that started this thread, we can at least be reasonably sure that the cause for the error is an older version of asm in your classpath, before the vaadin asm files. And the solution to this error is to somehow correct the order of the jars.
You can check the current order of the jars in the console when you compile the widget set (I assume you use the Vaadin plugin in Eclipse). The second line in the output is the call to the widget set compiler, with the complete classpath in it. At least one of the jars before the vaadin asm jars must contain an older asm version.
You can copy this line from the console, change the order of the jars by hand and paste the result into a shell and see if it works.
But of course it would be better if you change it persistently. I have no idea why changing the dependendy file does not change the order of the jar files in your case (maybe you have more than one dependendy files, and change the wrong one?).