NoClassDef error when trying to preload additional class in systemDirectory::initialize_preloaded_classes()

David Holmes david.holmes at oracle.com
Mon Jun 10 23:09:41 PDT 2013


What version of hotspot are you building? If it is current sources then 
you will need a JDK7 import JDK or even JDK8. You can't take current 
hotspot and place into a 6u JDK for example.

David

On 9/06/2013 6:06 AM, Xiaoran Wang wrote:
> To followup, I tried to put foo/bar.class into $JAVA_HOME/jre/classes, now
> the linux_amd64_compiler2/product/test_gamma passed without error, but
> another error occured from linux_amd64_compiler2/jvmg/test_gamma, which is
> even more confusing.
>
> cd linux_amd64_compiler2/jvmg && ./test_gamma
> java full version "1.6.0_22-b04"
> Using java runtime at: /home/Documents/tools/hotspot-working-dir/java/jre
> Error occurred during initialization of VM
> java.lang.NoSuchMethodException: java.lang.reflect.Method.invoke
>
>
> Can someone shed some light please?
>
>
> On Sat, Jun 8, 2013 at 12:32 PM, Xiaoran Wang <xiaoran at x1a0ran.com> wrote:
>
>> Hi all,
>>
>> I'm instrumenting the hotspot JVM for research purposes and one of the
>> steps is to preload some classes during JVM startup time so that I can use
>> its KlassOop/KlassHandle later in the template Interpreter.
>>
>> I appended the new classes I wanted to load in systemDirectory.hpp, e.g.
>>   *template(bar_klass,                foo_bar,             Pre) \*
>> And its corresponding symbol in vmSymbols.hpp
>> *template(foo_bar, "foo/bar")\*
>>
>> Then I put foo/bar.class into the corresponding rt.jar that will be used
>> to build libjvm.so.
>>
>> However, when I built it, the "gamma" test always gives me an
>> NoClassDefFoundError.
>>
>> cd linux_amd64_compiler2/product && ./test_gamma
>> java full version "1.6.0_22-b04"
>> Using java runtime at: /home/Documents/tools/hotspot-working-dir/java/jre
>> Error occurred during initialization of VM
>> java/lang/NoClassDefFoundError: foo/bar
>>
>>
>> So my question is where should I put my custom class so that it can be
>> preloaded during JVM startup in
>> systemDirectory::initialize_preloaded_classes?
>>
>> btw, I verified the rt.jar is the one JVM is loading because I tried to
>> remove java/lang/Object from it and it complained about missing that class
>> as well.
>>
>> Thank you
>> Xiaoran
>>


More information about the hotspot-dev mailing list