Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
3.1.6
-
None
-
Oracle JDK 1.8 (Update 91), not tested with other environments.
-
Unknown
Description
Placing the basic CXF libraries into a directory and calling a java program with -Djava.endorsed.dirs=<selected_dir> using Oracle JDK 1.8 causes the program to crash when starting a WebService using the Endpoint API.
Here is the relevant stack trace:
Caused by: java.lang.NullPointerException
at java.util.ResourceBundle.getBundle(Unknown Source)
at org.apache.cxf.common.i18n.BundleUtils.getBundle(BundleUtils.java:80)
at org.apache.cxf.common.logging.LogUtils.createLogger(LogUtils.java:246)
at org.apache.cxf.common.logging.LogUtils.getL7dLogger(LogUtils.java:198)
at org.apache.cxf.jaxws.spi.ProviderImpl.<clinit>(ProviderImpl.java:76)
... 20 more
The root cause seems to be that class "org.apache.cxf.jaxws.spi.ProviderImpl" has the following static field:
protected static final Logger LOG = LogUtils.getL7dLogger(ProviderImpl.class);
Unfortunately the ProviderImpl.class does not reference a ClassLoader when using Oracles JDK. Down the stack the method java.util.ResourceBundle.getBundle(String, Locale, ClassLoader) is called with null as ClassLoader, and the implementation of Oracles JDK throws a NullPointerException.
This can most likely be avoided by slightly modifying org.apache.cxf.common.i18n.BundleUtils.getBundle(Class<?>) to not only catch MissingResourceException, but RuntimeException in general or check if the ClassLoader is null beforehand and not pay the cost of an exception being thrown.