IBM Support

NullPointerException in WAS v9.0 launchClient due to multithreaded application

Troubleshooting


Problem

A multithreaded Java EE application client is unable to instantiate a class or create an object of class in a Java for loop.
The launchClient is used to start the client application.  This problem occurs on WAS v9.0.x, but does not occur on WAS v8.5.5.x
Here is the generated NullPointerException...
Exception in thread "Thread_0" java.lang.NullPointerException
       at org.eclipse.osgi.internal.loader.BundleLoader.findDynamicSource(BundleLoader.java:1169)
       at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:469)
       at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
       at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
       at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
       at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:838)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:825)
       at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:134)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:805)
       at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:145)
       at org.apache.log4j.Category.forcedLog(Category.java:372)
       at org.apache.log4j.Category.fatal(Category.java:363)
...

Cause

The use of unmanaged threads is not fully supportable in the launchClient runtime on WAS v9.0.x

Resolving The Problem

The NullPointerException is most likely the result of the launchClient process ending and the stopping of the OSGi framework.  This can occur when the client is using unmanaged threads.
The use of unmanaged threads is not fully supportable in the launchClient runtime on WAS v9.0.
Explicit stopping of the OSGi framework in WAS v9.0 is by design.  Applications that relied on the client runtime's previous failure to terminate (as was the case in WAS v8.5.5) will need to modify their main client class to stay active (thus keeping the WAS client runtime and its OSGi framework active) rather than simply exiting and relying on spawned threads to perform work.

Document Location

Worldwide

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"ARM Category":[],"Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.0","Edition":"Network Deployment;Base","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
15 April 2020

UID

ibm16152637