Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Wierd java.lang.NoClassDefFoundError: sun/reflect/MethodAccessorImpl error

843811Jul 28 2002 — edited Aug 9 2007
I have just upgraded to j2sdk1.4.0_01 and are running it under WinXP.

I have recompiled my code without errors using the new jdk.

I am using reflection and do multiple consecutive calls to invoke on an object of type java.lang.reflect.Method.

Everytime I call a specific method a 5th time I get the following exception. It doesn't matter which method I call just if it is invoked for the 5th time.

java.lang.NoClassDefFoundError: sun/reflect/MethodAccessorImpl
at sun.misc.Unsafe.defineClass(Native Method)
at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:45)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381)
at java.security.AccessController.doPrivileged(Native Method)
at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:377)
at sun.reflect.MethodAccessorGenerator.generateMethod(MethodAccessorGenerator.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:28)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
.
.
.

Conclusion.. there must be a bug in jdk1.4 regarding reflection?! Why does it take 5 invokation of a method before this exeception is thrown? Why does it work just fine the first 4 invokations? I don't know how the internals on Method.invoke works but something tells me that on the fifth invokation something diffrent is done.

Happy for any suggestions.. really would like to have my code working under jdk1.4. Only suggestions to similar errors found on the net is to downgrade to jdk1.3.1 but I don't think that is the way to solv a problem. I want to find the root of this problem.

-Thomas �hlen
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 6 2007
Added on Jul 28 2002
16 comments
6,738 views