Can I use a Generic SAX/DOM XML parser for Tomcat instead of parser.jar? I tried using Xerces and get class not found errors for sun.xxxx parser during Tomcat initialization.

Luigi Viggiano

Try to configure Xerces as customized SAX/DOM implementation by system properties. By default jaxp uses com.sun.xml.parser.DocumentBuilderFactoryImpl and com.sun.xml.parser.SAXParserFactoryImpl (this is why you get ClassNotFoundException if you miss parser.jar from the classpath).

Example:


        System.setProperty("javax.xml.parsers.DocumentBuilderFactory", 
                           "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
        System.setProperty("javax.xml.parsers.SAXParserFactory", 
                           "org.apache.xerces.jaxp.SAXParserFactoryImpl");
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact