Hi Jonas-

Definitely looks like a class loading issue where you probably have a collision 
with jms-2.0 api jars. You should only have one, so you probably need to add an 
exclusion to one of the dependencies — spring-jms or break down activemq-client 
to the discrete jars— activemq-client, activemq-broker, etc. 

I sent you a Slack invite.

-Matt Pavlovich

> On May 8, 2024, at 4:19 AM, Jonas Jansson <mathiastheni...@gmail.com> wrote:
> 
> Hi folks, i desperately need som guidance as to how to get my ActiveMQ
> upgrade to work with Tomcat and Spring5.
> (If Slack is better, happy to get an invitation!)
> 
> 
> 
> ---BACKGROUND
> Been running 3 webapps with an in-memory activeMQ broker for intra-app
> communication for 10+ years.
> I have had the activemq-all jar in tomcat's /lib, because i wanted to
> reduce the overall classloader memory footprint. All other jars such as
> Spring has been in the respective war/lib directories.
> 
> This has been Spring 4.3 and ActiveMQ 5.14. I have defined the broker
> through Spring to that the first webapp deployed starts the broker
> Running on Tomcat 9
> 
> 
> This setup has worked fine for me.
> 
> 
> — UPGRADE PROBLEM
> I am looking to update to Spring 5 the easiest way I can, changing as
> little as possible, keeping config the same. Optimally i stay on 5.14 for
> now, but i can upgrade to 5.18 if i have to.
> 
> What i'm getting is something that seems to be a clash with the jms1.1 /
> 2.0 support? From what i've read 5.18 comes with 2.0 support but i tried to
> use 5.18.4 and i get the same.
> 
> Eerror message:
> Unsatisfied dependency expressed through constructor parameter 0: Could
> not convert argument value of type
> [org.apache.activemq.spring.ActiveMQConnectionFactory] to required type
> [javax.jms.ConnectionFactory]: Failed to convert value of type
> 'org.apache.activemq.spring.ActiveMQConnectionFactory' to required type
> 'javax.jms.ConnectionFactory'; nested exception is
> java.lang.IllegalStateException: Cannot convert value of type
> 'org.apache.activemq.spring.ActiveMQConnectionFactory' to required type
> 'javax.jms.ConnectionFactory': no matching editors or conversion strategy
> found
> 
> I have tried doing maven dependencies and building, rather than using the
> “activemq-all”, and that does seem to work. But this would mean that every
> class would be loaded into memory three times, and I’d like to avoid that
> if at all possible.
> 
> 
> **If someone could help me getting my Spring 5 running with Tomcat(9) I'd
> be most grateful.
> 
> 
> 
> — SETUP
> 
> Java 11
> Spring 5.3.33
> ActiveMQ 5.14 (or 5.18.4, tried everything)
> 
> I have the javax.jms-api 2.0.1 on the classpath because Spring 5 requires
> it.
> I have tried both having and not having jms1.1 on the classpath, no
> difference.
> 
> Spring messaging setup:
> <amq:connectionFactory id="refConnectionFactory" brokerURL="vm://myBroker"
> clientID="webapp"/>
> <bean id="connectionFactory"
> class="org.springframework.jms.connection.CachingConnectionFactory">
>    <constructor-arg ref="refConnectionFactory"/>
>    <property name="sessionCacheSize" value="4"/>
> </bean>
> 
> <!-- JmsTemplate Definition -->
> <bean id="jmsTemplate" class="com.mypackage.MyTemplate">
>    <constructor-arg ref="connectionFactory"/>
> </bean>

Reply via email to