title: java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to javax.xml.parsers.DocumentBuilderFactory
body: <p>I am using <code>java1.6</code>,<code>jboss5.1</code> and <code>Spring</code> maven <code>3.2.5</code> in my project.I am getting </p>
  
  <blockquote>
    <p>java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to javax.xml.parsers.DocumentBuilderFactory</p>
  </blockquote>
  
  <p>This is my Pom.xml</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.varun.batch&lt;/groupId&gt;
      &lt;artifactId&gt;myproject&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;myproject Maven Webapp&lt;/name&gt;
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
      &lt;dependencies&gt;
          &lt;!-- Spring ORM support --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
              &lt;version&gt;3.2.13.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Spring Batch --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.batch&lt;/groupId&gt;
              &lt;artifactId&gt;spring-batch-core&lt;/artifactId&gt;
              &lt;version&gt;3.0.1.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.batch&lt;/groupId&gt;
              &lt;artifactId&gt;spring-batch-infrastructure&lt;/artifactId&gt;
              &lt;version&gt;3.0.1.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.axis2&lt;/groupId&gt;
              &lt;artifactId&gt;axis2&lt;/artifactId&gt;
              &lt;version&gt;1.6.2&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.xmlbeans&lt;/groupId&gt;
              &lt;artifactId&gt;xmlbeans&lt;/artifactId&gt;
              &lt;version&gt;2.5.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.axis2&lt;/groupId&gt;
              &lt;artifactId&gt;axis2-transport-local&lt;/artifactId&gt;
              &lt;version&gt;1.6.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.axis2&lt;/groupId&gt;
              &lt;artifactId&gt;axis2-transport-http&lt;/artifactId&gt;
              &lt;version&gt;1.6.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;commons-codec&lt;/groupId&gt;
              &lt;artifactId&gt;commons-codec&lt;/artifactId&gt;
              &lt;version&gt;1.6&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.poi&lt;/groupId&gt;
              &lt;artifactId&gt;poi&lt;/artifactId&gt;
              &lt;version&gt;3.9&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-jpa-2.0-api&lt;/artifactId&gt;
              &lt;version&gt;1.0.0.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
              &lt;version&gt;3.1.0.CR2&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                      &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
              &lt;version&gt;3.3.1.ga&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                      &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
              &lt;version&gt;3.3.0.CR2&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-ehcache&lt;/artifactId&gt;
              &lt;version&gt;3.3.0.CR2&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;artifactId&gt;jboss-logging&lt;/artifactId&gt;
                      &lt;groupId&gt;org.jboss.logging&lt;/groupId&gt;
                  &lt;/exclusion&gt;
                  &lt;exclusion&gt;
                      &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                      &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;c3p0&lt;/groupId&gt;
              &lt;artifactId&gt;c3p0&lt;/artifactId&gt;
              &lt;version&gt;0.9.1.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;antlr&lt;/groupId&gt;
              &lt;artifactId&gt;antlr&lt;/artifactId&gt;
              &lt;version&gt;2.7.7&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;aopalliance&lt;/groupId&gt;
              &lt;artifactId&gt;aopalliance&lt;/artifactId&gt;
              &lt;version&gt;1.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
              &lt;version&gt;3.0.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;stax&lt;/groupId&gt;
              &lt;artifactId&gt;stax-api&lt;/artifactId&gt;
              &lt;version&gt;1.0.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.axis2&lt;/groupId&gt;
              &lt;artifactId&gt;axis2-kernel&lt;/artifactId&gt;
              &lt;version&gt;1.6.1&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
                      &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
                  &lt;/exclusion&gt;
  
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.ws.commons.axiom&lt;/groupId&gt;
              &lt;artifactId&gt;axiom-api&lt;/artifactId&gt;
              &lt;version&gt;1.2.12&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                      &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.geronimo.specs&lt;/groupId&gt;
              &lt;artifactId&gt;geronimo-activation_1.1_spec&lt;/artifactId&gt;
              &lt;version&gt;1.0.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.geronimo.specs&lt;/groupId&gt;
              &lt;artifactId&gt;geronimo-javamail_1.4_spec&lt;/artifactId&gt;
              &lt;version&gt;1.6&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;jaxen&lt;/groupId&gt;
              &lt;artifactId&gt;jaxen&lt;/artifactId&gt;
              &lt;version&gt;1.1.1&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;artifactId&gt;xercesImpl&lt;/artifactId&gt;
                      &lt;groupId&gt;xerces&lt;/groupId&gt;
  
                  &lt;/exclusion&gt;
                  &lt;exclusion&gt;
                      &lt;artifactId&gt;xml-apis&lt;/artifactId&gt;
                      &lt;groupId&gt;xml-apis&lt;/groupId&gt;
  
                  &lt;/exclusion&gt;
                  &lt;exclusion&gt;
                      &lt;artifactId&gt;xmlParserAPIs&lt;/artifactId&gt;
                      &lt;groupId&gt;xerces&lt;/groupId&gt;
  
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt; 
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.geronimo.specs&lt;/groupId&gt;
              &lt;artifactId&gt;geronimo-stax-api_1.0_spec&lt;/artifactId&gt;
              &lt;version&gt;1.0.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.geronimo.specs&lt;/groupId&gt;
              &lt;artifactId&gt;geronimo-ws-metadata_2.0_spec&lt;/artifactId&gt;
              &lt;version&gt;1.1.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.ws.commons.axiom&lt;/groupId&gt;
              &lt;artifactId&gt;axiom-impl&lt;/artifactId&gt;
              &lt;version&gt;1.2.12&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                      &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.codehaus.woodstox&lt;/groupId&gt;
              &lt;artifactId&gt;wstx-asl&lt;/artifactId&gt;
              &lt;version&gt;3.2.9&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.geronimo.specs&lt;/groupId&gt;
              &lt;artifactId&gt;geronimo-jta_1.1_spec&lt;/artifactId&gt;
              &lt;version&gt;1.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-httpclient&lt;/groupId&gt;
              &lt;artifactId&gt;commons-httpclient&lt;/artifactId&gt;
              &lt;version&gt;3.1&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                      &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;wsdl4j&lt;/groupId&gt;
              &lt;artifactId&gt;wsdl4j&lt;/artifactId&gt;
              &lt;version&gt;1.6.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.ws.commons.schema&lt;/groupId&gt;
              &lt;artifactId&gt;XmlSchema&lt;/artifactId&gt;
              &lt;version&gt;1.4.7&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
              &lt;artifactId&gt;httpcore&lt;/artifactId&gt;
              &lt;version&gt;4.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.javaetmoi.core&lt;/groupId&gt;
              &lt;artifactId&gt;javaetmoi-spring4-vfs2-support&lt;/artifactId&gt;
              &lt;version&gt;1.4.0&lt;/version&gt;
          &lt;/dependency&gt; 
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
              &lt;version&gt;3.2.13.RELEASE&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                      &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-aop&lt;/artifactId&gt;
              &lt;version&gt;3.2.13.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;
              &lt;version&gt;3.2.13.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-expression&lt;/artifactId&gt;
              &lt;version&gt;3.2.13.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.retry&lt;/groupId&gt;
              &lt;artifactId&gt;spring-retry&lt;/artifactId&gt;
              &lt;version&gt;1.0.3.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.persistence&lt;/groupId&gt;
              &lt;artifactId&gt;persistence-api&lt;/artifactId&gt;
              &lt;version&gt;1.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.oracle&lt;/groupId&gt;
              &lt;artifactId&gt;ojdbc5&lt;/artifactId&gt;
              &lt;version&gt;11.2.0.1&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
              &lt;version&gt;1.7.11&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-simple&lt;/artifactId&gt;
              &lt;version&gt;1.6.4&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.17&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-logging&lt;/groupId&gt;
              &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
              &lt;version&gt;1.1.3&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;logkit&lt;/groupId&gt;
              &lt;artifactId&gt;logkit&lt;/artifactId&gt;
              &lt;version&gt;1.0.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j-api&lt;/artifactId&gt;
              &lt;version&gt;2.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j-over-slf4j&lt;/artifactId&gt;
              &lt;version&gt;1.7.11&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-jdbc&lt;/artifactId&gt;
              &lt;version&gt;3.2.13.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.thoughtworks.xstream&lt;/groupId&gt;
              &lt;artifactId&gt;xstream&lt;/artifactId&gt;
              &lt;version&gt;1.4.7&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.javassist&lt;/groupId&gt;
              &lt;artifactId&gt;javassist&lt;/artifactId&gt;
              &lt;version&gt;3.18.1-GA&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.batch&lt;/groupId&gt;
              &lt;artifactId&gt;javax.batch-api&lt;/artifactId&gt;
              &lt;version&gt;1.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
              &lt;version&gt;3.2.13.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
              &lt;version&gt;3.2.13.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;aopalliance&lt;/groupId&gt;
              &lt;artifactId&gt;aopalliance&lt;/artifactId&gt;
              &lt;version&gt;1.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt;
              &lt;artifactId&gt;jsr311-api&lt;/artifactId&gt;
              &lt;version&gt;1.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jboss.logging&lt;/groupId&gt;
              &lt;artifactId&gt;jboss-logging&lt;/artifactId&gt;
              &lt;version&gt;3.3.0.Final&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.6&lt;/source&gt;
                      &lt;target&gt;1.6&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.axis2&lt;/groupId&gt;
                  &lt;artifactId&gt;axis2-wsdl2code-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.6.2&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;wsdl2code&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;unpackClasses&gt;true&lt;/unpackClasses&gt;
                              &lt;packageName&gt;com.globalss.data.processor.service&lt;/packageName&gt;
                              &lt;wsdlFile&gt;src/main/resources/wsdl/MonitoringService.wsdl&lt;/wsdlFile&gt;
                              &lt;databindingName&gt;xmlbeans&lt;/databindingName&gt;
                              &lt;syncMode&gt;sync&lt;/syncMode&gt;
                              &lt;generateServerSide&gt;true&lt;/generateServerSide&gt;
                              &lt;generateServicesXml&gt;true&lt;/generateServicesXml&gt;
                              &lt;generateServerSideInterface&gt;true&lt;/generateServerSideInterface&gt;
  
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;copy-dependencies&lt;/id&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;copy-dependencies&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;outputDirectory&gt;${project.build.directory}&lt;/outputDirectory&gt;
                              &lt;overWriteReleases&gt;false&lt;/overWriteReleases&gt;
                              &lt;overWriteSnapshots&gt;true&lt;/overWriteSnapshots&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
          &lt;resources&gt;
              &lt;resource&gt;
                  &lt;directory&gt;target/generated-sources/axis2/wsdl2code/resources&lt;/directory&gt;
              &lt;/resource&gt;
              &lt;resource&gt;
                  &lt;directory&gt;target/generated-sources/xmlbeans/resources&lt;/directory&gt;
              &lt;/resource&gt;
              &lt;resource&gt;
                  &lt;directory&gt;src/main/resources&lt;/directory&gt;
              &lt;/resource&gt;
              &lt;resource&gt;
                  &lt;directory&gt;src/main/java/com/globalss/dnb/monitor/model/&lt;/directory&gt;
                  &lt;targetPath&gt;com/globalss/dnb/monitor/model/&lt;/targetPath&gt;
                  &lt;includes&gt;
                      &lt;include&gt;*.hbm.xml&lt;/include&gt;
                  &lt;/includes&gt;
              &lt;/resource&gt;
          &lt;/resources&gt;
  
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I tried multiple solutions,but could not resolve it.</p>
  
  <p><strong>1st method)</strong>
  In jboss-5.1.0.GA\lib\endorsed  folder I have this jar<code>(xercesImpl)</code>.
  so I removed that jar, and run the project.</p>
  
  <p><em>Now I get this exception</em></p>
  
  <blockquote>
    <p>xception sending context initialized event to listener instance of
    class org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.BeanDefinitionStoreException:
    Unexpected exception parsing XML document from class path resource
    [spring-batch-context.xml]; nested exception is
    javax.xml.parsers.FactoryConfigurationError: Provider for
    javax.xml.parsers.DocumentBuilderFactory cannot be found</p>
  </blockquote>
  
  <p><strong>2nd) method</strong>
  I tried commented the bellow dependency  from pom.xml</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;jaxen&lt;/groupId&gt;
      &lt;artifactId&gt;jaxen&lt;/artifactId&gt;
      &lt;version&gt;1.1.1&lt;/version&gt;
      &lt;exclusions&gt;
          &lt;exclusion&gt;
              &lt;artifactId&gt;xercesImpl&lt;/artifactId&gt;
              &lt;groupId&gt;xerces&lt;/groupId&gt;
          &lt;/exclusion&gt;
          &lt;exclusion&gt;
              &lt;artifactId&gt;xml-apis&lt;/artifactId&gt;
              &lt;groupId&gt;xml-apis&lt;/groupId&gt;
          &lt;/exclusion&gt;
          &lt;exclusion&gt;
              &lt;artifactId&gt;xmlParserAPIs&lt;/artifactId&gt;
              &lt;groupId&gt;xerces&lt;/groupId&gt;
          &lt;/exclusion&gt;
      &lt;/exclusions&gt;
  &lt;/dependency&gt; 
  </code></pre>
  
  <p>But I get the same exception</p>
  
  <blockquote>
    <p>org.springframework.beans.factory.BeanDefinitionStoreException:
    Unexpected exception parsing XML document from class path resource
    [spring-batch-context.xml]; nested exception is
    java.lang.ClassCastException:
    org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
    javax.xml.parsers.DocumentBuilderFactory  at
    org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:413)</p>
  </blockquote>
  
  <p><strong>3rd) Method</strong>
  I saw some solution regarding the same problem and the solution says to add the bellow dependency</p>
  
  <pre><code>&lt;dependency&gt;
    &lt;groupId&gt;xerces&lt;/groupId&gt;
    &lt;artifactId&gt;xercesImpl&lt;/artifactId&gt;
    &lt;version&gt;2.11.0&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>After adding the above dependency in my pom.xml
  I get this exception</p>
  
  <blockquote>
    <p>org.jboss.xb.binding.JBossXBRuntimeException: Failed to create a new
    SAX parser    at
    org.jboss.xb.binding.UnmarshallerFactory$UnmarshallerFactoryImpl.newUnmarshaller(UnmarshallerFactory.java:100)
      at
    org.jboss.web.tomcat.service.deployers.JBossContextConfig.processContextConfig(JBossContextConfig.java:549)
      at
    org.jboss.web.tomcat.service.deployers.JBossContextConfig.init(JBossContextConfig.java:536)
      at
    org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:279)
      at
    org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
      at
    org.apache.catalina.core.StandardContext.init(StandardContext.java:5436)
      at
    org.apache.catalina.core.StandardContext.start(StandardContext.java:4148)</p>
  </blockquote>
  
  <p><strong>4th) method</strong>
  I tried deleting this jar also
  <a href="https://i.stack.imgur.com/AYsyR.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/AYsyR.jpg" alt="enter image description here"></a></p>
  
  <p>This also dint work for me.</p>
  
  <p>I am damn frustrated with this exception, but I am not able to fix this,</p>
  
  <p>This link is really good and it address the same problem, but still I am not able to fix this can any one help me this.
  <a href="https://stackoverflow.com/questions/11677572/dealing-with-xerces-hell-in-java-maven">Dealing with "Xerces hell" in Java/Maven?</a></p>
  
  <p><strong>Edited</strong> </p>
  
  <p>I have found out the root cause.
  This is snapshot from <code>Jboss 5.1 Run-time</code></p>
  
  <p><a href="https://i.stack.imgur.com/1OTha.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/1OTha.jpg" alt="enter image description here"></a></p>
  
  <p>This is the snapshot from <code>Maven dependency</code>
  <a href="https://i.stack.imgur.com/eauhd.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/eauhd.jpg" alt="enter image description here"></a></p>
  
  <p>So this two jars are conflicting.</p>
  
  <p>So What I did. After building the project I removed the<code>(xml-api1.0.b2.jar)</code> from <code>Myproject.war</code> and manually deployed the project in <code>Jboos</code>, and jboss does not throw error.</p>
  
  <p>But When I do not remove the <code>(xml-api1.0.b2.jar)</code> from <code>myproject.war</code> and deployed in jboss it throws the same error.</p>
  
  <p><strong>So I have to remove the dependency from <code>pom.xml</code>.</strong></p>
  
  <p>for <code>(xml-api1.0.b2.jar)</code> I have defined the bellow dependency </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;dependency&gt;
      &lt;groupId&gt;jaxen&lt;/groupId&gt;
      &lt;artifactId&gt;jaxen&lt;/artifactId&gt;
      &lt;version&gt;1.1.1&lt;/version&gt;
      &lt;exclusions&gt;
          &lt;exclusion&gt;
              &lt;artifactId&gt;xercesImpl&lt;/artifactId&gt;
              &lt;groupId&gt;xerces&lt;/groupId&gt;
          &lt;/exclusion&gt;
          &lt;exclusion&gt;
              &lt;artifactId&gt;xml-apis&lt;/artifactId&gt;
              &lt;groupId&gt;xml-apis&lt;/groupId&gt;
          &lt;/exclusion&gt;
          &lt;exclusion&gt;
              &lt;artifactId&gt;xmlParserAPIs&lt;/artifactId&gt;
              &lt;groupId&gt;xerces&lt;/groupId&gt;
          &lt;/exclusion&gt;
      &lt;/exclusions&gt;
  &lt;/dependency&gt; </code></pre>
  </div>
  </div>
  </p>
  
  <p>But when I comment this dependency from my <code>pom.xml</code> Still I get the jar in Maven dependency as I have shown in the image.</p>
  
  <p><strong>I am really not getting  from where this <code>(xml-api1.0.b2.jar)</code> is cumming.</strong> can any one let me by looking my <code>pom.xml</code>.</p>