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

时间:2014-04-08 04:00:06

标签: java spring tomcat struts2 maven-2

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

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

  

引起:无法加载配置。 - 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       在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)

     

引起:注册Interceptor类时出现异常org.apache.struts2.interceptor.FileUploadInterceptor - interceptor - jar:file:/ C:/Projects/apache-tomcat-7.0.50/webapps/myweb/WEB-INF/ LIB / struts2的核 - 2.3.16.1.jar /struts-default.xml:167:106

     

引起:org.springframework.beans。 TypeMismatchException:无法将[org.springframework.jms.listener.SimpleMessageListenerContainer]类型的属性值转换为必需类型[com.opensymphony.xwork2.inject .Container]属性'容器';嵌套异常是java.lang.IllegalArgumentException:无法将类型[org.springframework.jms.listener.SimpleMessageListenerContainer]的值转换为属性'容器所需的类型[com.opensymphony.xwork2.inject.Container] ':找不到匹配的编辑器或转换策略

为方便起见,我的配置如下:

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>
文件夹的

配置

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

欣赏如果有人能提出解决方案或想法来解决这个问题。

2 个答案:

答案 0 :(得分:1)

我想这与错误的库有关。

仔细检查Struts2 project dependencies

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

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

答案 1 :(得分:1)

将pom.xml减少为以下内容,并允许Maven解决缺少的依赖项:

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