Weird NoClassDefFoundError: com/couchbase/client/deps/io/netty/handler/timeout/IdleState

Java SDK version: 2.6.2

I have make sure core-io-1.6.2.jar is in the classpath, But got many NoClassDefFoundError:

09:15:51.837 WARN DefaultChannelPipeline-An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.NoClassDefFoundError: com/couchbase/client/deps/io/netty/handler/timeout/IdleState
at com.couchbase.client.deps.io.netty.handler.timeout.IdleStateHandler$ReaderIdleTimeoutTask.run(IdleStateHandler.java:493)
at com.couchbase.client.deps.io.netty.handler.timeout.IdleStateHandler$AbstractIdleTask.run(IdleStateHandler.java:466)
at com.couchbase.client.deps.io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38)
at com.couchbase.client.deps.io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:120)
at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:399)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:464)
at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131)
at com.couchbase.client.deps.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)

Can you check whether there are multiple versions of core-io in your class path?

NoClassDefFoundError in Java comes when Java Virtual Machine is not able to find a particular class at runtime which was available at compile time. After you compile your code, you end up with .class files for each class in your program. These binary files are the bytecode that Java interprets to execute your program. The NoClassDefFoundError indicates that the classloader (in this case java.net.URLClassLoader), which is responsible for dynamically loading classes, cannot find the .class file for the class that you’re trying to use.

NoClassDefFoundError can occur for multiple reasons like

  • ClassNotFoundException – .class not found for that referenced class irrespective of whether it is available at compile time or not(i.e base/child class).
  • Class file located, but Exception raised while initializing static variables
  • Class file located, Exception raised while initializing static blocks