java.lang.ClassNotFoundException: jdk.internal.misc.Unsafe

1,176 views
Skip to first unread message

Devendra Vishwakarma

unread,
Feb 21, 2018, 3:50:17 AM2/21/18
to DataStax Java Driver for Apache Cassandra User Mailing List
I suddenly started seeing java.lang.ClassNotFoundException: jdk.internal.misc.Unsafe when connecting to cassandra cluster. 

Logs- 

018-02-21 14:15:41 DEBUG Cluster:1416 - Starting new cluster with contact points [localhost/127.0.0.1:9042, localhost/0:0:0:0:0:0:0:1:9042]
2018-02-21 14:15:41 DEBUG InternalLoggerFactory:71 - Using SLF4J as the default logging framework
2018-02-21 14:15:41 DEBUG PlatformDependent0:76 - -Dio.netty.noUnsafe: false
2018-02-21 14:15:41 DEBUG PlatformDependent0:71 - sun.misc.Unsafe.theUnsafe: available
2018-02-21 14:15:41 DEBUG PlatformDependent0:71 - sun.misc.Unsafe.copyMemory: available
2018-02-21 14:15:41 DEBUG PlatformDependent0:71 - java.nio.Buffer.address: available
2018-02-21 14:15:41 DEBUG PlatformDependent0:71 - direct buffer constructor: available
2018-02-21 14:15:41 DEBUG PlatformDependent0:76 - java.nio.Bits.unaligned: available, true
2018-02-21 14:15:41 DEBUG PlatformDependent0:91 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable
java.lang.ClassNotFoundException: jdk.internal.misc.Unsafe
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at io.netty.util.internal.PlatformDependent0$6.run(PlatformDependent0.java:290)
at java.security.AccessController.doPrivileged(Native Method)
at io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:283)
at io.netty.util.internal.PlatformDependent.getSystemClassLoader(PlatformDependent.java:641)
at io.netty.util.internal.PlatformDependent.isAndroid0(PlatformDependent.java:665)
at io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:65)
at io.netty.util.Signal.<clinit>(Signal.java:31)
at io.netty.util.concurrent.DefaultPromise.<clinit>(DefaultPromise.java:43)
at io.netty.util.concurrent.GlobalEventExecutor.<init>(GlobalEventExecutor.java:44)
at io.netty.util.concurrent.GlobalEventExecutor.<clinit>(GlobalEventExecutor.java:41)
at com.datastax.driver.core.Connection$Factory.<init>(Connection.java:752)
at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1446)
at com.datastax.driver.core.Cluster.init(Cluster.java:159)
at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:330)
at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:305)
at com.datastax.driver.core.Cluster.connect(Cluster.java:247)
2018-02-21 14:15:41 DEBUG PlatformDependent0:76 - java.nio.DirectByteBuffer.<init>(long, int): available
2018-02-21 14:15:41 DEBUG PlatformDependent:71 - Platform: Windows
2018-02-21 14:15:41 DEBUG PlatformDependent:76 - Java version: 8
2018-02-21 14:15:41 DEBUG PlatformDependent:76 - sun.misc.Unsafe: available
2018-02-21 14:15:41 DEBUG PlatformDependent:76 - -Dio.netty.tmpdir: C:\Users\Dell\AppData\Local\Temp (java.io.tmpdir)
2018-02-21 14:15:41 DEBUG PlatformDependent:76 - -Dio.netty.bitMode: 64 (sun.arch.data.model)
2018-02-21 14:15:41 DEBUG PlatformDependent:76 - -Dio.netty.noPreferDirect: false
2018-02-21 14:15:41 DEBUG PlatformDependent:76 - -Dio.netty.maxDirectMemory: 3797417984 bytes
2018-02-21 14:15:41 DEBUG PlatformDependent:76 - -Dio.netty.uninitializedArrayAllocationThreshold: -1
2018-02-21 14:15:41 DEBUG CleanerJava6:71 - java.nio.ByteBuffer.cleaner(): available
2018-02-21 14:15:41 DEBUG SystemProperties:48 - com.datastax.driver.FORCE_NIO is undefined, using default value false
2018-02-21 14:15:41 INFO  NettyUtil:83 - Did not find Netty's native epoll transport in the classpath, defaulting to NIO.
2018-02-21 14:15:41 DEBUG MultithreadEventLoopGroup:76 - -Dio.netty.eventLoopThreads: 8
2018-02-21 14:15:41 DEBUG NioEventLoop:76 - -Dio.netty.noKeySetOptimization: false
2018-02-21 14:15:41 DEBUG NioEventLoop:76 - -Dio.netty.selectorAutoRebuildThreshold: 512
2018-02-21 14:15:41 DEBUG PlatformDependent:71 - org.jctools-core.MpscChunkedArrayQueue: available
2018-02-21 14:15:42 TRACE NioEventLoop:46 - instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@2c35e847
2018-02-21 14:15:42 TRACE NioEventLoop:46 - instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@74751b3
2018-02-21 14:15:42 TRACE NioEventLoop:46 - instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@741a8937
2018-02-21 14:15:42 TRACE NioEventLoop:46 - instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@306e95ec
2018-02-21 14:15:42 TRACE NioEventLoop:46 - instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@52af26ee
2018-02-21 14:15:42 TRACE NioEventLoop:46 - instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@6fd83fc1
2018-02-21 14:15:42 TRACE NioEventLoop:46 - instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@4f2b503c
2018-02-21 14:15:42 TRACE NioEventLoop:46 - instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@bae7dc0
2018-02-21 14:15:42 DEBUG ResourceLeakDetector:81 - -Dio.netty.leakDetection.level: simple
2018-02-21 14:15:42 DEBUG ResourceLeakDetector:81 - -Dio.netty.leakDetection.maxRecords: 4
2018-02-21 14:15:42 DEBUG ResourceLeakDetectorFactory:76 - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@550dbc7a
2018-02-21 14:15:42 DEBUG SystemProperties:48 - com.datastax.driver.EXTENDED_PEER_CHECK is undefined, using default value true
2018-02-21 14:15:42 TRACE STATES:138 - canReconnectNow=true
2018-02-21 14:15:42 DEBUG STATES:88 - [localhost/0:0:0:0:0:0:0:1:9042] preparing to open 1 new connections, total = 1
2018-02-21 14:15:42 DEBUG SystemProperties:48 - com.datastax.driver.DISABLE_COALESCING is undefined, using default value false
2018-02-21 14:15:42 DEBUG PooledByteBufAllocator:76 - -Dio.netty.allocator.numHeapArenas: 8
2018-02-21 14:15:42 DEBUG PooledByteBufAllocator:76 - -Dio.netty.allocator.numDirectArenas: 8
2018-02-21 14:15:42 DEBUG PooledByteBufAllocator:76 - -Dio.netty.allocator.pageSize: 8192
2018-02-21 14:15:42 DEBUG PooledByteBufAllocator:76 - -Dio.netty.allocator.maxOrder: 11
2018-02-21 14:15:42 DEBUG PooledByteBufAllocator:76 - -Dio.netty.allocator.chunkSize: 16777216
2018-02-21 14:15:42 DEBUG PooledByteBufAllocator:76 - -Dio.netty.allocator.tinyCacheSize: 512
2018-02-21 14:15:42 DEBUG PooledByteBufAllocator:76 - -Dio.netty.allocator.smallCacheSize: 256
2018-02-21 14:15:42 DEBUG PooledByteBufAllocator:76 - -Dio.netty.allocator.normalCacheSize: 64
2018-02-21 14:15:42 DEBUG PooledByteBufAllocator:76 - -Dio.netty.allocator.maxCachedBufferCapacity: 32768
2018-02-21 14:15:42 DEBUG PooledByteBufAllocator:76 - -Dio.netty.allocator.cacheTrimInterval: 8192
2018-02-21 14:15:42 DEBUG PooledByteBufAllocator:76 - -Dio.netty.allocator.useCacheForAllThreads: true
2018-02-21 14:15:42 DEBUG ByteBufUtil:76 - -Dio.netty.allocator.type: unpooled
2018-02-21 14:15:42 DEBUG ByteBufUtil:76 - -Dio.netty.threadLocalDirectBufferSize: 65536
2018-02-21 14:15:42 DEBUG ByteBufUtil:76 - -Dio.netty.maxThreadLocalCharBufferSize: 16384
2018-02-21 14:15:43 DEBUG Connection:164 - Connection[localhost/0:0:0:0:0:0:0:1:9042-1, inFlight=0, closed=false] Error connecting to localhost/0:0:0:0:0:0:0:1:9042 (Connection refused: no further information: localhost/0:0:0:0:0:0:0:1:9042)
2018-02-21 14:15:43 TRACE STATES:429 - Defuncting Connection[localhost/0:0:0:0:0:0:0:1:9042-1, inFlight=0, closed=false]
com.datastax.driver.core.exceptions.TransportException: [localhost/0:0:0:0:0:0:0:1:9042] Cannot connect
at com.datastax.driver.core.Connection$1.operationComplete(Connection.java:165)
at com.datastax.driver.core.Connection$1.operationComplete(Connection.java:148)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:507)
at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:500)
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:479)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:420)
at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:122)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:278)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:294)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:633)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
at java.lang.Thread.run(Thread.java:745)
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/0:0:0:0:0:0:0:1:9042
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:258)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:291)
... 7 more
Caused by: java.net.ConnectException: Connection refused: no further information
... 11 more
2018-02-21 14:15:43 DEBUG STATES:125 - [localhost/0:0:0:0:0:0:0:1:9042] preventing new connections for the next 1000 ms
2018-02-21 14:15:43 DEBUG STATES:108 - [localhost/0:0:0:0:0:0:0:1:9042] Connection[localhost/0:0:0:0:0:0:0:1:9042-1, inFlight=0, closed=false] failed, remaining = 0
2018-02-21 14:15:43 DEBUG Connection:690 - Connection[localhost/0:0:0:0:0:0:0:1:9042-1, inFlight=0, closed=true] closing connection
2018-02-21 14:15:43 DEBUG ControlConnection:243 - [Control connection] error on localhost/0:0:0:0:0:0:0:1:9042 connection, trying next host


Please help.

Gábor Auth

unread,
Feb 21, 2018, 7:40:42 AM2/21/18
to java-dri...@lists.datastax.com
Hi,

On Wed, Feb 21, 2018 at 9:50 AM Devendra Vishwakarma <vvvv...@gmail.com> wrote:
I suddenly started seeing java.lang.ClassNotFoundException: jdk.internal.misc.Unsafe when connecting to cassandra cluster. 

What is the version of the Netty on the classpath?


Bye,
Gábor Auth

--
Bye,
Auth Gábor

Devendra Vishwakarma

unread,
Feb 22, 2018, 12:02:50 PM2/22/18
to java-dri...@lists.datastax.com
Hi,

I am seeing these 5 jars of netty in my project class path and the version is 4.0.47
netty-handler
netty-buffer
netty-common
netty-transport
netty-codec

Thanks,
Devendra

--
You received this message because you are subscribed to the Google Groups "DataStax Java Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-user+unsubscribe@lists.datastax.com.

Gábor Auth

unread,
Feb 22, 2018, 1:21:36 PM2/22/18
to java-dri...@lists.datastax.com
Hi,

On Thu, Feb 22, 2018 at 6:02 PM Devendra Vishwakarma <vvvv...@gmail.com> wrote:
I am seeing these 5 jars of netty in my project class path and the version is 4.0.47

