java.lang.ClassCastException: org.apache.xerces.jaxp.SAXParserFactoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory 

Joined:
04/09/2007
Posts:
703

March 22, 2010 01:50:49    Last update: March 22, 2010 01:50:49
The class org.apache.xerces.jaxp.SAXParserFactoryImpl extends javax.xml.parsers.SAXParserFactory, so casting the former to the latter should not be a problem. This error occurs when there are two copies of javax.xml.parsers.SAXParserFactory loaded by two different class loaders, and you are trying to cast one to the other.

Normally, you'll be able to find xml-apis.jar under WEB-INF/lib of the WAR file. Deleting the jar will resolve the problem.

java.lang.ClassCastException: org.apache.xerces.jaxp.SAXParserFactoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory

	at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)

	at org.apache.commons.digester.Digester.getFactory(Digester.java:478)

	at org.apache.commons.digester.Digester.getParser(Digester.java:683)

	at org.apache.commons.digester.Digester.getXMLReader(Digester.java:891)

	at org.apache.commons.digester.Digester.parse(Digester.java:1591)

	at org.apache.struts.action.ActionServlet.initServlet(ActionServlet.java:1144)

	at org.apache.struts.action.ActionServlet.init(ActionServlet.java:328)

	at javax.servlet.GenericServlet.init(GenericServlet.java:242)
Share |
| Comment  | Tags
 
Easy email testing with http://www.ximailstop.com