NoClassDefFoundError: Could not initialize, class com.google.inject.internal.cglib.core.$ReflectUtils

Dawid Weiss dawid.weiss at gmail.com
Mon Sep 19 12:35:23 UTC 2016


Yes, it prints:

java.lang.reflect.InaccessibleObjectException: Unable to make
protected 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 "exports private java.lang" to unnamed module @4527468c
at java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:414)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:196)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:192)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:186)
at com.google.inject.internal.cglib.core.$ReflectUtils$1.run(ReflectUtils.java:52)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at com.google.inject.internal.cglib.core.$ReflectUtils.<clinit>(ReflectUtils.java:42)
at com.google.inject.internal.cglib.reflect.$FastClass$Generator.getProtectionDomain(FastClass.java:73)
[truncated]

D.

On Mon, Sep 19, 2016 at 2:12 PM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> On 19/09/2016 00:12, Dawid Weiss wrote:
>
>> Guice 4.1.0 throws an exception from within the embedded cglib with
>> this release:
>>
>>> java -version
>>
>> java version "9-ea"
>> Java(TM) SE Runtime Environment (build
>> 9-ea+135-jigsaw-nightly-h5500-20160914)
>> Java HotSpot(TM) 64-Bit Server VM (build
>> 9-ea+135-jigsaw-nightly-h5500-20160914, mixed mode)
>>
>>> [apptest]
>>
>>     > Caused by: java.lang.NoClassDefFoundError: Could not initialize
>> class com.google.inject.internal.cglib.core.$ReflectUtils
>>     >    at
>> com.google.inject.internal.cglib.reflect.$FastClass$Generator.getProtectionDomain(FastClass.java:73)
>>     >    at
>> com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:206)
>>     >    at
>> com.google.inject.internal.cglib.reflect.$FastClass$Generator.create(FastClass.java:65)
>>     >    at
>> com.google.inject.internal.BytecodeGen.newFastClassForMember(BytecodeGen.java:252)
>>     >    at
>> com.google.inject.internal.BytecodeGen.newFastClassForMember(BytecodeGen.java:203)
>>     >    at
>> com.google.inject.internal.DefaultConstructionProxyFactory.create(DefaultConstructionProxyFactory.java:53)
>>     >    at
>> com.google.inject.internal.ProxyFactory.create(ProxyFactory.java:158)
>>     >    at
>> com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:90)
>>     >    at
>> com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:29)
>>     >    at
>> com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:37)
>>     >    at
>> com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:33)
>>     >    at
>> com.google.inject.internal.FailableCache$1.load(FailableCache.java:37)
>>     >    at
>> com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3542)
>>     >    at
>> com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2323)
>>     >    at
>> com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2286)
>>     >    at
>> com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2201)
>>
> Can you run this with -Dsun.reflect.debugModuleAccessChecks=true to see if
> there is any exception thrown?
>
> -Alan


More information about the jigsaw-dev mailing list