Andy Schmidt created AXIS2-5625:
-----------------------------------

             Summary: java.lang.LinkageError: 
"javax/xml/stream/XMLStreamReader" by using 
org.apache.axiom.om.impl.llom.OMStAXWrapper
                 Key: AXIS2-5625
                 URL: https://issues.apache.org/jira/browse/AXIS2-5625
             Project: Axis2
          Issue Type: Bug
    Affects Versions: 1.6.2
            Reporter: Andy Schmidt


I would like to use Axis2 OSGi bundle in my OSGI-Runtime.

My setting looks like:
START LEVEL 1
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (4.2.1)
    5|Active     |    1|Apache JAMES Mime4j (Core) (0.7.2)
    6|Active     |    1|Axiom API (1.2.14)
    7|Active     |    1|Axiom DOM (1.2.14)
    8|Active     |    1|Axiom Impl (1.2.14)
    9|Active     |    1|Apache Commons Codec (1.9.0)
   10|Active     |    1|Commons FileUpload (1.3.0)
   11|Active     |    1|Apache Geronimo Bundles: commons-httpclient-3.1 
(3.1.0.2)
   12|Active     |    1|Commons IO (2.4.0)
   13|Active     |    1|Commons Logging (1.1.3)
   14|Active     |    1|de.kisters.wab.amigw.hello (5.80.0.SNAPSHOT)
   15|Active     |    1|Activation 1.1 (1.1.0)
   16|Active     |    1|JavaMail 1.4 (1.7.1)
   17|Active     |    1|geronimo-jms_1.1_spec (1.1.1)
   18|Active     |    1|geronimo-stax-api_1.0_spec (1.0.1)
   19|Active     |    1|Web Services Metadata 2.0 (1.1.3)
   20|Active     |    1|Apache HttpClient OSGi bundle (4.2.4)
   21|Active     |    1|Apache HttpCore OSGi bundle (4.2.4)
   22|Active     |    1|jsr311-api (1.1.1)
   23|Active     |    1|Apache Neethi (3.0.2)
   24|Active     |    1|org.apache.axis2.osgi (1.0.0.2)
   25|Active     |    1|Apache Felix Bundle Repository (1.6.6)
   26|Active     |    1|Apache Felix Configuration Admin Service (1.8.0)
   27|Active     |    1|Apache Felix EventAdmin (1.3.2)
   28|Active     |    1|Apache Felix Gogo Command (0.12.0)
   29|Active     |    1|Apache Felix Gogo Runtime (0.10.0)
   30|Active     |    1|Apache Felix Gogo Shell (0.10.0)
   31|Active     |    1|Apache Felix Http Jetty (2.2.2)
   32|Active     |    1|Apache Felix (4.2.1)
   33|Active     |    1|Apache Felix Metatype Service (1.0.10)
   34|Active     |    1|Apache Felix Declarative Services (1.8.2)
   35|Active     |    1|Apache ServiceMix :: Bundles :: wsdl4j (1.6.2.6)
   36|Active     |    1|Stax2 API (3.1.1)
   37|Active     |    1|Woden - API (1.0.0)
   38|Active     |    1|Woden - Commons (1.0.0)
   39|Active     |    1|Woden - DOM (1.0.0)
   40|Active     |    1|Woodstox XML-processor (4.2.0)
   41|Active     |    1|XmlSchema (1.4.7)

After deploying my web application (simple soap hello world test bundle) and 
sending a soap request i got that error message:

SEVERE: loader constraint violation: loader (instance of 
org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) previously 
initiated loading for a different type with name 
"javax/xml/stream/XMLStreamReader"
java.lang.LinkageError: loader constraint violation: loader (instance of 
org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) previously 
initiated loading for a different type with name 
"javax/xml/stream/XMLStreamReader"
        at 
com.moodykettle.webservice.helloworld.SayHello$Factory.parse(SayHello.java:354)
        at 
de.kisters.amigw.mds.web.service.HelloWorldServiceMessageReceiverInOut.fromOM(HelloWorldServiceMessageReceiverInOut.java:138)
        at 
de.kisters.amigw.mds.web.service.HelloWorldServiceMessageReceiverInOut.invokeBusinessLogic(HelloWorldServiceMessageReceiverInOut.java:43)
        at 
org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
        at 
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
        at 
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
        at 
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at 
org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:96)
        at 
org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:79)
        at 
org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:42)
        at 
org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:49)
        at 
org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
        at 
org.apache.felix.http.base.internal.dispatch.FilterPipeline.dispatch(FilterPipeline.java:48)
        at 
org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:39)
        at 
org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:67)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
        at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
        at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
        at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
        at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.Server.handle(Server.java:326)
        at 
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
        at 
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
        at 
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
        at 
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

I dived deeper into that issue. The class 
org.apache.axiom.om.impl.llom.OMStAXWrapper from the Axiom-Impl project 
implements the interface XMLStreamReader from package javax.xml.stream.
I looked at the wiring of the OSGi-Runtime. The Axis2 OSGi bundle imports the 
javax.xml.stream package in version 1.0 and wires that with the geronimo stax 
api bundle, because it exports this package in version 1.0. Axiom-Impl bundle 
wires that package with the felix runtime bundle (java vm), because it doesn't 
need the version 1.0 explicit. Thats why this error occurs. That could be 
resolved if Axiom-Impl exports there packages with using declarations or 
imports that package also in version 1.0 from geronimo stax api. Currently I 
provided a patch in issue 5329 which includes a work-around at the pom file. 
This work-around excludes the geronimo stax api dependency. This effected that 
the javax.xml.stream package will no longer be imported in version 1.0.

<!-- Workaround for Axiom dependency. Axis2 OSGi will not be run with Axiom 
                        because Axiom doesn't export packages with uses. The 
bnd cannot generate 
                        the javax.xml.stream imports for the Axis2 OSGi bundle 
because Axiom imports 
                        this package without version number from stax api 1.0. 
-->
                <dependency>
                        <groupId>org.apache.ws.commons.axiom</groupId>
                        <artifactId>axiom-api</artifactId>
                        <version>1.2.13</version>
                        <exclusions>
                                <exclusion>
                                        
<groupId>org.apache.geronimo.specs</groupId>
                                        
<artifactId>geronimo-stax-api_1.0_spec</artifactId>
                                </exclusion>
                        </exclusions>
                </dependency>
                <dependency>
                        <groupId>org.apache.ws.commons.axiom</groupId>
                        <artifactId>axiom-impl</artifactId>
                        <version>1.2.13</version>
                        <exclusions>
                                <exclusion>
                                        
<groupId>org.apache.geronimo.specs</groupId>
                                        
<artifactId>geronimo-stax-api_1.0_spec</artifactId>
                                </exclusion>
                        </exclusions>
                </dependency>



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to