当我在weblogic中部署Web服务客户端应用程序时,遇到以下错误. [此应用程序一直在运行,tomcat中没有任何问题.]
Cannot resolve reference to bean ‘saajSoapMessageFactory’ while
setting constructor argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name ‘saajSoapMessageFactory’ defined in class path
resource […/core/ws/ws-config.xml]: Invocation of init method
Failed; nested exception is
org.springframework.ws.soap.SoapMessageCreationException: Could not
create SAAJ MessageFactory: Unable to create message factory for SOAP:
weblogic.webservice.core.soap.MessageFactoryImpl cannot be cast to
javax.xml.soap.MessageFactory; nested exception is
javax.xml.soap.SOAPException: Unable to create message factory for
SOAP: weblogic.webservice.core.soap.MessageFactoryImpl cannot be cast
to javax.xml.soap.MessageFactory
这是ws-config.xml中的bean定义
(bean id="saajSoapMessageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory")
检查您的weblogic启动日志,您将看到一些参数设置,例如
javax.xml.rpc.ServiceFactory = weblogic.webservice.core.rpc.ServiceFactoryImpl
javax.xml.soap.MessageFactory = weblogic.webservice.core.soap.MessageFactoryImpl
您可以尝试2个选项(我不知道哪个可行,请尝试一下)
一种)
在您的客户中,将自己设置为Spring等效项
System.setProperty("javax.xml.soap.MessageFactory","org.springframework.ws.soap.saaj.SaajSoapMessageFactory");
System.setProperty( "javax.xml.rpc.ServiceFactory","** Spring version **");
B)在startWeblogic.cmd中将所需版本作为-D参数传递
-Djavax.xml.soap.MessageFactory = org.springframework.ws.soap.saaj.SaajSoapMessageFactory
并将saaj jars添加到weblogic的类路径中.