Migration to play framework 2.6 brings java.lang.ClassNotFoundException: jdk.internal.misc.Unsafe

1.4k views Asked by At

Tried to migrate to new play version 2.6.3 but after migration on start of the application I have exception like the following:

[DEBUG] p.s.a.i.n.u.i.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 java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at play.shaded.ahc.io.netty.util.internal.PlatformDependent0$6.run(PlatformDependent0.java:290)
        at java.security.AccessController.doPrivileged(Native Method)
        at play.shaded.ahc.io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:283)
        at play.shaded.ahc.io.netty.util.internal.PlatformDependent.getSystemClassLoader(PlatformDependent.java:637)
        at play.shaded.ahc.io.netty.util.internal.PlatformDependent.isAndroid0(PlatformDependent.java:661)
        at play.shaded.ahc.io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:65

Will be really great to get some ideas how to fix it.

2

There are 2 answers

6
Igmar Palsenberg On

Why are you creating a manual instance of the WS client ? You should simply @Inject WSClient, and use that.

0
AVINASH SHRIMALI On

As per the link: https://github.com/netty/netty/issues/6855, upgrading netty version to 4.1.12.Final will fix this issue. I was also facing the similar issue got fixed after upgrading to 4.1.14.Final.