Debug NoClassDefFoundError
forax at univ-mlv.fr
forax at univ-mlv.fr
Mon May 17 16:57:48 UTC 2021
----- Mail original -----
> De: "Christian Beikov" <christian.beikov at gmail.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "hotspot-dev" <hotspot-dev at openjdk.java.net>
> Envoyé: Lundi 17 Mai 2021 18:40:49
> Objet: Re: Debug NoClassDefFoundError
> Am 17.05.2021 um 18:27 schrieb Remi Forax:
>> ----- Mail original -----
>>> De: "Christian Beikov" <christian.beikov at gmail.com>
>>> À: "hotspot-dev" <hotspot-dev at openjdk.java.net>
>>> Envoyé: Lundi 17 Mai 2021 18:19:19
>>> Objet: Debug NoClassDefFoundError
>>> Hi,
>>>
>>> not sure if this is the right place to ask, so if I am wrong, please let
>>> me know where to ask this.
>>>
>>> I have a very strange problem with a generated class defined dynamically
>>> into a module through `MethodHandles.Lookup.defineClass`. When I try to
>>> instantiate it, I get a `java.lang.NoClassDefFoundError: Could not
>>> initialize class ...` without any further context:
>>>
>>>
>>> at
>>> java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>> Method)
>>> at
>>> java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>>> at
>>> java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>>> at
>>> java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
>>>
>>> Does anyone know how to further debug this? I was trying to find
>>> instructions for debugging the JVM itself but couldn't so far.
>> Usually is an exception inside the static block by example the block static
>> itself not being able to load a class, that is swallowed,
>> putting a giant try/catch(Throwable) around the static block may help.
>
> I just tried throwing an exception in a static initializer and that
> looks different. In that case, I see where the exception comes from in
> the stack trace.
I was taking about exceptions raised by the VM not the one raised by a Java code.
Rémi
More information about the hotspot-dev
mailing list