You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by ma...@sdv-it.de on 2016/02/11 11:25:59 UTC
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
XPathFactoryConfigurationException:
javax.xml.xpath.XPathFactoryConfigurationException: No XPathFactory
implementation found for the object model:
http://java.sun.com/jaxp/xpath/dom
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 (9.7.0.1_1)
org.apache.servicemix.bundles.xerces (2.11.0.1)
org.apache.servicemix.bundles.xalan (2.7.2.2)
This also resolves fine in BndTools, so time for another round
Failed to start bundle org.apache.servicemix.bundles.xalan-2.7.2.2,
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
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
[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
[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.
regards
Marc
[1]
https://github.com/apache/felix/blob/trunk/framework/src/main/resources/default.properties
(in my case section jre-1.8 )
[2]
http://stackoverflow.com/questions/11677572/dealing-with-xerces-hell-in-java-maven
___________________________________________
Sparda-Datenverarbeitung eG
AD-POR
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.
Antwort: RE: Classloading issue for XML with Apache CXF in Felix
Posted by ma...@sdv-it.de.
Thanks for your answer Olaf.
Good to hear that I am not the only one struggling :-)
Anyways. I am not using the ueber-bundle. With 3.0 CXF was split into
multiple modules and each provides OSGI-metadata already. Currently I am
using 3.1.4.
Currently BndTools resolved the following cxf bundles
org.apache.cxf.cxf-core;version='[3.1.4,3.1.5)',\
org.apache.cxf.cxf-rt-bindings-soap;version='[3.1.4,3.1.5)',\
org.apache.cxf.cxf-rt-bindings-xml;version='[3.1.4,3.1.5)',\
org.apache.cxf.cxf-rt-databinding-jaxb;version='[3.1.4,3.1.5)',\
org.apache.cxf.cxf-rt-frontend-jaxws;version='[3.1.4,3.1.5)',\
org.apache.cxf.cxf-rt-frontend-simple;version='[3.1.4,3.1.5)',\
org.apache.cxf.cxf-rt-transports-http;version='[3.1.4,3.1.5)',\
org.apache.cxf.cxf-rt-wsdl;version='[3.1.4,3.1.5)',\
I was also thinking about a R5 subsystem but this would make the
development process quite slow since I dont have any tool-support
(Currently I start Felix from BndTools). The only way using a subsystem I
could use by now was a local Felix installation with the aries-subsystem
bundles and then dropping my bundles manually to the deploy-folder. So not
really easy to work with....
So I guess I have to embedd the jar within the bundle containing the
client. For testing this is fine for now...
I still hope that there is some configuration-option with the latest
cxf-version....
regards
Marc
___________________________________________
Sparda-Datenverarbeitung eG
AD-POR
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.
Von: Olaf Otto <ol...@unic.com>
An: "users@felix.apache.org" <us...@felix.apache.org>,
Datum: 11.02.2016 13:09
Betreff: RE: Classloading issue for XML with Apache CXF in Felix
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
XPathFactoryConfigurationException:
javax.xml.xpath.XPathFactoryConfigurationException: No XPathFactory
implementation found for the object model:
http://java.sun.com/jaxp/xpath/dom
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 (9.7.0.1_1)
org.apache.servicemix.bundles.xerces (2.11.0.1)
org.apache.servicemix.bundles.xalan (2.7.2.2)
This also resolves fine in BndTools, so time for another round
Failed to start bundle org.apache.servicemix.bundles.xalan-2.7.2.2,
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
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
[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
[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.
regards
Marc
[1]
https://github.com/apache/felix/blob/trunk/framework/src/main/resources/default.properties
(in my case section jre-1.8 )
[2]
http://stackoverflow.com/questions/11677572/dealing-with-xerces-hell-in-java-maven
___________________________________________
Sparda-Datenverarbeitung eG
AD-POR
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.
Webinar:<
http://magazin.unic.com/2016/01/28/webinar-marketing-automation-entlang-der-multioptionalen-kundenreise/
> 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
RE: Classloading issue for XML with Apache CXF in Felix
Posted by Olaf Otto <ol...@unic.com>.
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
XPathFactoryConfigurationException:
javax.xml.xpath.XPathFactoryConfigurationException: No XPathFactory implementation found for the object model:
http://java.sun.com/jaxp/xpath/dom
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 (9.7.0.1_1) org.apache.servicemix.bundles.xerces (2.11.0.1) org.apache.servicemix.bundles.xalan (2.7.2.2)
This also resolves fine in BndTools, so time for another round
Failed to start bundle org.apache.servicemix.bundles.xalan-2.7.2.2,
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 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
[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
[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.
regards
Marc
[1]
https://github.com/apache/felix/blob/trunk/framework/src/main/resources/default.properties
(in my case section jre-1.8 )
[2]
http://stackoverflow.com/questions/11677572/dealing-with-xerces-hell-in-java-maven
___________________________________________
Sparda-Datenverarbeitung eG
AD-POR
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.
Webinar:<http://magazin.unic.com/2016/01/28/webinar-marketing-automation-entlang-der-multioptionalen-kundenreise/> 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