JDK-8209194 : [AOT] NoClassDefFoundError are NOT caught
Type:Bug
Component:hotspot
Sub-Component:compiler
Affected Version:10,11,12
Priority:P3
Status:Closed
Resolution:Duplicate
Submitted:2018-08-09
Updated:2023-07-21
Resolved:2023-07-21
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
please check comments section for steps to reproduce.
Comments
Okay, thanks Igor.
17-08-2018
Yes, anything that throws NoClassDefFoundError instead of some other expected exception is the same problem (99%) - exceptions are not propagated property from static initializers.
16-08-2018
RULE "lang/STMT/stmt190/stmt19002/stmt19002_rt" any any
ExceptionInInitializerError is not caught.
16-08-2018
RULE "vm/concepts/execution/execution015/execution01502m1/execution01502m1" Exception java.lang.NoClassDefFoundError: Could not initialize class javasoft.sqe.tests.vm.concepts.execution.execution015.execution01502m1.execution01502m1a
RULE "vm/concepts/execution/execution015/execution01502m1/execution01502m1" ExitCode 1
16-08-2018
please check whether https://bugs.openjdk.java.net/browse/JDK-8209568 is duplicate of this bug or else reopen https://bugs.openjdk.java.net/browse/JDK-8209568
16-08-2018
Probably another instance of this issue: JDK-8209568
Igor, could you verify that this is the same problem? Thanks.
16-08-2018
RULE "vm/constantpool/loadingConstraints/loadingConstraints001/loadingConstraints00101/loadingConstraints00101" any any
RULE "vm/constantpool/loadingConstraints/loadingConstraints002/loadingConstraints00201/loadingConstraints00201" any any
RULE "vm/constantpool/loadingConstraints/loadingConstraints003/loadingConstraints00302/loadingConstraints00302" any any
RULE "vm/constantpool/loadingConstraints/loadingConstraints003/loadingConstraints00304m1/loadingConstraints00304m1" any any
RULE "vm/constantpool/loadingConstraints/loadingConstraints003/loadingConstraints00304m2/loadingConstraints00304m2" any any
RULE "vm/constantpool/loadingConstraints/loadingConstraints004/loadingConstraints00401m1/loadingConstraints00401m1" any any
RULE "vm/constantpool/loadingConstraints/loadingConstraints004/loadingConstraints00404m1/loadingConstraints00404m1" any any
RULE "vm/constantpool/loadingConstraints/loadingConstraints004/loadingConstraints00404m2/loadingConstraints00404m2" any any
RULE "vm/constantpool/loadingConstraints/loadingConstraints004/loadingConstraints00404m3/loadingConstraints00404m3" any any
RULE "vm/constantpool/loadingConstraints/loadingConstraints004/loadingConstraints00404m4/loadingConstraints00404m4" any any
RULE "vm/constantpool/loadingConstraints/loadingConstraints004/loadingConstraints00404m5/loadingConstraints00404m5" any any
RULE "vm/constantpool/loadingConstraints/loadingConstraints004/loadingConstraints00404m6/loadingConstraints00404m6" any any
RULE "vm/constantpool/loadingConstraints/loadingConstraints005/loadingConstraints00501/loadingConstraints00501" any any
RULE "vm/constantpool/loadingConstraints/loadingConstraints005/loadingConstraints00502m1/loadingConstraints00502m1" any any
RULE "vm/constantpool/loadingConstraints/loadingConstraints005/loadingConstraints00502m2/loadingConstraints00502m2" any any
RULE "vm/constantpool/loadingConstraints/loadingConstraints005/loadingConstraints00502m3/loadingConstraints00502m3" any any
RULE "vm/constantpool/loadingConstraints/loadingConstraints006/loadingConstraints00603/loadingConstraints00603" any any
RULE "vm/constantpool/loadingConstraints/loadingConstraints006/loadingConstraints00605/loadingConstraints00605" any any
RULE "vm/concepts/exceptions/exceptions010/exceptions01001/exceptions01001" Exception java.lang.NoClassDefFoundError: Could not initialize class javasoft.sqe.tests.vm.concepts.exceptions.exceptions010.exceptions01001.BadClass
RULE "vm/concepts/exceptions/exceptions010/exceptions01001/exceptions01001" ExitCode 1
RULE "vm/concepts/execution/execution081/execution08102m1/execution08102m1" any any
RULE "vm/concepts/execution/execution081/execution08104m1/execution08104m1" any any
RULE "vm/concepts/execution/execution081/execution08105m1/execution08105m1" any any
RULE "vm/constantpool/arrayClasses/arrayClasses002/arrayClasses00201m1/arrayClasses00201m1" Exception java.lang.NoClassDefFoundError: Could not initialize class javasoft.sqe.tests.vm.constantpool.arrayClasses.arrayClasses002.arrayClasses00201m1.arrayClasses00201m12
JCK Test Case: JCK-runtime-11/tests/vm/instr/getstatic/getstatic013/getstatic01301m1/getstatic01301m1.html
Steps to reproduce
====================
1. download JDK11 Igor internal build
2. set JAVA_HOME and PATH to point to JDK11 build accordingling
3. create java.base aot library using the following command
jaotc -J-Xmx7g --compile-for-tiered --info --compile-commands base.txt --output solibs/rameshbase.so --module java.base
4. download and extract the attachment vmgetstatic.zip into the current folder.
5. create AOT Library for testcases using the following command
contents of compilecommands/vmgetstatic.txt
===========================================
compileOnly c.*
jaotc -J-Xmx4g --info -J-cp -Jvmgetstatic --compile-commands compilecommands/vmgetstatic.txt --output solibs/vmgetstatic.so --directory vmgetstatic
SCENARIO 1: Without AOTLibrary, NormalRun
===================================================================
[root@llg00fyn ramesh]# java -cp vmgetstatic c.getstatic01301m1
[root@llg00fyn ramesh]#
ACTUAL OUTPUT: None
EXPECTED OUTPUT: None
SCENARIO 2: With AOTLibrary for testclasses + java.base AOTLibrary
===================================================================
java -XX:+UnlockDiagnosticVMOptions -XX:+PrintAOT -XX:+UseAOTStrictLoading -XX:AOTLibrary="solibs/vmgetstatic.so,solibs/rameshbase.so" -cp vmgetstatic c.getstatic01301m1 > getstaticlog.txt
attachment contains getstaticlog.txt
SCENARIO 3: With AOTLibrary, PrintAOT is turned off.
===============================================
[root@llg00fyn ramesh]# java -XX:+UnlockDiagnosticVMOptions -XX:+UseAOTStrictLoading -XX:AOTLibrary="solibs/vmgetstatic.so,solibs/rameshbase.so" -cp vmgetstatic c.getstatic01301m1
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class c.getstatic01301m1a
at c.getstatic01301m1.run(getstatic01301m1.java:13)
at c.getstatic01301m1.main(getstatic01301m1.java:9)
ACTUAL OUTPUT: NoClassDefFoundError exception is thrown.
EXPECTED OUTPUT: No exception should be thrown.