spring-ws-2.2.0 与 spring 4 兼容吗?

Is spring-ws-2.2.0 compatible with spring 4?

我正在尝试从 Spring 3 升级到 4,但我偶然发现了一个问题。我们使用 spring-ws,我已经更新到最新版本 (2.2.0)。我收到 java.lang.NoSuchMethodError 异常

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'reportWebServiceTemplate' defined in class path resource [config/report_ws_context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.ws.client.core.WebServiceTemplate]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org/springframework/util/ClassUtils.forName(Ljava/lang/String;)Ljava/lang/Class;
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:278)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1114)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1017)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    ... 40 more
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.ws.client.core.WebServiceTemplate]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org/springframework/util/ClassUtils.forName(Ljava/lang/String;)Ljava/lang/Class;
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:164)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:125)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:270)
    ... 49 more
Caused by: java.lang.NoSuchMethodError: org/springframework/util/ClassUtils.forName(Ljava/lang/String;)Ljava/lang/Class;
    at org.springframework.ws.support.DefaultStrategiesHelper.getDefaultStrategies(DefaultStrategiesHelper.java:114)
    at org.springframework.ws.support.DefaultStrategiesHelper.getDefaultStrategies(DefaultStrategiesHelper.java:90)
    at org.springframework.ws.client.core.WebServiceTemplate.initMessageSenders(WebServiceTemplate.java:321)
    at org.springframework.ws.client.core.WebServiceTemplate.initDefaultStrategies(WebServiceTemplate.java:307)
    at org.springframework.ws.client.core.WebServiceTemplate.<init>(WebServiceTemplate.java:143)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:527)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)

report_ws_context.xml 有这个:

<bean id="reportWebServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
<constructor-arg ref="messageFactory" />
<property name="messageSender" ref="messageSender" />
<property name="marshaller" ref="getReportInfoMarshaller" />
<property name="unmarshaller" ref="getReportInfoUnmarshaller" />
<property name="defaultUri" ref="reportingServiceUri" />
<property name="interceptors" ref="securityInterceptor"/>

spring-ws class 似乎正在尝试调用 spring-core-4 中不再存在的方法。我的印象是 spring-ws 2.2.0 与 spring 4.

兼容

准确地说,我有 Spring 4.0.6。 对于 spring-ws 我正在使用 spring-ws-core-2.2.0.RELEASE.jar

如有任何见解,我们将不胜感激

是的,是compatible

从其他方面 Spring 集成也使用 Spring WS 2.2,并且在升级到 Spring Framework 4.2 的过程中已经没有任何问题。

请确保您的类路径中确实没有这些框架的旧版本。