java - struts 2.3.16.1 升级为 Spring 框架中的 struts xwork 和 SimpleMessageListenerContainer 提供 TypeMismatchException

标签 java spring tomcat struts2 maven-2

我已从 struts 2.0 升级到 2.3.16.1,以便将 struts 中的最新安全修复程序获取到我的 Web 应用程序

当我升级部署在 tomcat 服务器中时,出现以下错误:

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)

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

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

为了您的方便,下面给出了我的配置

pom.xml 中的 maven 配置如下

<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>

如果有人能够提供解决方案或解决此问题的想法,我们将不胜感激。

最佳答案

我猜这与错误的库有关。

仔细查看Struts2 project dependencies .

这个

<dependency>
    <groupId>com.opensymphony</groupId>
    <artifactId>xwork</artifactId>
    <version>2.1.3</version>
</dependency>

应该像其他的一样2.3.16.1...

关于java - struts 2.3.16.1 升级为 Spring 框架中的 struts xwork 和 SimpleMessageListenerContainer 提供 TypeMismatchException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22927262/

相关文章:

spring - 在 Spring JPA Hibernate 中使用蛇形案例

java - Spring Boot @ControllerAdvice 部分工作,不适用于自定义异常

spring - 性能 - Spring Boot - 服务器响应时间

java - 修改build.xml为tomcat的另一个路径

java - 在 Linux (Red Hat) 中为 Tomcat 中的 Java Web 应用程序设置全局环境变量

java - 通过 ePass 2003 token 在 Linux 服务器上进行 DSC 签名

java - 如何使用 XJC 使用一些现有的 Java 类生成 JAXB 类?

java - 每个 DAO 中的 EntityManager 配置

java - 为什么使用私有(private)锁而不是内部锁?

java - 正确建模数据库中的历史记录