Struts 2.3.16.1升级为Spring框架中的Struts xwork和SimpleMessageListenerContainer提供了TypeMismatchException [英] struts 2.3.16.1 upgrades giving TypeMismatchException for struts xwork and SimpleMessageListenerContainer in Spring framework
问题描述
我已从struts 2.0升级到2.3.16.1,以便将struts中的最新安全修复程序添加到我的Web应用程序中
I have been upgraded from struts 2.0 to 2.3.16.1 for get the latest security fixes in struts to my web application
当我升级到tomcat服务器中的部署时,它出现以下错误:
when I upgraded deployed in tomcat server it gives following errors:
原因:无法加载配置. -拦截器-jar:file:/C:/Projects/apache-tomcat-7.0.50/webapps/myweb/WEB-INF/lib/struts2-core-2.3.16.1.jar!/struts-default.xml:167: 106 在com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58) 在org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:445) 在org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:489)
Caused by: Unable to load configuration. - interceptor - jar:file:/C:/Projects/apache-tomcat-7.0.50/webapps/myweb/WEB-INF/lib/struts2-core-2.3.16.1.jar!/struts-default.xml:167:106 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:445) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:489)
原因:注册Interceptor类org.apache.struts2.interceptor.FileUploadInterceptor时捕获异常-拦截器-jar:file:/C:/Projects/apache-tomcat-7.0.50/webapps/myweb/WEB-INF/lib/struts2-core-2.3.16.1.jar!/struts-default.xml:167:106
Caused by: Caught Exception while registering Interceptor class org.apache.struts2.interceptor.FileUploadInterceptor - interceptor - jar:file:/C:/Projects/apache-tomcat-7.0.50/webapps/myweb/WEB-INF/lib/struts2-core-2.3.16.1.jar!/struts-default.xml:167:106
原因:org.springframework.beans. TypeMismatchException:无法将类型[org.springframework.jms.listener.SimpleMessageListenerContainer]的属性值转换为所需的类型[com.opensymphony.xwork2.inject .[Container] for property'container';嵌套异常是java.lang.IllegalArgumentException:无法将属性容器"的[org.springframework.jms.listener.SimpleMessageListenerContainer]类型的值转换为所需的类型[com.opensymphony.xwork2.inject.Container] ':找不到匹配的编辑器或转换策略
Caused by: 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
为方便起见,下面给出了我的配置
my configurations are given below for your convenience
<dependency>
<groupId>com.opensymphony</groupId>
<artifactId>xwork</artifactId>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.3.16.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.3.16.1</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.3.16.1</version>
</dependency>
<dependency>
<groupId>ognl</groupId>
<artifactId>ognl</artifactId>
<version>3.0.8</version>
</dependency>
spring bean.xml的配置
<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="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory" />
<property name="defaultDestination" ref="requestQueue" />
</bean>
<bean id="requestQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="MYEMAILQUEUE" />
</bean>
<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616?keepAlive=true" />
</bean>
感谢任何人都可以提出解决方案或想法来解决此问题.
Appreciate that if anyone can give a solution or an idea to fix this issue.
推荐答案
将pom.xml缩小为以下内容,并允许Maven解决缺少的依赖项:
Reduce your pom.xml to the following content and allow Maven to resolve missing dependencies:
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.3.16.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
这篇关于Struts 2.3.16.1升级为Spring框架中的Struts xwork和SimpleMessageListenerContainer提供了TypeMismatchException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!