简体   繁体   English

java.lang.NoSuchMethodError:在重版和Netty集成中

[英]java.lang.NoSuchMethodError: in redisson and netty integration

I have built my own library of custom methods using redisson 3.4.4. 我使用redisson 3.4.4构建了自己的自定义方法库。 This internally uses netty-all-4.1.13.Final.jar. 这在内部使用netty-all-4.1.13.Final.jar。

When I build my library and try to use with a project I get following exception, 当我构建库并尝试与项目一起使用时,出现以下异常,

java.lang.NoSuchMethodError: io.netty.bootstrap.Bootstrap.config()Lio/netty/bootstrap/BootstrapConfig;
at org.redisson.client.RedisClient$1$1.operationComplete(RedisClient.java:214)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:680)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:567)
at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:406)
at org.redisson.misc.RedissonPromise.trySuccess(RedissonPromise.java:78)
at org.redisson.client.handler.BaseConnectionHandler.channelActive(BaseConnectionHandler.java:85)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:212)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelActive(AbstractChannelHandlerContext.java:198)
at io.netty.channel.DefaultChannelPipeline.fireChannelActive(DefaultChannelPipeline.java:818)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:252)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:282)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
at java.lang.Thread.run(Thread.java:748)

I did further digging into the "netty-all-4.1.13.Final.jar" and able to find that method "io.netty.bootstrap.Bootstrap.config()" with return type "io/netty/bootstrap/BootstrapConfig" is actually present. 我确实进一步研究了“ netty-all-4.1.13.Final.jar”,并且能够找到返回类型为“ io / netty / bootstrap / BootstrapConfig”的方法“ io.netty.bootstrap.Bootstrap.config()”。实际上存在。

Why am I getting "method not found error" here then if its present in jar/library I am using?? 为什么我在这里遇到“找不到方法错误”,如果它在我正在使用的jar /库中?

You may have defined the same class with two versions; 您可能已经用两个版本定义了相同的类; an old Version without this method, and a new class with this method! 没有此方法的旧版本,以及具有此方法的新类!

Solution: You can remove the class that contain this method from the package. 解决方案:您可以从包中删除包含此方法的类。 If the Problem remains, that means that your Project reads another Version from the class. 如果问题仍然存在,则意味着您的项目将从类中读取另一个版本。 find the old Version and remove it! 找到旧版本并将其删除!

And please don't steal the ideas and rewrite them as they are yours 而且,请不要窃取创意并将其改写为您的创意

I modified my classpath used for running application to include netty-all-4.1.13.Final.jar before some jars which I felt internally using netty's older version library. 我将用于运行应用程序的类路径修改为在一些jar之前包含netty-all-4.1.13.Final.jar。

Solved as of now. 截至目前已解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM