Name: gm110360 Date: 08/29/2002
FULL PRODUCT VERSION :
java version "1.4.1-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-rc-b19)
Java HotSpot(TM) Client VM (build 1.4.1-rc-b19, mixed mode)
Bug also present in 1.4.0_001 b03
FULL OPERATING SYSTEM VERSION :
Windows NT Version 4.0 SP 6
A DESCRIPTION OF THE PROBLEM :
com.sun.jdi.VirtualMachine.redefineClasses gives a
java.lang.ClassFormatError: class not in class file format
at
com.sun.tools.jdi.VirtualMachineImpl.redefineClasses(VirtualMachineImpl.java:290)
when trying to redefine a class that was loaded by a custom
class loader. In my case the class was class
hxx.mud.wizard.dix.Castle (loaded by instance of
hxx.mud.base.UpdateClassLoader(id=997)) where the
UpdateClassLoader extends java.net.URLClassLoader and does
not add further functionality in my test case.
Redefining works fine when the class to be redefined is in
the JVM classpath and loaded with the system class loader.
This proves that the classfile is _not_ broken.
This Exception should not happen at all if HotSwap class
file replacement would work as documented. There is no
mention in the documentation that class reloading only works
with the system class loader.
If custom class loaders need make special provisions to
support class file replacement this should be documented.
If this behaviour cannot be fixed this should be documented
and the exception should be changed to
java.lang.UnsupportedOperationException or
java.lang.IllegalStateException since the
java.lang.ClassFormatError is totally misleading.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a "test" application that uses a custom class
loader to load an additional class.
2. Create a "debugger" application that lauches the test
application via com.sun.jdi.connect.LaunchingConnector.
3. The debugger must then be triggered to redefine the
loaded class.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected: class is reloaded
Actual: exception is thrown, class is not reloaded
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.ClassFormatError: class not in class file format
at
com.sun.tools.jdi.VirtualMachineImpl.redefineClasses(VirtualMachineImpl.java:290)
at hxx.mud.loader.Loader.reload(Loader.java:125)
at hxx.mud.loader.Loader.access$000(Loader.java:30)
at hxx.mud.loader.Loader$1.actionPerformed(Loader.java:138)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
at [usual Swing stack trace deleted]
REPRODUCIBILITY :
This bug can be reproduced always.
(Review ID: 163765)
======================================================================