Cannot access class jdk.internal.misc.Unsafe running Play 2.7.2 with Java 11

Viewed 2792

I am trying to run a play application on java 11, I get the following error:

java.lang.IllegalAccessException: class play.shaded.ahc.io.netty.util.internal.PlatformDependent0$6 cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @3f5156a6

According to this issue https://github.com/playframework/playframework/issues/8566, this is supposed to be fixed with 2.7.x

But my play application runs on v2.7.2 Am I doing stuff wrong, or did I stumble on a bug?

I should note that the application still runs, just that on startup, and log level is debug, it shows the above error.

Any suggestions on how to git rid of this (without having to move back to Java 8)

1 Answers

Add these VM options:

--add-opens java.base/jdk.internal.misc=ALL-UNNAMED
-Dio.netty.tryReflectionSetAccessible=true
Related