I have a HornetQ JMS queue set on JBoss EAP6, in the standalone.xml file.
<hornetq-server>
[...]
<jms-connection-factories>
<connection-factory name="RemoteConnectionFactory">
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>
</entries>
</connection-factory>
</jms-connection-factories>
<jms-destinations>
<jms-queue name="WorkflowExecution">
<entry name="/queue/MyQueue"/>
<entry name="java:jboss/exported/queue/MyQueue"/>
</jms-queue>
</jms-destinations>
</hornetq-server>
The queue works fine, and I can send messages on it using tools like Hermes JMS.
I'm working on a standalone client application, running in Fuse 4.4, that has to send a message to the queue via a Camel route but I can't figure out how to set the connector in the configuration.
This is what I tried to set in the camel-context.xml file:
<bean id="jmsinjection" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory">
<bean class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jms/RemoteConnectionFactory" />
<property name="jndiEnvironment">
<props>
<prop key="java.naming.provider.url">remote://myEAPurl:port</prop>
<prop key="java.naming.factory.initial">org.jboss.naming.remote.client.InitialContextFactory</prop>
</props>
</property>
</bean>
</property>
</bean>
And the exception I get:
Error creating bean with name 'jmsinjection' defined in URL [bundle://79.37:0/META-INF/spring/camel-context.xml]: Initialization of bean failed; nested exception is 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
According to the javadoc, HornetQJMSConnectionFactory
implements javax.jms.QueueConnectionFactory
which extends javax.jms.ConnectionFactory
, so I don't get why I get this exception.
I spent hours scraping JBoss forum and doc but can't find a way to make it work.
What is wrong in my camel configuration? How to fix it?