Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8243290

Improve diagnostic messages for class verification and redefinition failures


    • Subcomponent:
    • Resolved In Build:



        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 clear. It does not print the class for which NoClassDefFoundError was encountered.

        For example, in the verification and redefinition logs from a test program below, the class being redefined is Log4JLogger, and the logs seem to imply that it is Log4JLogger class for which NoClassDefFoundError exception was thrown.

        Verification log:

             [java] [11.040s][info][verification] Verifying class org.apache.commons.logging.impl.Jdk14Logger with old format
             [java] [11.040s][info][verification] End class verification for: org.apache.commons.logging.impl.Jdk14Logger
             [java] [11.040s][info][verification] Verifying class org.apache.commons.logging.impl.Log4JLogger with old format
             [java] [11.041s][info][verification] Verification for org.apache.commons.logging.impl.Log4JLogger has exception pending java.lang.NoClassDefFoundError
             [java] [11.041s][info][verification] End class verification for: org.apache.commons.logging.impl.Log4JLogger
             [java] Exception in thread "main" java.lang.InternalError
             [java] at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)
             [java] Java Result: 1

        redefine log:

             [java] [2.268s][debug][redefine,class,load ] loaded name=org.apache.commons.logging.impl.Jdk14Logger (avail_mem=501232K)
             [java] [2.268s][debug][redefine,class,load ] loading name=org.apache.commons.logging.impl.Log4JLogger kind=101 (avail_mem=501232K)
             [java] [2.270s][info ][redefine,class,load,exceptions] link_class exception: 'java/lang/NoClassDefFoundError'
             [java] Exception in thread "main" java.lang.InternalError
             [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)
             [java] Java Result: 1

        A more detailed level logging prints the actual class name for which NoClassDefFoundError was thrown.

        [java] 433 Initializing 'java/lang/NoClassDefFoundError'(no method) (0x00000007c0004948)
        [java] RESOLVE java.lang.NoClassDefFoundError java.lang.LinkageError NoClassDefFoundError.java:59
        [java] JVM JVM_FillInStackTrace
        [java] Exception <a 'java/lang/NoClassDefFoundError': org/apache/log4j/Priority> (0x000000076af8ce58)
        [java] thrown [/Users/java_re/workspace/8-2-build-macosx-x86_64/jdk8u151/9699/hotspot/src/share/vm/classfile/systemDictionary.cpp, line 199]
        [java] for thread 0x00007fc9f9002800
        [java] JVM JVM_GetClassNameUTF

        The objective of this enhancement is to print the exception message along with the exception name during a class verification and redefinition failure.


            Issue Links



                • Assignee:
                  poonam Poonam Bajaj Parhar
                  poonam Poonam Bajaj Parhar
                • Votes:
                  0 Vote for this issue
                  7 Start watching this issue


                  • Created: