[2.8.20] Error on start using Java 17 #11984
-
I just tried running an existing Play 2.8.20 app on Java 17. It's been running on Java 8 just fine, but on Java 17, it gets this error on start. java.lang.ExceptionInInitializerError: Exception com.google.inject.internal.cglib.core.$CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make prote
cted final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does
not "opens java.lang" to unnamed module @6f10d5b6 [in thread "main"]
at com.google.inject.internal.cglib.core.$ReflectUtils.defineClass(ReflectUtils.java:464)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator.generate(AbstractClassGenerator.java:339)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:96)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:94)
at com.google.inject.internal.cglib.core.internal.$LoadingCache$2.call(LoadingCache.java:54)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at com.google.inject.internal.cglib.core.internal.$LoadingCache.createEntry(LoadingCache.java:61)
at com.google.inject.internal.cglib.core.internal.$LoadingCache.get(LoadingCache.java:34)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:119)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:294)
at com.google.inject.internal.cglib.core.$KeyFactory$Generator.create(KeyFactory.java:221)
at com.google.inject.internal.cglib.core.$KeyFactory.create(KeyFactory.java:174)
at com.google.inject.internal.cglib.core.$KeyFactory.create(KeyFactory.java:157)
at com.google.inject.internal.cglib.core.$KeyFactory.create(KeyFactory.java:149)
at com.google.inject.internal.cglib.core.$KeyFactory.create(KeyFactory.java:145)
at com.google.inject.internal.cglib.core.$MethodWrapper.<clinit>(MethodWrapper.java:23)
at com.google.inject.internal.cglib.core.$DuplicatesPredicate.evaluate(DuplicatesPredicate.java:104)
at com.google.inject.internal.cglib.core.$CollectionUtils.filter(CollectionUtils.java:52)
at com.google.inject.internal.cglib.reflect.$FastClassEmitter.<init>(FastClassEmitter.java:69)
at com.google.inject.internal.cglib.reflect.$FastClass$Generator.generateClass(FastClass.java:77)
at com.google.inject.internal.cglib.core.$DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator.generate(AbstractClassGenerator.java:332)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:96)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:94)
at com.google.inject.internal.cglib.core.internal.$LoadingCache$2.call(LoadingCache.java:54)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at com.google.inject.internal.cglib.core.internal.$LoadingCache.createEntry(LoadingCache.java:61)
at com.google.inject.internal.cglib.core.internal.$LoadingCache.get(LoadingCache.java:34)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:119)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:294)
at com.google.inject.internal.cglib.reflect.$FastClass$Generator.create(FastClass.java:65)
at com.google.inject.internal.BytecodeGen.newFastClassForMember(BytecodeGen.java:258)
at com.google.inject.internal.BytecodeGen.newFastClassForMember(BytecodeGen.java:207)
at com.google.inject.internal.ProviderMethod.create(ProviderMethod.java:69)
at com.google.inject.internal.ProviderMethodsModule.createProviderMethod(ProviderMethodsModule.java:327)
at com.google.inject.internal.ProviderMethodsModule.getProviderMethods(ProviderMethodsModule.java:135)
at com.google.inject.internal.ProviderMethodsModule.configure(ProviderMethodsModule.java:105)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:347)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:356)
at com.google.inject.AbstractModule.install(AbstractModule.java:103)
at ___Module.configure(___Module.java:13)
at com.google.inject.AbstractModule.configure(AbstractModule.java:61)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:347)
at com.google.inject.AbstractModule.install(AbstractModule.java:103)
at ___Module.configure(___Module.java:27)
at com.google.inject.AbstractModule.configure(AbstractModule.java:61)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:347)
at com.google.inject.AbstractModule.install(AbstractModule.java:103)
at ___Module.configure(___Module.java:18)
at com.google.inject.AbstractModule.configure(AbstractModule.java:61)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:347)
at com.google.inject.AbstractModule.install(AbstractModule.java:103)
at ___Module.configure(___Module.java:12)
at com.google.inject.AbstractModule.configure(AbstractModule.java:61)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:347)
at com.google.inject.spi.Elements.getElements(Elements.java:104)
at com.google.inject.util.Modules$OverrideModule.configure(Modules.java:214)
at com.google.inject.AbstractModule.configure(AbstractModule.java:61)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:347)
at com.google.inject.spi.Elements.getElements(Elements.java:104)
at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:137)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:105)
... 8 more And I haven't been able to figure out where I should start to debug this. Does anyone know more about this error? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I did more digging and looks like it's an issue caused by the repackaged cglib used by Guice, but Guice 5.0.1 seems to have removed cglib, and Play 2.8.20 seems to be using Guice 6.0.0. |
Beta Was this translation helpful? Give feedback.
-
yep, cf. https://github.com/Squoss/Fixadat/blob/main/beapi/build.sbt#L24 |
Beta Was this translation helpful? Give feedback.
To run Play 2.8 on Java 17 you have to make some adjustments, please see: https://github.com/playframework/playframework/releases/tag/2.8.15#user-content-java17
However, just two days ago the Play 2.9 release candidae was published which supports Java 17 and even Java 21 out of the box, I recommend upgrading to Play 2.9 therefore, please see: https://github.com/playframework/playframework/releases/tag/2.9.0-RC2