将应用部署在weblogic中于axis2冲突的问题及解决方案
![star](https://csdnimg.cn/release/downloadcmsfe/public/img/star.98a08eaa.png)
"将应用部署在Weblogic中与Axis2冲突的问题及解决方案" 问题描述 在将应用部署到Weblogic Server 10.3时,出现了一个错误,抛出ClassCastException异常,具体错误信息为: `java.lang.ClassCastException: com.ctc.wstx.stax.WstxInputFactory` 问题分析 该错误的根本原因是Axis2使用了StAX API,导致与Weblogic Server 10.3的XML Input Factory冲突。在Weblogic Server 10.3.4中,这个问题可以通过在WEB-INF\lib目录下配置weblogic.xml文件来解决。该文件的配置内容如下: ```xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd"> <weblogic-web-app > <container-descriptor> <prefer-web-inf-classes>true</prefer-web-inf-classes> </container-descriptor> <context-root>/</context-root> </weblogic-web-app> ``` 其中, `<prefer-web-inf-classes>true</prefer-web-inf-classes>` 配置项用于解决项目中的包与Weblogic的包冲突的问题。当Weblogic启动遇到包冲突问题时,优先加载项目WEB-INF\lib目录下的包。 解决方案 解决该问题的方法是删除项目WEB-INF\lib目录下的wstx-asl-3.2.4.jar包,该包是Axis2使用的StAX API实现。删除该包后,Weblogic Server 10.3可以正确地部署应用程序。 相关知识点 1. Weblogic Server 10.3的XML Input Factory机制 Weblogic Server 10.3使用了XML Input Factory机制来解析XML文件。在该机制下,Weblogic Server会优先加载自己的XML解析器,而不是从WEB-INF\lib目录下加载。因此, Axis2使用的StAX API会与Weblogic Server 10.3的XML Input Factory冲突。 2. prefer-web-inf-classes配置项 prefer-web-inf-classes配置项用于解决项目中的包与Weblogic的包冲突的问题。当该配置项设置为true时,Weblogic Server会优先加载项目WEB-INF\lib目录下的包,以解决包冲突的问题。 3. Axis2的StAX API实现 Axis2使用了StAX API来解析XML文件。StAX API是Streaming API for XML的缩写,用于高效地解析大型XML文件。在Weblogic Server 10.3中,Axis2的StAX API实现会与Weblogic Server的XML Input Factory冲突。 结论 将应用部署在Weblogic Server 10.3中与Axis2冲突的问题可以通过删除项目WEB-INF\lib目录下的wstx-asl-3.2.4.jar包来解决。同时,也可以通过在WEB-INF\lib目录下配置weblogic.xml文件来解决包冲突的问题。
![text/plain](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![application/x-zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![application/msword](https://img-home.csdnimg.cn/images/20210720083327.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083646.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
- 粉丝: 1
- 资源: 7
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)
- 1
- 2
- 3
前往页