Hi !

I've created a custom karaf 4.1.0 distribution with the karaf maven plugin
where I've added per configuration the following features:

<bootFeatures>
    <feature>standard</feature>
    <feature>scr</feature>
    <feature>http</feature>
    <feature>http-whiteboard</feature>
    <feature>webconsole</feature>
    <feature>cxf-dosgi-provider-rs</feature>
    <feature>cxf-dosgi-provider-ws</feature>
 </bootFeatures>

I've also added the same libraries that the default karaf 4.1 distribution
adds (I' ve found the the link
http://karaf.922171.n3.nabble.com/CXF-Dosgi-td4045786.html where that is
mentioned) and checked that they are in the lib/endrosed folder of karaf

Concerning my use case, this is a simple rest service that internally calls
a soap service. The problem is that as soon as the call is made I receive
the following exception:
java.util.ServiceConfigurationError: javax.xml.stream.XMLOutputFactory:
Provider com.ctc.wstx.stax.WstxOutputFactory not found
        at java.util.ServiceLoader.fail(ServiceLoader.java:239)
        at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
        at 
java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372)
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
        at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
        at javax.xml.stream.FactoryFinder$1.run(FactoryFinder.java:353)
        at java.security.AccessController.doPrivileged(Native Method)
        at
javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:341)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:313)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:227)
        at 
javax.xml.stream.XMLOutputFactory.newInstance(XMLOutputFactory.java:130)
        at
org.apache.cxf.staxutils.StaxUtils.getXMLOutputFactory(StaxUtils.java:290)
        at
org.apache.cxf.staxutils.StaxUtils.createXMLStreamWriter(StaxUtils.java:398)
        at
org.apache.cxf.interceptor.StaxOutInterceptor.handleMessage(StaxOutInterceptor.java:82)
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
        at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277)
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
        at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)
        at com.sun.proxy.$Proxy117.getGeoIPContext(Unknown Source)

I've looked at org.apache.cxf.staxutils.StaxUtils.getXMLOutputFactory and
I've retrieved the following code, that I've added to the bundle that calls
the webservice to isolate the error:

                XMLOutputFactory xof = null;
                try {
                        error("#### INSTANCING XOF ####");
                        xof = XMLOutputFactory.newInstance();
                        error("#### XOF INSTANCED ####");
                        String xofClassName = xof.getClass().getName();
                        error("#### XOF CLASSNAME: {} ####", xofClassName);
                        if (!xofClassName.contains("ctc.wstx") &&
!xofClassName.contains("xml.xlxp")
                                        && !xofClassName.contains("xml.xlxp2") 
&&
!xofClassName.contains("bea.core")) {
                                xof = null;
                        }
                } catch (Throwable t) {
                        // ignore, can always drop down to the pooled factories
                        error("################## ERROR #####################", 
t);
                }

This line xof = XMLOutputFactory.newInstance(); gives me an immediate error
and the pooled factories do not work also. Actually this fails later in
StaxUtils method of cxf at the f = XMLOutputFactory.newInstance(); per
stacktrace above:

private static XMLOutputFactory getXMLOutputFactory() {
        if (SAFE_OUTPUT_FACTORY != null) {
            return SAFE_OUTPUT_FACTORY;
        }
        XMLOutputFactory f = OUTPUT_FACTORY_POOL.poll();
        if (f == null) {
            f = XMLOutputFactory.newInstance();
        }
        return f;
    }

I've checked that I have Woodstox XML-processor i.e. woodstox-core-asl
bundle with version 4.4.1 which is right according with cxf 3.1.7 (used by
dosgi). Most curious is that I'm able to make this work perfectly with pax
exam but it does not work with karaf...

Unfortunately I'm running out of ideas of how to handle this. Previously
I've this working also in plain felix the diference was that I was using
extension bundles and not libs on the endorsed folder. I've also commented
those libraries in the configuration of the assembly and the result was the
same...

Any idea what is causing the problem ?

Best Regards,
Ivo Leitão




--
View this message in context: 
http://karaf.922171.n3.nabble.com/DOSGI-2-1-0-calling-soap-service-results-in-javax-xml-stream-XMLOutputFactory-cannot-be-created-tp4049778.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to