3

I have built my own library of custom methods using redisson 3.4.4. This internally uses 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.

Why am I getting "method not found error" here then if its present in jar/library I am using??

Rahul Borkar
  • 2,742
  • 3
  • 24
  • 38

2 Answers2

3

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

Hasan
  • 296
  • 1
  • 8
  • 23
  • I have extracted the netty jar I used for building my project and also extracted the netty jar which I use for running my project. Both has the method "io.netty.bootstrap.Bootstrap.config()". Still while running I am getting this error. – Rahul Borkar Jul 28 '17 at 07:19
  • before running the Project remove the class that have this method and try to run it. 1- rename the jar to a zip file, 2- open it and remove the class. 3- Close it and rename it to jar again. run the project – Hasan Jul 28 '17 at 07:23
  • How can I remove the class from library? I might need to rebuild netty in that case by removing class. – Rahul Borkar Jul 28 '17 at 07:25
  • 1- rename the jar to a zip file, 2- open it and remove the class. 3- Close it and rename it to jar again. run the project – Hasan Jul 28 '17 at 07:26
  • what happend? after removing the class, if the same Problem remains, you must search the other reference of the same class and remove it – Hasan Jul 28 '17 at 07:32
  • I am getting same issue after removing the class. Its very unclear where the problem is. Is it in redisson library or is it in my code? – Rahul Borkar Jul 28 '17 at 07:44
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/150378/discussion-between-rahul-borkar-and-hasan). – Rahul Borkar Jul 28 '17 at 07:47
  • That what I mean... when you have the same issue, that mean that you have another reference to another Version of the class somewhere (or may be more than one reference!) in your Project !!! 1- find the other reference, 2- remove it. 3 when your Project throws ClassNotFoundException add the jar with the real class – Hasan Jul 28 '17 at 07:48
  • Please don't steal ideas and rewrite them as they are yours – Hasan Aug 04 '17 at 19:38
1

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.

Solved as of now.

Rahul Borkar
  • 2,742
  • 3
  • 24
  • 38