NoClassDef error when trying to preload additional class in systemDirectory::initialize_preloaded_classes()
Christian Thalinger
christian.thalinger at oracle.com
Tue Jun 11 19:19:44 PDT 2013
On Jun 11, 2013, at 2:06 PM, Xiaoran Wang <xiaoran at x1a0ran.com> wrote:
> I'm building openjdk 7u6 with ALT_BOOTDIR set to jdk7u21 downloaded from
> java.com, but it still gave me weird build errors. So I removed all my
> changes, and only added one symbol to vmSymbol.hpp, and then it gave me an
> error again.
>
> added line:vmSymbol.hpp
> template(foo_bar, "foo/bar") \
>
> cd linux_amd64_compiler2/product && ./test_gamma
> Using java runtime at: /usr/lib/jvm/jdk1.7.0_21/jre
That's a long standing problem which we fixed in the 8 repositories: test_gamma runs with the boot JDK.
In your case you are trying to run a HotSpot version from 7u6 with a 7u21 JDK. Mix-and-match is not supported and may lead to problems like this.
-- Chris
> Error occurred during initialization of VM
> java.lang.InternalError
> at sun.misc.Launcher.getFileURL(Launcher.java:463)
> at sun.misc.Launcher$ExtClassLoader.getExtURLs(Launcher.java:192)
> at sun.misc.Launcher$ExtClassLoader.<init>(Launcher.java:164)
> at sun.misc.Launcher$ExtClassLoader$1.run(Launcher.java:148)
> at sun.misc.Launcher$ExtClassLoader$1.run(Launcher.java:142)
> at java.security.AccessController.doPrivileged(Native Method)
> at sun.misc.Launcher$ExtClassLoader.getExtClassLoader(Launcher.java:141)
> at sun.misc.Launcher.<init>(Launcher.java:71)
> at sun.misc.Launcher.<clinit>(Launcher.java:57)
> at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1486)
> at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1468)
>
> So where seems to be the problem?
>
>
>
>
> On Mon, Jun 10, 2013 at 11:09 PM, David Holmes <david.holmes at oracle.com>wrote:
>
>> 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