Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAXB to use Woodstox parser for performance?

Is it possible switch the native parser, which I believe is based on Java reflection. We have some performance issues and wondering whether we can switch the implementation.

Your advise is highly appreciated.

Additional information: This is inherited code and we need to fix performance issues in our web-services. I am looking for performance boost without code changes. The existing code uses JAXB for marshalling and unmarshalling java objects which are generated via CXF (wsdl to java).

My goal is to switch the implementation to sTax and then use Woodstox library.

like image 251
anonmys Avatar asked Jan 20 '23 03:01

anonmys


1 Answers

If your JAXB implementation uses a StAX parser under the covers via the standard JAXP APIs, then adding the Woodstox jar to your classpath should cause your JAXB impl to use Woodstox. You should see a performance improvement by doing this.

Since the Woodstox jar contains the following entries, adding it to the classpath will allow the JAXP APIs to return an instance of it:

  • META-INF/services/javax.xml.stream.XMLInputFactory
  • META-INF/services/javax.xml.stream.XMLOuputFactory

Note: I lead EclipseLink JAXB (MOXy), and MOXy uses a StAX parser when one is available. The other JAXB implementations (Metro, JaxMe) probably do the same thing.

like image 55
bdoughan Avatar answered Jan 31 '23 21:01

bdoughan