felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc.schle...@sdv-it.de
Subject Classloading issue for XML with Apache CXF in Felix
Date Thu, 11 Feb 2016 10:25:59 GMT
Hello everyone

I have set up a test-environment for several frontend-bundles (struts, 
jsf) which use our internal webservices via Apache CXF. The basic 
configuration is working and simple webservice-calls are running fine.
However, when I am accessing some other services CXF is running into 
classloading-errors. I guess that the webservice is returning some 
error-response which CXF cannot handle.

Caused by: java.lang.RuntimeException: XPathFactory#newInstance() failed 
to create an XPathFactory for the default object model: 
http://java.sun.com/jaxp/xpath/dom with the 
javax.xml.xpath.XPathFactoryConfigurationException: No XPathFactory 
implementation found for the object model: 

After some research I found out that a lot of imports in the CXF bundles 
are actually optional which is why I am running into 
runtime-classloader-problems. After some more research, I found out that 
CXF needs Saxon as well as Xerces and Xalan...and here the real trouble 

Servicemix is providing the required libraries as a bundle, so I add those
org.apache.servicemix.bundles.saxon (
org.apache.servicemix.bundles.xerces (
org.apache.servicemix.bundles.xalan (

This also resolves fine in BndTools, so time for another round

Failed to start bundle org.apache.servicemix.bundles.xalan-, 
exception Unable to resolve org.apache.servicemix.bundles.xalan [53](R 
53.0): missing requirement [org.apache.servicemix.bundles.xalan [53](R 
53.0)] osgi.wiring.package; (osgi.wiring.package=org.w3c.dom.traversal) 
Unresolved requirements: [[org.apache.servicemix.bundles.xalan [53](R 
53.0)] osgi.wiring.package; (osgi.wiring.package=org.w3c.dom.traversal)]

A lot of the xml-apis have been moved to the JDK, but not all. So I've 
org.apache.servicemix.specs.jaxp-api-1.4 (2.5.0)

And now I am doomed :-)
At first, it seemed Felix is not booting because nothing happened, but 
when I set felix.log.level=4 I can see endless repetition of this 

DEBUG: Candidate permutation failed due to a conflict between imports; 
will try another if possible. (Uses constraint violation. Unable to 
resolve resource org.ops4j.pax.web.pax-web-jsp 
[org.ops4j.pax.web.pax-web-jsp [77](R 77.0)] because it is exposed to 
package 'org.w3c.dom' from resources org.apache.felix.framework 
[org.apache.felix.framework [0](R 0)] and 
[org.apache.servicemix.specs.jaxp-api-1.4 [56](R 56.0)] via two dependency 

Chain 1:
  org.ops4j.pax.web.pax-web-jsp [org.ops4j.pax.web.pax-web-jsp [77](R 
    import: (osgi.wiring.package=org.w3c.dom)
    export: osgi.wiring.package: org.w3c.dom
  org.apache.felix.framework [org.apache.felix.framework [0](R 0)]

Chain 2:
  org.ops4j.pax.web.pax-web-jsp [org.ops4j.pax.web.pax-web-jsp [77](R 
    import: (osgi.wiring.package=org.w3c.dom.traversal)
    export: osgi.wiring.package: org.w3c.dom.traversal; uses:=org.w3c.dom
    export: osgi.wiring.package=org.w3c.dom
[org.apache.servicemix.specs.jaxp-api-1.4 [56](R 56.0)])

There are other packages as well, but this should be enough to make the 
point. Despite that Felix seems not to be able to recover from this, Felix 
is right: because the SystemBundle exports the JDK packages [1] which are 
also included in org.apache.servicemix.specs.jaxp-api-1.4 it doesnt know 
what to do.

The problem is that due to its xml-history [2], the JDK is not providing 
all classes or packages CXF needs to work. Despite the missing 
org.w3c.dom.traversal package, other packages do not inlcude all classes 
(for example org.w3c.dom.ElementTraversal which is also accessed at some 
point by CXF).

Is there any way I can tell Felix which packages it should not export, so 
I can use org.apache.servicemix.specs.jaxp-api-1.4? Or what bundles do I 
need to get full xml-processing within OSGI/Felix for CXF?

I have tried setting "org.osgi.framework.system.packages" to the list 
provided by [1] without the offending packages from jaxp but then the 
framework complains about tons of other problems.

Any help is really appreciated because I am running out of ideas.



(in my case section jre-1.8 )

Sparda-Datenverarbeitung eG
Freiligrathstrasse 32, 90482 Nürnberg
Tel.: 0911/5486-722
mailto: marc.schlegel@sdv-it.de

Sitz der Genossenschaft: Nürnberg 
Amtsgericht Nürnberg, GnR 271
Vorstand: Ludwig Oberhammer (Vorsitzender), Burkhard Kintscher
Aufsichtsratsvorsitzender: Manfred Stevermann

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte 
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail 
irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und 
vernichten Sie diese E-Mail. Das unerlaubte Kopieren und die unbefugte 
Weitergabe dieser E-Mail sind nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you 
are not the intended recipient or have received this e-mail in error, 
please notify the sender immediately and delete this e-mail. Any 
unauthorized copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message