VOOZH about

URL: https://www.ibm.com/support/pages/apar/IV86965

⇱ IV86965: JAVA.LANG.EXCEPTIONININITIALIZERERROR WITH IBM JAVA AFTER SWITCH TO ORG.APACHE.COMMONS.LANG3


IV86965: JAVA.LANG.EXCEPTIONININITIALIZERERROR WITH IBM JAVA AFTER SWITCH TO ORG.APACHE.COMMONS.LANG3

APAR status

  • Closed as program error.

Error description

  • Error Message: Making changes to use org.apache.commons.lang3
    has caused java.lang.ExceptionInInitializerError with IBM java
    8. But it works with openjdk 1.8.
    .
    Stack Trace: Exception in thread "main"
    java.lang.ExceptionInInitializerError
     at
    java.lang.J9VMInternals.ensureError(J9VMInternals.java:137)
     at
    java.lang.J9VMInternals.recordInitializationFailure(J9VMInternal
    s.java:126)
     at
    org.apache.commons.lang3.SerializationUtils.clone(SerializationU
    tils.java:88)
     at commonslang3$1.childValue(commonslang3.java:10)
     at commonslang3$1.childValue(commonslang3.java:1)
     at
    java.lang.ThreadLocal$ThreadLocalMap.<init>(ThreadLocal.java:404
    )
     at
    java.lang.ThreadLocal$ThreadLocalMap.<init>(ThreadLocal.java:311
    )
     at
    java.lang.ThreadLocal.createInheritedMap(ThreadLocal.java:268)
     at java.lang.Thread.initialize(Thread.java:326)
     at java.lang.Thread.<init>(Thread.java:297)
     at java.lang.Thread.<init>(Thread.java:160)
     at commonslang3.main(commonslang3.java:23)
    Caused by: java.lang.NullPointerException
     at
    org.apache.commons.lang3.SerializationUtils$ClassLoaderAwareObje
    ctInputStream.<init>(SerializationUtils.java:300)
     at
    org.apache.commons.lang3.SerializationUtils.clone(SerializationU
    tils.java:88)
     at commonslang3$1.childValue(commonslang3.java:10)
     at commonslang3$1.childValue(commonslang3.java:1)
     at
    java.lang.ThreadLocal$ThreadLocalMap.<init>(ThreadLocal.java:404
    )
     at
    java.lang.ThreadLocal$ThreadLocalMap.<init>(ThreadLocal.java:311
    )
     at
    java.lang.ThreadLocal.createInheritedMap(ThreadLocal.java:268)
     at java.lang.Thread.initialize(Thread.java:326)
     at java.lang.Thread.<init>(Thread.java:297)
     at java.lang.Thread.<init>(Thread.java:205)
     at java.io.ClassCache$Reaper.<init>(ClassCache.java:208)
     at
    java.io.ClassCache$CreateReaperAction.run(ClassCache.java:199)
     at
    java.io.ClassCache$CreateReaperAction.run(ClassCache.java:188)
     at
    java.security.AccessController.doPrivileged(AccessController.jav
    a:594)
     at java.io.ClassCache.<init>(ClassCache.java:54)
     at
    java.io.ObjectInputStream.<clinit>(ObjectInputStream.java:297)
     ... 10 more
    .
    Running the following simple Java test case can reproduce the
    problem.
    import java.util.Properties;
    import org.apache.commons.lang3.SerializationUtils;
    public class commonslang3 {
     static InheritableThreadLocal<Properties> localProperties =
    new InheritableThreadLocal<Properties>() {
     protected Properties childValue(Properties parent) {
     System.out.println("in clone");
     return (Properties) SerializationUtils.clone(parent);
     }
     protected Properties initialValue() {
     return new Properties();
     }
     };
     public static void main(String<OSB><CSB> args) {
     Properties x = new Properties();
     x.put("test", "value");
     localProperties.set(x);
    
     Thread t = new Thread(new Runnable() {
    
     @Override
     public void run() {
     Properties p = localProperties.get();
     System.out.println("t: " + p);
     }
     });
     t.start();
     localProperties.get().put("test2", "value2");
     Properties p = localProperties.get();
     System.out.println(p);
     }
    }
    

Local fix

  • Adding java option -Dcom.ibm.enableClassCaching=false to disable
    class caching can bypass it.
    

Problem summary

  • SerializationUtils is a class from third-part library
    commons-lang3.
    As part of the clinit of
    SerializationUtils$ClassLoaderAwareObjectInputStream, it does
    the clinit of its parent class ObjectInputStream. While doing
    the clinit of ObjectInputStream, it in turn calls
    SerializationUtils.clone and result in creating an instance of
    SerlizationUtil$ClassLoaderAwareObjectInoutStream even though
    its class initialization is not completed. As a result the
    static field in
    SerializtionUtil$ClassLoaderAwareObjectInputStream
    (primitiveTypes) is not initialized by the time its instance try
    to access it which results in the NPE.
    

Problem conclusion

  • Lazy initialization is made to avoid creating an instance of
    SerlizationUtil$ClassLoaderAwareObjectInoutStream again before
    finishing the clinit.
    .
    This APAR will be fixed in the following Java Releases:
     8 SR3 (8.0.3.0)
    .
    Contact your IBM Product's Service Team for these Service
    Refreshes and Fix Packs.
    For those running stand-alone, information about the available
    Service Refreshes and Fix Packs can be found at:
     https://www.ibm.com/developerworks/java/jdk/
    

Temporary fix

  • N/A
    

Comments

APAR Information

  • APAR number

    IV86965

  • Reported component name

    JAVA CLASS LIBS

  • Reported component ID

    620700130

  • Reported release

    800

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2016-07-14

  • Closed date

    2016-07-25

  • Last modified date

    2016-07-25

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    JAVA CLASS LIBS

  • Fixed component ID

    620700130

Applicable component levels

  • R800 PSY

       UP

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSNVBF","label":"Runtimes for Java Technology"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"8.0","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
21 February 2022