How to configure JAXB to use Woodstox on JBoss 6?

I am deploying the Java EE 6 JAX-RS web service on JBoss 6 and I would like to use Woodstox instead of using the SAX / STAX parser. Since some stack traces list classes in (among other packages):

  • org.apache.xerces.parsers
  • org.apache.xerces.impl
  • org.apache.xerces.jaxp

... I guess he uses Xerces .

I tried adding the necessary the JAR ( woodstox-core-asl-4.1.1.jarand stax2-api-3.1.1.jar) in the EAR (detailed in the catalog /lib), as well as WAR (in WEB-INF/lib), but it has not affected because the stack trace of the exception in XML parsing still refer to the Xerces packages.

I already read this question , but I think that I have already tried the option "add it to your class path," as mentioned above. I also tried adding the following VM arguments to this thread :

-Djavax.xml.stream.XMLInputFactory=com.ctc.wstx.stax.WstxInputFactory
-Djavax.xml.stream.XMLOutputFactory=com.ctc.wstx.stax.WstxOutputFactory
-Djavax.xml.stream.XMLEventFactory=com.ctc.wstx.stax.WstxEventFactory
-Dcom.sun.xml.ws.api.streaming.XMLStreamReaderFactory.woodstox=true
-Dcom.sun.xml.ws.api.streaming.XMLStreamWriterFactory.woodstox=true

What am I doing wrong? How can I get JAXB to use Woodstox instead of (I think) Xerces?

+3
source share
1 answer

When EclipseLink JAXB (MOXy) creates an XMLStreamReader, it does this using standard APIs, so it should get the one that suits your environment:

xmlInputFactory = XMLInputFactory.newInstance();
XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(reader);

, JBoss JAX-RS MOXy-, XMLStreamReader ( unmarshalling InputStream), XMLStreamReader ( JBoss).

0

All Articles