weblogic.webservice.core.soap.MessageFactoryImpl cannot be cast to javax.xml.soap.MessageFactory

我的梦境 提交于 2019-12-10 10:15:36

问题


I am stuck with the following error when I deploy my web-services client application in weblogic. [This application has been working without any issues in 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

Here is the bean definition in ws-config.xml

(bean id="saajSoapMessageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory")

I tried searching for this issue, but unfortunately could not find any solution. Am I missing anything in the spring config? Has any one faced this issue before?


回答1:


I've not come across this - but what's happening is that Weblogic uses it's own default for the MessageFactoryImpl

Check your weblogic startup logs and you will see some parameters set such as

javax.xml.rpc.ServiceFactory = weblogic.webservice.core.rpc.ServiceFactoryImpl
javax.xml.soap.MessageFactory = weblogic.webservice.core.soap.MessageFactoryImpl

You can try 2 options (I dont know which will work, try it out)

A)

In your client, set these yourself to the Spring equivalents

System.setProperty("javax.xml.soap.MessageFactory",      "org.springframework.ws.soap.saaj.SaajSoapMessageFactory");
System.setProperty( "javax.xml.rpc.ServiceFactory",      "** Spring version **");

B) Pass your required version as a -D parameter in the startWeblogic.cmd

-Djavax.xml.soap.MessageFactory=org.springframework.ws.soap.saaj.SaajSoapMessageFactory

and add saaj jars to the weblogic classpath.



来源:https://stackoverflow.com/questions/8210702/weblogic-webservice-core-soap-messagefactoryimpl-cannot-be-cast-to-javax-xml-soa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!