gpt4 book ai didi

java - 不兼容的类更改错误 - Web 项目的 org.eclipse.jetty.annotations.AnnotationParser

转载 作者:行者123 更新时间:2023-12-02 12:24:47 24 4
gpt4 key购买 nike

当我尝试运行以下项目时,我正在 intellij 创建一个 Soap Web 项目 Project Code在 Jetty Runner 插件中,我收到以下异常

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)

最佳答案

@Volkan Albayrak写道这是不同 ASM 版本的问题。

使用 mvn dependency:tree 检查项目依赖项,发现依赖项 org.apache.cxf:cxf-rt-bindings-http:jar:2.5.9 引入了ASM 编译时依赖。

[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

IntelliJ插件IDEA Jetty Runner(版本1.3.1)本身依赖于Eclipse jetty runner 。这个 jetty-runner-9.4.14.v20181114.jar 包含 ASM 7.0。

您需要从 Maven 项目中排除依赖项 asm:asm:jar:3.3.1

pom.xml修改

<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>
...

关于java - 不兼容的类更改错误 - Web 项目的 org.eclipse.jetty.annotations.AnnotationParser,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59575142/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com