Uploaded image for project: 'Axiom'
  1. Axiom
  2. AXIOM-479

In OSGi, Abdera parser bundle cannot use StAX


    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.18
    • Component/s: FOM
    • Labels:


      This issue refers to a version 1.1.3 dated December 21, 2012 on the Apache mirrors. The mailing lists only mention an 1.1.3 RC2, so I'm not sure if this version is meant to be the final release version of 1.1.3.

      I'm trying to use Abdera in an OSGi based server. However, this fails with stacktraces like:

      javax.xml.stream.FactoryConfigurationError: Requested factory com.ctc.wstx.stax.WstxOutputFactory cannot be located. Classloader =sun.misc.Launcher$AppClassLoader@42b7141a
      at javax.xml.stream.FactoryLocator.loadFactory(FactoryLocator.java:120) ~[na:na]
      at javax.xml.stream.FactoryLocator.locate(FactoryLocator.java:109) ~[na:na]
      at javax.xml.stream.FactoryLocator.locate(FactoryLocator.java:54) ~[na:na]
      at javax.xml.stream.XMLOutputFactory.newInstance(XMLOutputFactory.java:29) ~[na:1.7.0_11]
      at org.apache.axiom.om.util.StAXUtils$9.run(StAXUtils.java:655) ~[na:na]
      at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_11]
      at org.apache.axiom.om.util.StAXUtils.newXMLOutputFactory(StAXUtils.java:645) ~[na:na]
      at org.apache.axiom.om.util.StAXUtils.getXMLOutputFactory_perClassLoader(StAXUtils.java:709) ~[na:na]
      at org.apache.axiom.om.util.StAXUtils.getXMLOutputFactory(StAXUtils.java:348) ~[na:na]
      at org.apache.axiom.om.util.StAXUtils.getXMLOutputFactory(StAXUtils.java:313) ~[na:na]
      at org.apache.axiom.om.util.StAXUtils.createXMLStreamWriter(StAXUtils.java:436) ~[na:na]
      at org.apache.axiom.om.util.StAXUtils.createXMLStreamWriter(StAXUtils.java:431) ~[na:na]
      at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:149) ~[na:na]
      at org.apache.abdera.parser.stax.FOMElement.writeTo(FOMElement.java:341) ~[na:na]
      at org.apache.abdera.parser.stax.FOMWriter.writeTo(FOMWriter.java:73) ~[na:na]
      at org.apache.abdera.util.AbstractWriter.writeTo(AbstractWriter.java:80) ~[na:na]
      at org.apache.abdera.parser.stax.FOMElement.writeTo(FOMElement.java:314) ~[na:na]
      at org.apache.abdera.parser.stax.FOMElement.writeTo(FOMElement.java:329) ~[na:na]

      As Java includes StAX since version 6, I don't need Woodstox. So what I did was:
      1. Remove the geronimo-stax_api and wstx-asl jars from the abdera-parser bundle
      2. Remove them from the Bundle-ClassPath manifest header
      3. Add javax.xml.stream and javax.xml.stream.util to its Import-Package header
      This fixed the issue for me.

      I would suggest doing the above. Anyone still using an ancient Java version without StAX can include it as an external dependency.




            • Assignee:
              veithen Andreas Veithen
              bas@x-hive.com Bas de Bakker
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: