Matthias247 / jawampa

Web Application Messaging Protocol (WAMP v2) support for Java
Apache License 2.0
148 stars 56 forks source link

Application throws java.lang.ClassNotFoundException: jdk.internal.misc.Unsafe exception during the creation of the client instance #114

Open henryco opened 6 years ago

henryco commented 6 years ago

Hello everybody. Application throws an exception during the creation of the client instance as in the listing below.

WampClient client;
try {
    WampClientBuilder builder = new WampClientBuilder();
    IWampConnectorProvider connectorProvider = new NettyWampClientConnectorProvider();
    builder.withConnectorProvider(connectorProvider)
            .withUri("wss://api.poloniex.com")
            .withRealm("realm1")
            .withInfiniteReconnects()
            .withReconnectInterval(5, TimeUnit.SECONDS);
    client = builder.build();  // <-- THROWS HERE
} catch (Exception e) {
    return;
}

Exception:

15:13:53.532 [main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework
15:13:53.560 [main] DEBUG io.netty.handler.ssl.OpenSsl - netty-tcnative not in the classpath; OpenSslEngine will be unavailable.
15:13:53.852 [main] DEBUG io.netty.handler.ssl.JdkSslContext - Default protocols (JDK): [TLSv1.2, TLSv1.1, TLSv1] 
15:13:53.854 [main] DEBUG io.netty.handler.ssl.JdkSslContext - Default cipher suites (JDK): [TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA]
15:13:53.867 [main] DEBUG io.netty.util.internal.PlatformDependent0 - -Dio.netty.noUnsafe: false
15:13:53.868 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
15:13:53.869 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
15:13:53.869 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
15:13:53.869 [main] DEBUG io.netty.util.internal.PlatformDependent0 - direct buffer constructor: available
15:13:53.870 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: available, true
15:13:53.873 [main] DEBUG io.netty.util.internal.PlatformDependent0 - 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:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at io.netty.util.internal.PlatformDependent0$6.run(PlatformDependent0.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:288)
    at io.netty.util.internal.PlatformDependent.getSystemClassLoader(PlatformDependent.java:895)
    at io.netty.util.internal.PlatformDependent.isAndroid0(PlatformDependent.java:919)
    at io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:70)
    at io.netty.handler.ssl.util.SimpleTrustManagerFactory$SimpleTrustManagerFactorySpi.engineGetTrustManagers(SimpleTrustManagerFactory.java:138)
    at javax.net.ssl.TrustManagerFactory.getTrustManagers(TrustManagerFactory.java:285)
    at io.netty.handler.ssl.JdkSslClientContext.newSSLContext(JdkSslClientContext.java:290)
    at io.netty.handler.ssl.JdkSslClientContext.<init>(JdkSslClientContext.java:270)
    at io.netty.handler.ssl.SslContext.newClientContextInternal(SslContext.java:770)
    at io.netty.handler.ssl.SslContextBuilder.build(SslContextBuilder.java:446)
    at ws.wamp.jawampa.transport.netty.NettyWampClientConnectorProvider.createConnector(NettyWampClientConnectorProvider.java:113)
    at ws.wamp.jawampa.WampClientBuilder.build(WampClientBuilder.java:127)
    at pl.hitachi.midas.restocker.WampClientTest.main(WampClientTest.java:25)
15:13:53.873 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.DirectByteBuffer.<init>(long, int): available
15:13:53.874 [main] DEBUG io.netty.util.internal.PlatformDependent - Java version: 8
15:13:53.874 [main] DEBUG io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available
15:13:53.874 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: /tmp (java.io.tmpdir)
15:13:53.874 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
15:13:53.875 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
15:13:53.875 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.maxDirectMemory: 3739746304 bytes
15:13:53.875 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.uninitializedArrayAllocationThreshold: -1
15:13:53.876 [main] DEBUG io.netty.util.internal.CleanerJava6 - java.nio.ByteBuffer.cleaner(): available
15:13:53.936 [main] DEBUG io.netty.channel.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 16
15:13:53.967 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false
15:13:53.967 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512
15:13:53.969 [main] DEBUG io.netty.util.internal.PlatformDependent - org.jctools-core.MpscChunkedArrayQueue: available
qyvlik commented 6 years ago

look here https://github.com/netty/netty/issues/6901