title: Class Cast exception: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
body: <p>I'm struck with a problem in jboss. When I try to deploy my .war into the server, I get this following error,</p>
  
  <p><code>java.lang.ClassCastException: com.sun.org.apache.xerces.internal.jaxp.SAXParserF
  actoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory</code></p>
  
  <p>from which, it is quite evident that there is a clash of libraries. So, I removed the jar file which contains xerces, which happened to by jaxp-ri-1.4.1.jar. Now, when I try to re-deploy, I get this new error,</p>
  
  <pre><code>java.lang.NullPointerException
      at org.apache.commons.digester.Digester.getXMLReader(Digester.java:944)
      at org.apache.commons.digester.Digester.parse(Digester.java:1765)
      at org.apache.struts.action.ActionServlet.initServlet(ActionServlet.java
  </code></pre>
  
  <p>where it is complaining that it can't find the xml parsers. </p>
  
  <p>So, now my questions is that does anybody know what can be a solution. Any jaxp jar file that doesn't contain the xerces package?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I did as suggested <a href="https://stackoverflow.com/questions/4278213/jboss-class-cast-exception-com-sun-org-apache-xerces-internal-jaxp-documentbui/4278355#4278355">here</a> and now I have a new error,</p>
  
  <pre><code>java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl
  </code></pre>
  
  <p>which is a class from one of the jars I deleted which contains SaxParserFactory :(</p>