我有以下依赖项:
[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。
有没有办法定义这些的顺序?这个顺序问题会不会是来自于上抬?以前比较懒?
1条答案
按热度按时间bvn4nwqk1#
您有相同相依性的恩怨版本。当您保持相依性不变时,这只是会发生的一连串问题中的第一个问题。
尝试使用依赖于您需要的netty-common版本的artemis-jms-client的更新版本。决定跳过netty-common依赖(因为它包含在artemis-jms-client中)或者不使用artemis-jms-client的... -all-...依赖,而是使用一个使用传递依赖的版本,并通过maven(或gradle或您使用的任何构建系统)加载其他版本。
重新排序类路径来解决这种问题确实是一个非常微妙的过程,我绝不建议对第三方依赖项执行该过程。