版本2.3.15.3到2.3.16之间的com.opensymphony.xwork2.inject.Container类有什么区别吗

时间:2014-04-08 11:16:51

标签: struts2 xwork

我认为在早期版本(2.3.16之前)org.springframework.jms.listener.SimpleMessageListenerContainer可以转换为com.opensymphony.xwork2.inject.Container。在它之后它给出以下错误....

org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.springframework.jms.listener.SimpleMessageListenerContainer] to required type [com.opensymphony.xwork2.inject.Container] for property 'container'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.springframework.jms.listener.SimpleMessageListenerContainer] to required type [com.opensymphony.xwork2.inject.Container] for property 'container': no matching editors or conversion strategy found
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329)
    at com.opensymphony.xwork2.spring.SpringObjectFactory.autoWireBean(SpringObjectFactory.java:203)
    at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:183)
    at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:154)
    at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:171)
    at com.opensymphony.xwork2.factory.DefaultInterceptorFactory.buildInterceptor(DefaultInterceptorFactory.java:42)
    ... 31 more
Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [org.springframework.jms.listener.SimpleMessageListenerContainer] to required type [com.opensymphony.xwork2.inject.Container] for property 'container': no matching editors or conversion strategy found
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
    ... 40 more

1 个答案:

答案 0 :(得分:1)

早些时候配置bean文件..

.............
.............
<bean id="container" class="org.springframework.jms.listener.SimpleMessageListenerContainer">
    <property name="connectionFactory" ref="connectionFactory" />
    <property name="messageListener" ref="listener" />
    <property name="destination" ref="requestQueue" />
</bean>
.............
.............

它必须像下面那样改变

.............
.............
<bean id="jmsContainer" class="org.springframework.jms.listener.SimpleMessageListenerContainer">
    <property name="connectionFactory" ref="connectionFactory" />
    <property name="messageListener" ref="listener" />
    <property name="destination" ref="requestQueue" />
</bean>
.............
.............