Hi M.D.,
That looks like a bug to me. The line from the NPE is:
URL url =
Thread.currentThread().getContextClassLoader().getResource(resourceName);
Ordinarily, there is always a context classloader on the thread, but a null
value is allowed - it means that the JVM's boot classloader should be
used. This code should be updated to something like:
ClassLoader loader = Thread.currentThread.getContextClassLoader();
if (loader == null) loader = ClassLoader.getSystemClassLoader();
URL url = loader.getResource(resourceName);
I'll plan to provide a fix for CXF 3.1.12.
Thanks for reporting this,
Andy
On Thu, Apr 27, 2017 at 8:36 AM, M. D. <[email protected]> wrote:
>
>
>
> Hello group,
>
>
>
> Please ignore my incompetence as I have never used CXF and neither do I
> have any knowledge about the product.
> So there is a chance that this is a really stupid question.
>
>
>
>
> In order to keep this inquiry short I will spare as much details as
> possible.
> So here it is: I am trying to deploy parts of CXF 3.1.11 in our OSGi
> container.
>
> So far I have the following Karaf features installed:
>
> cxf-core cxf-jaxws cxf-transports-jms cxf-ws-mex
> cxf-features-logging cxf-ws-security cxf-ws-rm
>
> (I could be missing something but at least I have these deployed).
>
> All resolves fine. During startup of the container however, I see this
> exception:
> Error registering CXF OSGi servlet null: java.lang.NullPointerException
> at org.apache.cxf.common.classloader.ClassLoaderUtils.
> getResource(ClassLoaderUtils.java:92)
> at org.apache.cxf.common.classloader.ClassLoaderUtils.
> getResourceAsStream(ClassLoaderUtils.java:227)
> at org.apache.cxf.transport.servlet.AbstractHTTPServlet.
> getResourceAsStream(AbstractHTTPServlet.java:150)
> at org.apache.cxf.transport.servlet.AbstractHTTPServlet.
> finalizeServletInit(AbstractHTTPServlet.java:128)
> at org.apache.cxf.transport.servlet.CXFNonSpringServlet.
> init(CXFNonSpringServlet.java:88)
> at
> org.apache.felix.http.base.internal.handler.ServletHandler.init(ServletHandler.java:55)
> at org.apache.felix.http.base.internal.handler.
> HandlerRegistry.addServlet(HandlerRegistry.java:65)
> at org.apache.felix.http.base.internal.service.HttpServiceImpl.
> registerServlet(HttpServiceImpl.java:95)
> at org.apache.cxf.transport.http.osgi.ServletExporter.updated(
> ServletExporter.java:108)
> at org.apache.felix.cm.impl.helper.ManagedServiceTracker.
> updated(ManagedServiceTracker.java:189)
> at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(
> ManagedServiceTracker.java:152) at org.apache.felix.cm.impl.
> helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)
> at org.apache.felix.cm.impl.ConfigurationManager$
> ManagedServiceUpdate.provide(ConfigurationManager.java:1463)
> at org.apache.felix.cm.impl.ConfigurationManager$
> ManagedServiceUpdate.run(ConfigurationManager.java:1419) at
> org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)
> at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) at
> java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_121]
> The ClassLoaderUtils throws the NPE because the TCCL is not set (we are
> running in an OSGi container after all)
> We don't really use the CXF http transport but the jms one.
> However, seems the
> cxf-rt-transports-http is a mandatory dependency of cxf-core so we have to
> deploy it anyway. So is there a way to work around this issue? Or am I
> missing something obvious here (again, I apologize for my ignorance because
> I have zero exp with CXF but the fact is that our team need to have it
> deployed in the platform for reasons)?
>
> Thank you in advance!
>
> Best regards,
> M.D
>
>
>