Configure JMS queue on JBOSS EAP 6.4

Latest response

Hi All,
I am trying to configure JMS queue with JBOSS EAP 6.4 using spring jms API's. Below are the configuration details -
1] Jboss version : 6.4 EAP
2]Spring version : 4.1.5.RELEASE including jms
3]Below is the configuration details of application-context.xml
<?xml version="1.0" encoding="UTF-8"?>

<context:annotation-config />
<aop:aspectj-autoproxy />
<context:component-scan base-package="com.mohh.nehr.commonUtil" />

<bean
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location">
        <value>classpath:/portlet.properties</value>
    </property>
</bean>
<bean id="jndiTemplate" class="com.mohh.nehr.commonUtil.service.CustomJndiTemplate">
</bean>
<bean id="destination" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiTemplate" ref="jndiTemplate"></property>
    <property name="jndiName" value="${java.jms.destination}"></property>
</bean>
<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiTemplate" ref="jndiTemplate"></property>
    <property name="jndiName" value="${java.connectionFactory}"></property>
</bean>
<bean id="queueConnectionFactory"
    class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
    <property name="targetConnectionFactory" ref="connectionFactory"></property>
    <property name="username" value="${java.jms.username}"></property>
    <property name="password" value="${java.jms.password}"></property>
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="queueConnectionFactory"></property>
    <property name="defaultDestination" ref="destination" />
</bean>
<bean id="messageListenerReceiver"
    class="com.mohh.nehr.commonUtil.audit.AccessLoggerListener">
</bean>
<bean id="messageListenerContainer"
    class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    <property name="connectionFactory" ref="queueConnectionFactory"></property>
    <property name="destination" ref="destination"></property>
    <property name="messageListener" ref="messageListenerReceiver"></property>
</bean>

In addition i am using pretty much template api and code nothing fancy. It worked successfully on my local when i tried to run using standalone java program but when i deployed on DEV environment i am getting below error.

Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.hornetq.jms.client.HornetQJMSConnectionFactory' to required type 'javax.jms.ConnectionFactory' for property 'connectionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.hornetq.jms.client.HornetQJMSConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory': no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:476)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:512)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:506)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1515)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1474)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
... 269 common frames

I am really not sure from where its picking the class org.hornetq.jms.client.HornetQJMSConnectionFactory as i havent provided any reference of it in aplication-context.xml. In addition i am passing all dependencies like springJms, jbossClient in provided mode so that they will be provided by container.

Any help will be highly appreciated.

Responses

I suspect that your issue is with ${java.connectionFactory}. What does it point at in JBoss JNDI registry?

Yes its pointing to jms/RemoteConnectionFactory of Jboss.

Can anyone provide any help on this please?

Are you running this spring application as standalone or inside JBoss EAP? If you are running it inside JBoss EAP then you shouldn't be using jms/RemoteConnectionFactory.

Its working when i am running it as standalone. I am facing issue when i am trying to use it inside JBoss EAP. If not jms/RemoteConnectionFactory then what should be used here? Can you please provide more details?

Can anyone provide any help on this please?