Hello everyone

I have code, which calls SOAP services using the dynamic client
feature of Apache CXF. The code basically looks like this:

JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
this.client = dcf.createClient(new URL(wsdlUrl));

The Exception is thrown within createClient, but only under certain
circumstances. If I run the code within a simple test app everything
runs fine. However, if I move my code to the actual context, as a
plugin within another software, the Exception occurs. The other
software is "Kettle", a tool of the Pentaho BI Suite. I suspect, that
this is because Kettle installs an own classloader in the thread
context and the CXF code that gets executed is somehow incompatible
with this specific classloader.

Does anyone has a had similar problems when embedding CXF into another
application? What further actions are recommended?

--

I have debugged the NullPointerException within Kettle and have the
exact position where the fault occurs. However, I have no clue *what*
the code inquestion is doing, why it is doing this and what would be a
correct behaviour.

The NullPointerException is thrown at
org.apache.cxf.wsdl11.WSDLServiceFactory within the constructor
"public WSDLServiceFactory(Bus b, URL url)" at line 67. This line
looks like this:

definition = getBus().getExtension(WSDLManager.class).getDefinition(wsdlUrl);

The NullPointerException occures, because the getExtension method
returns null. At run time, the getBus() method returns an instance of
org.apache.cxf.bus.CXFBusImpl. Its complete getExtension in this class
looks like:

public final <T> T getExtension(Class<T> extensionType) {
        Object obj = extensions.get(extensionType);
        if (obj == null) {
            ConfiguredBeanLocator loc =
(ConfiguredBeanLocator)extensions.get(ConfiguredBeanLocator.class);
            if (loc == null) {
                loc = createConfiguredBeanLocator();
            }
            if (loc != null) {
                //force loading
                Collection<?> objs = loc.getBeansOfType(extensionType);
                if (objs != null) {
                    for (Object o : objs) {
                        extensions.put(extensionType, o);
                    }
                }
                obj = extensions.get(extensionType);
            }
        }
        if (null != obj) {
            return extensionType.cast(obj);
        }
        return null;
    }

As you can see, there is a code path that may return null. A case in
which the code at org.apache.cxf.wsdl11.WSDLServiceFactory *will*
fail. In my understanding this is a bug. Am I seeing this right?

Regards
Martin Thurau

Reply via email to