Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6966

Using CXF in JDK endorsed dir as JAX-WS impl crashes

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.1.6
    • Fix Version/s: 3.0.10, 3.1.7
    • Component/s: Core, JAX-WS Runtime
    • Labels:
      None
    • Environment:

      Oracle JDK 1.8 (Update 91), not tested with other environments.

    • Estimated Complexity:
      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.

        Attachments

          Activity

            People

            • Assignee:
              dkulp Daniel Kulp
              Reporter:
              Boereck Max Bureck
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: