cxf部署到weblogic上遇到的问题
服务器端问题
javax.jws.webService.portName 找不到的错误
打开bea/weblogic92/common/bin/commEnv.cmd或commEnv.sh,在CLASSPATH后加入:
%WL_HOME%\server\lib\geronimo-ws-metadata_2.0_spec-1.1.2.jar
并把geronimo-ws-metadata_2.0_spec-1.1.2.jar包放入bea/weblogic92/server/lib下
java.lang.UnsupportedOperationException: This class does not support SAAJ 1.1
javax.xml.ws.WebServiceException: java.lang.UnsupportedOperationException: This class does not support SAAJ 1.1 Caused by: java.lang.UnsupportedOperationException: This class does not support SAAJ 1.1
解决
- 打开startWebLogic.cmd或startWebLogic.sh文件
- 把saaj的相关包放入工程lib目录,saaj-api-1.3.jar, saaj-impl-1.3.2.jar
- 在set JAVA_OPTIONS=%SAVE_JAVA_OPTIONS%的下一行加入以下语句
set JAVA_OPTIONS=%JAVA_OPTIONS% -Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl
在weblogic上调用cxf客户端时可能出现的问题:
javax.xml.stream.supportDTD 找不到的错误
加入以下系统变量
static {
System.setProperty("javax.xml.stream.XMLInputFactory",
"com.ctc.wstx.stax.WstxInputFactory");
System.setProperty("javax.xml.stream.XMLOutputFactory",
"com.ctc.wstx.stax.WstxOutputFactory");
System.setProperty("javax.xml.stream.XMLEventFactory",
"com.ctc.wstx.stax.evt.WstxEventFactory");
}
并在 \bea\weblogic92\server\lib\consoleapp\META-INF\weblogic-application.xml
中加入:
<!-- 2011-6-7 linjun -->
<package-name>javax.jws.*</package-name>
<package-name>javax.xml.soap.*</package-name>
<package-name>javax.xml.stream.*</package-name>
<package-name>javax.xml.stream.events.*</package-name>
<package-name>javax.xml.stream.util.*</package-name>
java.lang.ClassCastException: com.ctc.wstx.stax.WstxInputFactory
经CH验证,删去工程中引入的wstx-asl-3.2.9.jar即可。