Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incompatible Class Change Error - org.eclipse.jetty.annotations.AnnotationParser for Web Project

I am creating a Soap Web Project in intellij, when i try to run the following project Project Code in Jetty Runner plugin, i am getting the following exception

java.lang.IncompatibleClassChangeError: class org.eclipse.jetty.annotations.AnnotationParser$MyClassVisitor has interface org.objectweb.asm.ClassVisitor as super class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:935)
    at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:919)
    at org.eclipse.jetty.annotations.AnnotationParser.lambda$parseJar$0(AnnotationParser.java:878)
    at java.util.TreeMap$ValueSpliterator.forEachRemaining(TreeMap.java:2897)
    at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
    at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:874)
    at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:838)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:471)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
    at java.lang.Thread.run(Thread.java:745)
like image 265
Vijay Manohar Avatar asked Jul 04 '26 09:07

Vijay Manohar


1 Answers

As @Volkan Albayrak wrote it's a problem with different ASM versions.

Inspecting the project dependencies with mvn dependency:tree reveals that dependency org.apache.cxf:cxf-rt-bindings-http:jar:2.5.9 brings in an ASM compile time dependency.

[INFO] \- org.apache.cxf:cxf-rt-bindings-http:jar:2.5.9:compile
[INFO]    +- org.codehaus.jra:jra:jar:1.0-alpha-4:compile
[INFO]    +- org.apache.cxf:cxf-rt-bindings-xml:jar:2.5.9:compile
[INFO]    +- org.apache.cxf:cxf-rt-transports-http:jar:2.5.9:compile
[INFO]    |  +- org.apache.cxf:cxf-rt-transports-common:jar:2.5.9:compile
[INFO]    |  \- org.springframework:spring-web:jar:3.0.6.RELEASE:compile
[INFO]    \- org.apache.cxf:cxf-rt-frontend-jaxws:jar:2.5.9:compile
[INFO]       +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO]       +- asm:asm:jar:3.3.1:compile <-- this one is the problem
[INFO]       \- org.apache.cxf:cxf-rt-ws-addr:jar:2.5.9:compile

The IntelliJ plugin IDEA Jetty Runner (version 1.3.1) itself depends on the Eclipse jetty runner. And this jetty-runner-9.4.14.v20181114.jar contains ASM 7.0.

You need to exclude the dependency asm:asm:jar:3.3.1 from your maven project.

in the pom.xml amend

<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-bindings-http</artifactId>
    <version>2.5.9</version>
    <exclusions>
        <exclusion>
            <artifactId>asm</artifactId>
            <groupId>asm</groupId>
        </exclusion>
        ...
like image 181
SubOptimal Avatar answered Jul 07 '26 01:07

SubOptimal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!