Upgrade to 4.1.12.Final.

Bye,
Gábor Auth
--
Bye,
Auth Gábor

Devendra Vishwakarma

unread,
Feb 23, 2018, 2:05:37 AM2/23/18
to java-dri...@lists.datastax.com
Thanks Gabor, Adding the below given dependency solved my issue-

<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.12.Final</version>
</dependency>

Devendra

--
Bye,
Auth Gábor

--

Jacques-Henri Berthemet

unread,
Feb 23, 2018, 4:28:18 AM2/23/18
to java-dri...@lists.datastax.com

Hi,

 

Is it safe to use a different Netty version than the one Datastax driver was built/tested with? I thought that was the point of the shaded driver.

 

--

Jacques-Henri Berthemet

--

Bye,

Auth Gábor

To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.

 

--
You received this message because you are subscribed to the Google Groups "DataStax Java Driver for Apache Cassandra User Mailing List" group.

To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.

Andy Tolbert

unread,
Feb 23, 2018, 10:42:30 AM2/23/18
to DataStax Java Driver for Apache Cassandra User Mailing List
Good point Jacques-Henri.  We've done a little bit of testing of Netty 4.1.x with the java driver and it works, but as indicated, most of our testing and development is done against 4.0, so it'd be more advisable to use that.

In this case it looks like this was just something fixed in netty 4.1 and not 4.0.  This is not an actual problem, but more of a noisy DEBUG-level log annoyance though right?

