You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Juan José Vázquez Delgado <ju...@gmail.com> on 2009/07/30 12:15:48 UTC

[SMX4] loader constraints issues with Pax Exam

Hi,

I´m trying to leverage the approach used in [1] and [2] in order to
get a Pax Exam [3] based testing strategy with SMX4 4.0.0.
Unfortunely, I have come across a lot of loader constraints issues
when some bundles start.

Briefly, amongst other things I have in my pom.xml:

<!-- The assembly and all the dependencies -->
<dependency>
    <groupId>org.apache.servicemix</groupId>
    <artifactId>apache-servicemix</artifactId>
    <version>4.0.0</version>
    <type>xml</type>
    <classifier>features</classifier>
    <scope>test</scope>
</dependency>

Then, my test makes use of scanFeatures to provision bundles from
servicemix features stuff:

// system properties and packages.........

// bundles................................
mavenBundle("org.apache.servicemix.specs",
"org.apache.servicemix.specs.jaxp-api-1.4").version("1.2.0"),
mavenBundle("org.apache.servicemix.bundles",
"org.apache.servicemix.bundles.jaxp-ri").version("1.4.2_1"),
// more bundles...........................

// spring-dm..............................

// using the features to install the components
scanFeatures(mavenBundle().groupId("org.apache.servicemix").
             artifactId("apache-servicemix").classifier("features").versionAsInProject().type("xml"),
             "nmr"),

// the framework
felix().version("1.0.4"),
waitForFrameworkStartup());

When the test runs I get this exception:

org.springframework.beans.factory.BeanDefinitionStoreException:
Unexpected exception parsing XML document from URL
[bundle://41.0:0/META-INF/spring/servicemix-document.xml]; nested
exception is java.lang.LinkageError: loader constraints violated when
linking org/xml/sax/EntityResolver class
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
        ..........................

Caused by: java.lang.LinkageError: loader constraints violated when
linking org/xml/sax/EntityResolver class
        at org.springframework.beans.factory.xml.DefaultDocumentLoader.createDocumentBuilder(DefaultDocumentLoader.java:132)
        ..........................

If I don´t provision jaxp-api-1.4 and jaxp-ri bundles then the
previous issues don´t take place but I want (think I need) to have
this bundles in the test execution context.

I suspect it´s a classloading issue but I don´t manage to make this
works. I have added exclusions too (xerces, xml-apis, xalan,...) to
the apache-servicemix dependency in pom without success.

Please, any help or idea?.

Thanks in advance,

Juanjo.

[1] http://svn.apache.org/repos/asf/felix/trunk/karaf/itests
[2] http://svn.apache.org/repos/asf/camel/trunk/tests/camel-itest-osgi
[3] http://wiki.ops4j.org/display/paxexam/Pax+Exam