我目前正在为我的应用程序使用Tomcat服务器,并且pom.xml中的以下代码为我提供了适用于soap 1.2协议的SAAJ版本1.3。但是,当我们将服务器迁移到Websphere时,出现以下错误。
<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
<property name="soapVersion">
<util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_12"/>
</property>
</bean>
来自tomcat的控制台:
2013-10-11 11:12:51信息SaajSoapMessageFactory:135-使用SOAP 1.2协议创建SAAJ 1.3 MessageFactory
2013-10-11 11:12:51调试SaajSoapMessageFactory:163-使用MessageFactory类[com.sun.xml.internal.messaging.saaj.soap.ver1_2.SOAPMessageFactory1_2Impl]
Websphere错误:
PropertyAccessException 1:org.springframework.beans.MethodInvocationException:属性'soapVersion'抛出异常;嵌套的异常是java.lang.IllegalArgumentException:SAAJ 1.1和1.2仅支持SOAP 1.1
我已经走了由Maven(SaajSoapMessageFactory)生成的jar文件,并且从此类抛出了错误。
try {
if (SaajUtils.getSaajVersion() >= SaajUtils.SAAJ_13) {
if (!StringUtils.hasLength(messageFactoryProtocol)) {
messageFactoryProtocol = SOAPConstants.SOAP_1_1_PROTOCOL;
}
if (logger.isInfoEnabled()) {
logger.info("Creating SAAJ 1.3 MessageFactory with " + messageFactoryProtocol);
}
messageFactory = MessageFactory.newInstance(messageFactoryProtocol);
}
else if (SaajUtils.getSaajVersion() == SaajUtils.SAAJ_12) {
logger.info("Creating SAAJ 1.2 MessageFactory");
messageFactory = MessageFactory.newInstance();
}
else if (SaajUtils.getSaajVersion() == SaajUtils.SAAJ_11) {
logger.info("Creating SAAJ 1.1 MessageFactory");
messageFactory = MessageFactory.newInstance();
}
**else {
**throw new IllegalStateException(
"SaajSoapMessageFactory requires SAAJ 1.1, which was not found on the classpath");**
}**
}
请提出建议,为什么tomcat可以正常工作,而Websphere无法获得正确的SAAJ版本。此外,我们正在使用Websphere 6.1.23
最佳答案
我刚刚注意到,我们在tomcat中构建的应用程序正在使用JDK1.6,但Websphere 6.1仅支持jdk1.5。
我们必须要使用websphere7。 6.x不支持jdk1.6