Thanks,
Andy

--

Bye,

Auth Gábor

To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-user+unsubscribe@lists.datastax.com.

 

--
You received this message because you are subscribed to the Google Groups "DataStax Java Driver for Apache Cassandra User Mailing List" group.

To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-user+unsubscribe@lists.datastax.com.

--
You received this message because you are subscribed to the Google Groups "DataStax Java Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-user+unsubscribe@lists.datastax.com.

Jacques-Henri Berthemet

unread,
Feb 23, 2018, 12:07:55 PM2/23/18
to java-dri...@lists.datastax.com

When our QA saw the issue I just silenced the logger rather than use the non-shaded driver, I didnt see any issue beside the log being gone. Were actually using Netty 3.5, 4.1 and 4.0 at the same time, 4.0 is used by the shaded driver. If its safe to use DS driver with 4.1 Id be happy to switch to non-shaded driver.

 

--

Jacques-Henri Berthemet

 

From: java-dri...@lists.datastax.com [mailto:java-dri...@lists.datastax.com] On Behalf Of Andy Tolbert
Sent: Friday, February 23, 2018 4:42 PM
To: DataStax Java Driver for Apache Cassandra User Mailing List <java-dri...@lists.datastax.com>
Subject: Re: java.lang.ClassNotFoundException: jdk.internal.misc.Unsafe

 

Good point Jacques-Henri.  We've done a little bit of testing of Netty 4.1.x with the java driver and it works, but as indicated, most of our testing and development is done against 4.0, so it'd be more advisable to use that.

--

Bye,

Auth Gábor

To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.

 

--
You received this message because you are subscribed to the Google Groups "DataStax Java Driver for Apache Cassandra User Mailing List" group.

To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.

--
You received this message because you are subscribed to the Google Groups "DataStax Java Driver for Apache Cassandra User Mailing List" group.

To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.

 

--
You received this message because you are subscribed to the Google Groups "DataStax Java Driver for Apache Cassandra User Mailing List" group.

To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.

Gábor Auth

unread,
Feb 23, 2018, 1:11:24 PM2/23/18
to java-dri...@lists.datastax.com
Hi,

On Fri, Feb 23, 2018 at 10:28 AM Jacques-Henri Berthemet <jacques-hen...@genesys.com> wrote:

Is it safe to use a different Netty version than the one Datastax driver was built/tested with?


It is not safe... but sometimes there is no other way, for example, the Wildfly 11.0.0 contains version 4.1.x of netty... :/

Bye,
Gábor Auth
--
Bye,
Auth Gábor
Reply all
Reply to author
Forward
0 new messages