Caused by: java.lang.ClassCastException: weblogic.xml.jaxp.RegistryXMLReader

Caused by: java.lang.ClassCastException: weblogic.xml.jaxp.RegistryXMLReader cannot be cast to org.apache.xerces.xs.PSVIProvider
 
XML解析器和weblogic的冲突了
解决办法
-Djava.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
 
 
http://stackoverflow.com/questions/4925901/classcastexception-while-parsing-xml-with-weblogic
 

Typically such problems happen when there are several versions of the same class in class path while those versions are loaded by different class loaders. One version of DocumentBuilderFactory was loaded by system class loader, other by class loader of your enterprise application. When you are calling the XML parser the parent's version of the class is used. When you are casting yours private version is utilized. These versions are incompatible that causes ClassCastException.

0 down vote

I wanted make a slight addition to the previous answers to this question, in the event that anyone else is in the same situation I was. I had the same problem on our WebLogic 9.2 server due to my use of CXF 2.2.3. In addition to the removal of the xml-apis.jar mentioned previously, I also had to remove a xmlParserAPIs library.

As I am using Maven2 it was just a simple matter of adding another inclusion.

    <!-- CXF -->      <dependency>          <groupId>org.apache.cxf</groupId>          <artifactId>cxf-bundle</artifactId>          <version>${dependency.version.cxf}</version>          <scope>compile</scope>          <exclusions>              <exclusion>                  <artifactId>xml-apis</artifactId>                  <groupId>xml-apis</groupId>              </exclusion>              <exclusion>                  <artifactId>xercesImpl</artifactId>                  <groupId>xerces</groupId>              </exclusion>              <exclusion>                  <artifactId>xmlbeans</artifactId>                  <groupId>org.apache.xmlbeans</groupId>              </exclusion>              <exclusion>                  <artifactId>xmlParserAPIs</artifactId>                  <groupId>xerces</groupId>              </exclusion>          </exclusions>      </dependency>  

你可能感兴趣的:(maven,weblogic,server,System,Class,casting)