RFR: 8243290: Improve diagnostic messages for class verification and redefinition failures

Poonam Parhar poonam.bajaj at oracle.com
Tue Jun 9 14:46:35 UTC 2020


Hello,

Please review this simple change for improving diagnostics around class 
verification and linking failures:

Bug: https://bugs.openjdk.java.net/browse/JDK-8243290
Webrev: http://cr.openjdk.java.net/~poonam/8243290/webrev.00/

Problem: During the class redefinition process, if a class verification 
fails because it could not find a class referenced in the class being 
redefined, the printed NoClassDefFoundError error message is not very 
helpful. It does not print the class name for which NoClassDefFoundError 
was encountered, and that makes it very hard to find the real cause of 
redefinition failure.

The proposed solution prints the class name during class linking and 
verification failures. Example output produced with these changes:

With 'redefine' tag:

      [java] [3.243s][debug][redefine,class,load        ] loaded name=org.apache.commons.logging.impl.Jdk14Logger (avail_mem=819540K)
      [java] [3.243s][debug][redefine,class,load        ] loading name=org.apache.commons.logging.impl.Log4JLogger kind=101 (avail_mem=819540K)
      [java] [3.244s][info ][redefine,class,load,exceptions] link_class exception: 'java/lang/NoClassDefFoundError org/apache/log4j/Priority'
      [java] Java Result: 1

With 'verification' tag:

      [java] [49.702s][info ][verification] Verification for org.apache.commons.logging.impl.Log4JLogger has exception pending 'java.lang.NoClassDefFoundError org/apache/log4j/Priority'
      [java] [49.702s][info ][verification] End class verification for: org.apache.commons.logging.impl.Log4JLogger


Improved error message:

      [java] Exception in thread "main" java.lang.InternalError: class redefinition failed: invalid class
      [java]     at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)
      [java]     at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:167)
      [java]     at Main.main(Unknown Source)


Thanks,
Poonam



More information about the hotspot-runtime-dev mailing list