2

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

when I upgraded deployed in tomcat server it gives following errors:

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

my configurations are given below for your convenience

maven configuration in pom.xml is given bellow

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

configuration of 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.

Roman C
  • 49,761
  • 33
  • 66
  • 176
Prabath
  • 35
  • 1
  • 8

2 Answers2

1

I guess this has something to do with wrong libraries.

Check out carefully the Struts2 project dependencies.

This

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

Should be 2.3.16.1 like the others for example...

Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243
  • maven doesn't have any xwork version than 2.1.3 http://mvnrepository.com/search.html?query=xwork http://www.findjar.com/ – Prabath Apr 08 '14 at 09:34
  • I couldn't find any other updated version in xwork than 2.1.3 http://mvnrepository.com/search.html?query=xwork (2.0.3) http://www.findjar.com/jar/com/opensymphony/xwork/2.1.3/xwork-2.1.3.jar.html (2.1.3)couldn't be compatibility issue of spring-jms with xwork – Prabath Apr 08 '14 at 09:43
  • It is no more com.opensymphony.xwork, it is org.apache.struts.xwork: http://mvnrepository.com/artifact/org.apache.struts.xwork/xwork-core – Andrea Ligios Apr 08 '14 at 09:43
  • Thanks you kind support. Yes I tried with your hints but still issue as same. unable to solve still says type mismatch exception. it seems spring version doesn't compatible with struts latest version. still trying. if anything more appreciate that share. – Prabath Apr 08 '14 at 14:59
  • Ensure you have all the libraries needed. For example, you listed spring-jms, but not spring-core. I assume you have it, but without putting it here, we can't see its version... – Andrea Ligios Apr 08 '14 at 15:13
  • Hi Andrea, Sorry for the late reply. Here are the spring versions I'm using, ### org.springframework spring 2.5.6 org.springframework spring-core 4.0.3.RELEASE ### still not fix the issue, trying with certain ways... apricate your kind support on this.... – Prabath Apr 09 '14 at 08:35
  • You can't use `Spring-2.5.6`, `Spring-core-4.0.3`, `Spring-jms-3.0.5`... **O_o** Download ALL your spring files with the same version, that must also be a version compatible with Struts, so I would go with 3.0.5 for everyone. – Andrea Ligios Apr 09 '14 at 08:40
  • The simplest solution is to remove `xwork` dependency, Maven will resolve missing dependencies of `struts-core` for you ;-) – Lukasz Lenart Apr 11 '14 at 06:12
  • Well, I guess this comment should be an answer @LukaszLenart – Andrea Ligios Apr 11 '14 at 08:03
  • Hi issue still not fixed. Trying with your suggestions but still giving same error message. Tested with following changes. Added namespace in springBean.xml as xmlns:jms="http://www.springframework.org/schema/jms" xsi:schemaLocation="http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-3.0.xsd" tried with spring 3.0.5 and removed xwork dependency also. I guess something was worong at initiate in the upgrade. Anyway thanks a lot for your ideas. I'll try to fix this issue. – Prabath Apr 16 '14 at 12:44
  • Hi Friends Thanks a lot and highly appreciating all your supports gave to resolve my issue. Even after doing all changes couldn't fix the issue. But finally I just done simple change in spring bean xml file as bellow then issue was fixed. ` ` changed the bean id **container** as **jmsContainer** – Prabath Apr 24 '14 at 03:31
  • I followed below refferences to find out the fix. http://docs.spring.io/spring/docs/2.5.6/reference/jms.html http://docs.spring.io/spring/docs/3.0.x/spring-framework-reference/html/jms.html But unfortunately I couldn't find the exact reason behind of that. According to my understands upgraded struts xwork unable to find the bean id **container** it finds **jmsContainer** I need to get to know what is the reason, where they mentioned it and why it is happening. Appreciate If anyone can give an idea about it. Thanks Andrea Ligios and Lukasz Lenart. – Prabath Apr 24 '14 at 03:36
1

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>
Lukasz Lenart
  • 987
  • 7
  • 14