[ 
https://issues.apache.org/jira/browse/AXIOM-355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andreas Veithen closed AXIOM-355.
---------------------------------


> Axiom Causes java.lang.LinkageError Running Under OSGi/Servicemix/Equinox
> -------------------------------------------------------------------------
>
>                 Key: AXIOM-355
>                 URL: https://issues.apache.org/jira/browse/AXIOM-355
>             Project: Axiom
>          Issue Type: Bug
>    Affects Versions: 1.2.10
>         Environment: Apache Servicemix 4.3 (Fuse distribution), Apache ODE, 
> Equinox
>            Reporter: Kurt Westerfeld
>
> When using Apache ODE under Apache Servicemix, Fuse distribution, which uses 
> Equinox as a OSGi container, the Apache ODE code throws a classloader 
> exception (see below....java.lang.LinkageError) when trying to use the 
> javax.xml.stream.util package.  The error seems to be related to a partial 
> OSGi "Import-Package" decleration provided by Apache Axiom.  To fix, I 
> adjusted the OSGi manifest, and added:
>     javax.xml.stream.events,javax.xml.stream.util
> Around/alongside the javax.xml.stream import package statement.   This hack 
> was not something I would recommend normal users to have to do--it just 
> illustrates the OSGi packaging problem Axiom has.
> What I think is going on here is that Axiom loads parts of its classes with 
> the OSGi loader when running under Servicemix, which provides the 
> javax.xml.stream package from a supplied package (Stax API), and then the 
> boot loader provides other parts.  These two class domains cannot be 
> intermingled.
> Please simply add these two packages listed above to an explicitly declared 
> Import-Package to the maven compile for Axiom.  This will fix this nicely.  
> Simply add all three to the maven-bundle-plugin:
>     javax.xml.stream,
>     javax.xml.stream.events,
>     javax.xml.stream.util
> A workaround for this issue can be found at the bottom of this web page, on 
> project  Apache ODE: http://ode.apache.org/smx4-osgi-deployment.html.   Note 
> the workaround in this case causes the javax.xml.stream to always be loaded 
> from one place, and the OSGi manifest tweaks on Import-Package I suggest 
> above do the same thing (but don't require the user to change the 
> configuration of the container).
> Here is the stacktrace for the error I am receiving:
> Caused by: java.lang.LinkageError: loader constraint violation: when 
> resolving method 
> "javax.xml.stream.util.StreamReaderDelegate.<init>(Ljavax/xml/stream/XMLStreamReader;)V"
>  the class loader (instance of 
> org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) of the current 
> class, org/apache/axiom/om/impl/builder/SafeXMLStreamReader, and the class 
> loader (instance of <bootloader>) for resolved class, 
> javax/xml/stream/util/StreamReaderDelegate, have different Class objects for 
> the type javax/xml/stream/XMLStreamReader used in the signature
>       at 
> org.apache.axiom.om.impl.builder.SafeXMLStreamReader.<init>(SafeXMLStreamReader.java:62)
>       at 
> org.apache.axiom.om.impl.builder.StAXBuilder.initParser(StAXBuilder.java:151)
>       at 
> org.apache.axiom.om.impl.builder.StAXBuilder.<init>(StAXBuilder.java:128)
>       at 
> org.apache.axiom.om.impl.builder.StAXBuilder.<init>(StAXBuilder.java:160)
>       at 
> org.apache.axiom.om.impl.builder.StAXOMBuilder.<init>(StAXOMBuilder.java:130)
>       at 
> org.apache.axiom.om.impl.builder.StAXOMBuilder.<init>(StAXOMBuilder.java:146)
>       at org.apache.ode.il.DynamicService.convertToOM(DynamicService.java:159)
>       at org.apache.ode.il.DynamicService.invoke(DynamicService.java:78)
>       at 
> org.apache.ode.jbi.DynamicMessageExchangeProcessor.invoke(DynamicMessageExchangeProcessor.java:61)
>       at 
> org.apache.ode.jbi.BaseMessageExchangeProcessor.onJbiMessageExchange(BaseMessageExchangeProcessor.java:83)
>       ... 8 more

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

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

Reply via email to