Sun GlassFish Enterprise Server v2.1.1 Developer's Guide

Using the Woodstox Parser

The default XML parser in the Enterprise Server is the Sun GlassFish XML Parser (SJSXP). Using the Woodstox parser, which is bundled with the Enterprise Server, may improve performance. Woodstox and SJSXP both provide implementations of the StAX API. To enable the Woodstox parser, set the following system properties for the default server-config configuration in the domain.xml file, then restart the server:

<config name=server-config>
 ...
   <system-property name="javax.xml.stream.XMLEventFactory" 
      value="com.ctc.wstx.stax.WstxEventFactory"/>
   <system-property name="javax.xml.stream.XMLInputFactory" 
      value="com.ctc.wstx.stax.WstxInputFactory"/>
   <system-property name="javax.xml.stream.XMLOutputFactory" 
      value="com.ctc.wstx.stax.WstxOutputFactory"/>
</config>

In addition, set these properties for any other configurations referenced by server instances or clusters on which you want to use the Woodstox parser. For more information about the domain.xml file and system properties, see the Sun GlassFish Enterprise Server v2.1.1 Administration Reference.


Note –

If you are using a stand-alone client, you must set these same properties for the client on the java command line as follows:


-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

Setting these properties is not necessary if you are using an application client, which is recommended and supported.


For more information about the Woodstox parser, see http://woodstox.codehaus.org/. For more information about the StAX API, see Chapter 17: Streaming API for XML in the Java EE 5 Tutorial.