com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl无法强制转换为javax.xml.soap.MessageFactory

时间:2014-09-09 15:57:40

标签: java spring soap weblogic saaj

我正在使用WebLgic有以下saaj soap消息工厂。我已经尝试不使用messageFactory而只关注soapVersion和Versa。我还尝试了注释掉的不同messageFactory Impl bean。我仍然在标题中收到错误。为什么要尝试使用1.1版?

<bean id="saajMessageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
    <property name="messageFactory">
        <bean class="com.sun.xml.messaging.saaj.soap.MessageFactoryImpl" 
            /> 
        <!-- <bean class="com.sun.xml.messaging.saaj.soap.ver1_2.SOAPMessageFactory1_2Impl" 
            /> -->
        <!-- <bean class="weblogic.xml.saaj.MessageFactoryImpl"/> -->
    </property>
    <property name="soapVersion">
        <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_12" />
    </property>
</bean>

错误:

SAAJ MessageFactory: Unable to create message factory for SOAP: com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl cannot be cast to javax.xml.soap.MessageFactory; nested exception is javax.xml.soap.SOAPException: Unable to create message factory for SOAP: com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl cannot be cast to javax.xml.soap.MessageFactory
            at org.springframework.ws.support.DefaultStrategiesHelper.instantiateBean(DefaultStrategiesHelper.java:188)
            at org.springframework.ws.support.DefaultStrategiesHelper.getDefaultStrategies(DefaultStrategiesHelper.java:134)
            at org.springframework.ws.support.DefaultStrategiesHelper.getDefaultStrategy(DefaultStrategiesHelper.java:219)
            at org.springframework.ws.support.DefaultStrategiesHelper.getDefaultStrategy(DefaultStrategiesHelper.java:203)
            at org.springframework.ws.client.core.WebServiceTemplate.initMessageFactory(WebServiceTemplate.java:310)

pom文件:

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>7.0</version>
</dependency>
<dependency>
    <groupId>com.sun.xml.messaging.saaj</groupId>
    <artifactId>saaj-impl</artifactId>
    <version>1.3.15</version>
</dependency>
<dependency>
    <groupId>javax.xml.soap</groupId>
    <artifactId>saaj-api</artifactId>
    <version>1.3.5</version>
</dependency>

weblogic.xml中:

<prefer-application-packages>
    <package-name>javax.xml.soap.*</package-name>
    <package-name>javax.xml.ws.*</package-name>
    <package-name>com.sun.xml.messsaging.saaj.*</package-name>
</prefer-application-packages> 

我还应该补充一点,我尝试使用各种选项设置各种JVM参数:-Djavax.xml.soap.MessageFactory=weblogic.xml.saaj.MessageFactoryImpl 例如com.sun.xml.messaging.saaj.soap.ver1_2.SOAPMessageFactory1_2Impl。错误消息现在反映了新的Impl类,但我仍然无法解决错误。

1 个答案:

答案 0 :(得分:0)

我不确定到底是什么导致了这个问题的解决,但是当我尝试不同的事情时,我也遇到了其他一些错误,我终于按照这篇文章中的说明完成了所有工作:java.lang.NoClassDefFoundError: org/apache/cxf/jaxrs/impl/UriBuilderImpl。我最终删除了上面的那些pom文件条目。

我做的一件事就是下载一个新版本的Maven,因为我的VM中的一个版本给了我一些问题。