首页 > 代码库 > ClassCastException: org.apache.xerces.parsers.XML11Configuration cannot be cast to org.apache.xerces

ClassCastException: org.apache.xerces.parsers.XML11Configuration cannot be cast to org.apache.xerces

一、现象

有两应用,单独部署任意一个应用到weblogic下,正常运行。将两应用部署到一起,启动报:

Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
    at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.<init>(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown Source)
    at com.sun.org.apache.xalan.internal.xsltc.trax.SAX2DOM.createDocument(SAX2DOM.java:324)
    at com.sun.org.apache.xalan.internal.xsltc.trax.SAX2DOM.<init>(SAX2DOM.java:84)
    at com.sun.org.apache.xalan.internal.xsltc.runtime.output.TransletOutputHandlerFactory.getSerializationHandler(TransletOutputHandlerFactory.java:187)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getOutputHandler(TransformerImpl.java:392)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerHandlerImpl.setResult(TransformerHandlerImpl.java:137)
    at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.setup(DomHelper.java:205)
    at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:190)
    at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:181)
    at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:167)
    at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:107)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:949)


二、解决办法

 1、复制应用下的xercesImpl-xxx.jar到weblogic domains\lib,所有应用共享此jar

2、删除受影响应用下的xerces-xxx.jar、xercesImpl-xxx.jar

前提:应用下weblogic.xml的prefer-web-inf-classes值为true(优先加载应用中的类)


webloigc参考版本:10.3.3.0