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
 
 
 

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.

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> 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值