felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olaf Otto <olaf.o...@unic.com>
Subject RE: Classloading issue for XML with Apache CXF in Felix
Date Thu, 11 Feb 2016 12:02:23 GMT
Hi Marc

This looks very familiar. We've had a couple of projects with CXF integration. Basically,
the uber-bundle they are providing introduces classloading issues beyond repair. We've got
it to work for a customer by modifying the manifest of the uber bundle. But eventually, we
had to upgrade to a more recent CXF version and had to re-do everything. Bottom line, the
total cost of ownership was too high.

I'd suggest the following solutions (in order of preference):

1.) Don't use CXF at runtime. Instead, use the jax-* support shipped with the JDK. For this,
modify the sling.properties to expose the relevant packages via the system class loader, as
mentioned here: https://helpx.adobe.com/experience-manager/using/creating-cq-bundles-consume-web.html
/ https://helpx.adobe.com/experience-manager/using/creating-cxf-bundles-consume-web.html

2.) Wrap your application along with the CXF uber-bundle in an application Subsystem to isolate
it (see OSGi enterprise spec: https://osgi.org/download/r5/osgi.enterprise-5.0.0.pdf).

Good luck!
- Olaf

-----Original Message-----
From: marc.schlegel@sdv-it.de [mailto:marc.schlegel@sdv-it.de]
Sent: Donnerstag, 11. Februar 2016 11:26
To: users@felix.apache.org
Subject: Classloading issue for XML with Apache CXF in Felix

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 starts.

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;
Unresolved requirements: [[org.apache.servicemix.bundles.xalan [53](R 53.0)] osgi.wiring.package;

A lot of the xml-apis have been moved to the JDK, but not all. So I've added
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 chains.

Chain 1:
  org.ops4j.pax.web.pax-web-jsp [org.ops4j.pax.web.pax-web-jsp [77](R 77.0)]
    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 77.0)]
    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.

Marketing Automation | 16. Februar 2016 | 11-12 Uhr
Wir freuen uns auf Ihre Teilnahme!

Internet World 2016<http://magazin.unic.com/2015/12/08/omnichannel-kompetenz-fur-erfolgreichen-e-commerce-unic-an-der-internet-world-2016/>
| München | 01.-02. März 2016
Wir freuen uns auf Ihren Besuch | Stand B 104, Halle B6

To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org

View raw message