Max Bureck created CXF-6966: ------------------------------- Summary: Using CXF in JDK endorsed dir as JAX-WS impl crashes Key: CXF-6966 URL: https://issues.apache.org/jira/browse/CXF-6966 Project: CXF Issue Type: Bug Components: Core, JAX-WS Runtime Affects Versions: 3.1.6 Environment: Oracle JDK 1.8 (Update 91), not tested with other environments. Reporter: Max Bureck Priority: Critical
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: {code:java} protected static final Logger LOG = LogUtils.getL7dLogger(ProviderImpl.class); {code} 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. -- This message was sent by Atlassian JIRA (v6.3.4#6332)