IZ76271: CLASS.FORNAME THROWS CLASSNOTFOUNDEXCEPTION WHEN REFLECTED AND J IT-COMPILED
Closed as program error.
Error Message: A ClassNotFoundException is thrown (and re-thrown inside an InvocationTargetException) when Class.forName is called via reflection and the associated GeneratedMethodAccessorXXX.invoke method is compiled by the just-in-time compiler. XXX could be any number (depending on the number of reflected objects in the application). This problem could occur in both Java 5 and Java 6. . Stack Trace: java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethod AccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at LoadingClass.test(LoadingClass.java:18) ... 4 more Caused by: java.lang.ClassNotFoundException: hw at java.lang.Class.forNameImpl(Native Method) at java.lang.Class.forName(Class.java:130) ... 8 more .
This issue can be worked around using the -Xjit:disableInliningOfNatives option.
The problem is caused by an optimization in the JIT compiler that attempts to speed up class loading. The optimization contains a bug which causes the compiled code to use an incorrect class loader when Class.forName is invoked.
This defect will be fixed in: 5.0.0 SR12 6.0.0 SR9 . The JIT compiler has been updated to produce correct code when performing this optimization. . To obtain the fix: Install build 20100529 or later
Reported component name
JAVA 5 JIT
Reported component ID
Last modified date
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fixed component name
JAVA 5 JIT
Fixed component ID
Applicable component levels