Exception: java.lang.ClassCastException: weblogic.xml.jaxp.RegistrySAXParserFactory can not be cast to javax.xml.parsers.SAXParserFactory

2

When I deploy my Web Application in the WebLogic it sends the following error:

  

exception java.lang.ClassCastException:   weblogic.xml.jaxp.RegistrySAXParserFactory can not be cast   javax.xml.parsers.SAXParserFactory

Someone could please guide me as to what may be the reason for this exception.

    
asked by jose 11.10.2017 в 20:30
source

1 answer

1

The basic reason is that the classes are not compatible. Normally this conflict is because of the xml-apis.jar file that is self-included with certain artifact assembly tools, such as maven or ant. If you are using maven remove the reference to xml-apis.jar . If you do not use maven, make sure it does not appear inside your artifact (.war file) in the WEB-INF/lib/ directory.

<project>
  ...
  <dependencies>
    <dependency>
      <groupId>biblioteca-que-usa-xml-apis</groupId>
      <artifactId>artefacto</artifactId>
      <version>1.0</version>
      <scope>compile</scope>
      ...
      <exclusions>
        <exclusion>  <!-- pon aquí la clase que quieres excluir -->
          <groupId>xml-apis</groupId>
          <artifactId>xml-apis</artifactId>
          <version>1.4.01</version>
        </exclusion>
      ...
      </exclusions> 
    </dependency>
  </dependencies>
</project>
    
answered by 11.10.2017 / 21:04
source