【发布时间】:2022-10-18 06:13:34
【问题描述】:
我有以下依赖项:
[INFO] +- org.apache.activemq:artemis-core-client:jar:2.19.1:compile
...
[INFO] | \- io.netty:netty-common:jar:4.1.79.Final:compile
[INFO] +- org.apache.activemq:artemis-jms-client-all:jar:2.19.1:compile
在spring-boot-starter-parent 和spring-cloud 提升后,应用程序启动后出现以下消息:
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
io.netty.buffer.AbstractReferenceCountedByteBuf.<init>(AbstractReferenceCountedByteBuf.java:50)
The following method did not exist:
io.netty.util.internal.ReferenceCountUpdater.setInitialValue(Lio/netty/util/ReferenceCounted;)V
The calling method's class, io.netty.buffer.AbstractReferenceCountedByteBuf, is available from the following locations:
jar:file:/app/lib/netty-buffer-4.1.79.Final.jar!/io/netty/buffer/AbstractReferenceCountedByteBuf.class
jar:file:/app/lib/artemis-jms-client-all-2.19.1.jar!/io/netty/buffer/AbstractReferenceCountedByteBuf.class
The calling method's class was loaded from the following location:
file:/app/lib/netty-buffer-4.1.79.Final.jar
The called method's class, io.netty.util.internal.ReferenceCountUpdater, is available from the following locations:
jar:file:/app/lib/artemis-jms-client-all-2.19.1.jar!/io/netty/util/internal/ReferenceCountUpdater.class
jar:file:/app/lib/netty-common-4.1.79.Final.jar!/io/netty/util/internal/ReferenceCountUpdater.class
The called method's class hierarchy was loaded from the following locations:
io.netty.util.internal.ReferenceCountUpdater: file:/app/lib/artemis-jms-client-all-2.19.1.jar
Action:
Correct the classpath of your application so that it contains compatible versions of the classes io.netty.buffer.AbstractReferenceCountedByteBuf and io.netty.util.internal.ReferenceCountUpdater
由于artemis-jms-client-all-2.19.1.jar 和netty-common-4.1.79.Final.jar 都在使用中,并且只有netty-common-4.1.79.Final.jar 具有必要的方法(setInitialValue()),我不能只删除其中一个JAR。
有没有办法定义这些的顺序? 这个订单问题是否可能来自隆起?以前比较懒?
【问题讨论】:
-
artemis-jms-client-all-2.19.1.jar重新打包该 jar 中的所有依赖项。它包括它需要的所有类。我建议不要使用全部依赖项,只使用核心的一个或单个依赖项。 -
FWIW,ActiveMQ Artemis 2.25.0(即此时的最新版本)使用 Netty 4.1.79.Final。
标签: java spring netty activemq-artemis