Cannot convert value of type [org.apache.activemq.ra.ActiveMQConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory'

Latest response

Hello,

I have setup JBoss EAP 7.3 and configured the resource adapter subsystem to use it with embedded ActiveMQ 5.6.0

In standalone-full.xml , the connection factory object is defined in the resource adapter subsystem as "org.apache.activemq.ra.ActiveMQManagedConnectionFactory"

The resource adapter subsystem in Jboss standalone-full.xml is as follows:

<subsystem xmlns="urn:jboss:domain:resource-adapters:5.0">
            <resource-adapters>
                <resource-adapter id="activemq-ra.rar">
                    <archive>
                        activemq-ra.rar
                    </archive>
                    <transaction-support>XATransaction</transaction-support>
                    <config-property name="ServerUrl">vm://localhost</config-property>
                    <connection-definitions>
                        <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/activemq/QueueConnectionFactory" enabled="true" use-java-context="true" pool-name="ActiveMQConnectionFactoryPool" use-ccm="true">
                            <xa-pool>
                                <min-pool-size>1</min-pool-size>
                                <max-pool-size>2000</max-pool-size>
                            </xa-pool>
                        </connection-definition>
                    </connection-definitions>
                    <admin-objects>
                        <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name=
                        <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/queue/HELLOWORLDMDBQueue" use-java-context="true" pool-name="HELLOWORLDMDBQueue">
                            <config-property name="PhysicalName">HELLOWORLDMDBQueue</config-property>
                        </admin-object>                     
                        <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/topic/HELLOWORLDMDBTopic" use-java-context="true" pool-name="HELLOWORLDMDBTopic">
                            <config-property name="PhysicalName">HELLOWORLDMDBTopic</config-property>
                        </admin-object>                        
                    </admin-objects>
                </resource-adapter>
            </resource-adapters>
        </subsystem>

But my application which uses spring JMS Template to send and receive messages is expecting a connection factory object of type javax.jms.ConnectionFactory.
This connection factory is a property in the JMSTemplate bean as follows:

<jee:jndi-lookup id="connectionFactory" jndi-name="java:/activemq/QueueConnectionFactory"/>

<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory" ref="connectionFactory" />
        <property name="defaultDestination" ref="abcdQueue" />
</bean>

Because of this type difference i am getting the following exception when deploying my app in JBoss.

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsTemplate' defined in class path resource [core-config.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.apache.activemq.ra.ActiveMQConnectionFactory' to required type 'javax.jms.ConnectionFactory' for property 'connectionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.apache.activemq.ra.ActiveMQConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory': no matching editors or conversion strategy found
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
...
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.apache.activemq.ra.ActiveMQConnectionFactory' to required type 'javax.jms.ConnectionFactory' for property 'connectionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.apache.activemq.ra.ActiveMQConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory': no matching editors or conversion strategy found

I have removed/commented out the messaging subsystem in standalone-full.xml so that the activemq-ra.rar that comes with activeMQ Artemis doesn't interfere with the one i am using(I have placed activemq-ra.rar file in JBoss deployment directory)

I have attached my standalone-full.xml

My Environment is as below
JBoss EAP 7.3.0 with Embedded ActiveMQ 5.6.0
JDK 8
Windows

I am relatively new to JBoss and I really appreciate any guidance on this.

Attachments

Responses