Error while creating instance

[email protected]
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
I wrote my own class loader which changes classes of a certain type when
loaded. The change works fine, however I have a problem with reflection. The
framework I'm writing creates instances by reflection. The weird thing is that
I'm able to create up to 16 new instances of the changed class, using
class.newInstance(), and then it fails with the following exception:

java.lang.IllegalAccessError: class sun.reflect.GeneratedConstructorAccessor2
cannot access its superclass sun.reflect.ConstructorAccessorImpl
	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.generateConstructor(MethodAccessorGenerator.java:76)
	at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:30)
	at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at java.lang.Class.newInstance0(Class.java:355)
	at java.lang.Class.newInstance(Class.java:308)
...

I couldn't find much on this error on the net. It only happens when the class
is changed by my classloader using asm. I'm hoping someone here can shed some
light on this and how to solve it.

Thanks,

Shai
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.