Hi all, 

Camel newbie here.  I'm trying to get a route to send a message to a
JBoss queue (HornetQ), but I can't get passed this error: 

Caused by: java.lang.IllegalArgumentException: connectionFactory must
be specified
        at
org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:308)
        at
org.apache.camel.component.jms.JmsConfiguration.createConnectionFactory(JmsConfiguration.java:1546)
        at
org.apache.camel.component.jms.JmsConfiguration.getConnectionFactory(JmsConfiguration.java:708)
        at
org.apache.camel.component.jms.JmsConfiguration.createTemplateConnectionFactory(JmsConfiguration.java:1563)
        at
org.apache.camel.component.jms.JmsConfiguration.getTemplateConnectionFactory(JmsConfiguration.java:739)
        at
org.apache.camel.component.jms.JmsConfiguration.createInOnlyTemplate(JmsConfiguration.java:609)
        at
org.apache.camel.component.jms.JmsEndpoint.createInOnlyTemplate(JmsEndpoint.java:303)
        at
org.apache.camel.component.jms.JmsProducer.getInOnlyTemplate(JmsProducer.java:470)
        at
org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:390)
        at
org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:368)
        at
org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:154)
        at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
        at
org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
        at
org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
        at
org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
        at
org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:68)
        at
org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:412)
        at
org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:380)
        at
org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:270)
        at
org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:380)
        at
org.apache.camel.impl.ProducerCache.send(ProducerCache.java:221)
        at
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:124)
        at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:137)
        ... 31 more

Camel version: 2.17.7
JBoss version: JBoss EAP 6.2 (local - Windows)
        
I have tried several approaches from examples/tutorials in specifying
the connectionFactory: 
        <bean id="jms"
class="org.apache.camel.component.jms.JmsComponent">
                <property name="connectionFactory"
ref="jmsQueueConnectionFactory" />
        </bean>

I tried using the following options but to no avail: 

1) Using jee:jndi-lookup: 
<jee:jndi-lookup id="jmsQueueConnectionFactory"
jndi-name="java:/ConnectionFactory" />

2) Using Spring JndiTemplate: 
 
        <bean id="jndiTemplate"
class="org.springframework.jndi.JndiTemplate">
                <property name="environment">
                        <props>
                                <prop
key="java.naming.factory.initial">org.jboss.naming.remote.client.InitialContextFactory</prop>
                                <prop
key="java.naming.provider.url">remote://localhost:4447</prop>
                                <prop
key="java.naming.security.principal">***</prop>
                                <prop
key="java.naming.security.credentials">***</prop>
                        </props>
                </property>
        </bean>
        <bean id="jmsQueueConnectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
                <property name="jndiTemplate">
                        <ref bean="jndiTemplate" />
                </property>
                <property name="jndiName">
                        <value>java:/ConnectionFactory</value>
                </property>
        </bean>

3) Using Spring JndiTemplate and passing credentials: 
        <bean id="authenticatedConnectionFactory"
                
class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
                <property name="targetConnectionFactory"
ref="jmsQueueConnectionFactory" />
                <property name="username" value="***" />
                <property name="password" value="***" />
        </bean>
        <bean id="jms"
class="org.apache.camel.component.jms.JmsComponent">
                <property name="connectionFactory"
ref="authenticatedConnectionFactory" />
        </bean>

4) Using jee-jndi-lookup with environment properties: 
        <bean id="jms"
class="org.apache.camel.component.jms.JmsComponent">
                <property name="configuration" ref="HQConfig" />
        </bean>

        <bean id="HQConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
                <property name="connectionFactory" ref="CF-Wrapper" />
                <property name="transacted" value="false" />
                <property name="maxConcurrentConsumers" value="1" />
                <property name="cacheLevelName" value="CACHE_CONNECTION"
/>
        </bean>

        <bean id="CF-Wrapper"
                
class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
                <property name="targetConnectionFactory"
ref="HornetQ-CF" />
                <property name="username" value="***" />
                <property name="password" value="***" />
        </bean>

        <jee:jndi-lookup id="HornetQ-CF"
jndi-name="jms/ConnectionFactory">
                <jee:environment>
                
java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory
                java.naming.provider.url=remote://localhost:4447
                java.naming.security.principal=***
                java.naming.security.credentials=***
                </jee:environment>
        </jee:jndi-lookup>

5) Tried different variations of the jndi name: 
- ConnectionFactory
- java:jms/RemoteConnectionFactory
- java:/ConnectionFactory
- java:jboss/exported/jms/RemoteConnectionFactory
- jms/ConnectionFactory
- jms/RemoteConnectionFactory
- java:/ConnectionFactory

JBoss config looks like this: 
        <subsystem xmlns="urn:jboss:domain:messaging:1.4">
                <hornetq-server>
                        <persistence-enabled>false</persistence-enabled>
                        <journal-type>NIO</journal-type>
                        <journal-min-files>2</journal-min-files>
                        <connectors>
                                <netty-connector name="netty"
socket-binding="messaging"/>
                                <netty-connector name="netty-throughput"
socket-binding="messaging-throughput">
                                        <param key="batch-delay"
value="50"/>
                                </netty-connector>
                                <in-vm-connector name="in-vm"
server-id="0"/>
                        </connectors>
                        <acceptors>
                                <netty-acceptor name="netty"
socket-binding="messaging"/>
                                <netty-acceptor name="netty-throughput"
socket-binding="messaging-throughput">
                                        <param key="batch-delay"
value="50"/>
                                        <param key="direct-deliver"
value="false"/>
                                </netty-acceptor>
                                <in-vm-acceptor name="in-vm"
server-id="0"/>
                        </acceptors>
                        <security-settings>
                                <security-setting match="#">
                                        <permission type="send"
roles="guest"/>
                                        <permission type="consume"
roles="guest"/>
                                        <permission
type="createNonDurableQueue" roles="guest"/>
                                        <permission
type="deleteNonDurableQueue" roles="guest"/>
                                </security-setting>
                        </security-settings>
                        <address-settings>
                                <!--default for catch all-->
                                <address-setting match="#">
                                        
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
                                        
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
                                        <redelivery-delay>0</redelivery-delay>
                                        
<max-size-bytes>10485760</max-size-bytes>
                                        
<address-full-policy>PAGE</address-full-policy>
                                        
<page-size-bytes>2097152</page-size-bytes>
                                        
<message-counter-history-day-limit>10</message-counter-history-day-limit>
                                </address-setting>
                        </address-settings>
                        <jms-connection-factories>
                                <connection-factory
name="InVmConnectionFactory">
                                        <connectors>
                                                <connector-ref
connector-name="in-vm"/>
                                        </connectors>
                                        <entries>
                                                <entry
name="java:/ConnectionFactory"/>
                                        </entries>
                                </connection-factory>
                                <connection-factory
name="RemoteConnectionFactory">
                                        <connectors>
                                                <connector-ref
connector-name="netty"/>
                                        </connectors>
                                        <entries>
                                                <entry
name="java:jboss/exported/jms/RemoteConnectionFactory"/>
                                        </entries>
                                </connection-factory>
                                <pooled-connection-factory
name="hornetq-ra">
                                        <transaction mode="xa"/>
                                        <connectors>
                                                <connector-ref
connector-name="in-vm"/>
                                        </connectors>
                                        <entries>
                                                <entry
name="java:/JmsXA"/>
                                        </entries>
                                </pooled-connection-factory>
                        </jms-connection-factories>
                        <jms-destinations>
                                <jms-queue name="testQueue">
                                        <entry name="queue/testQueue"/>
                                        <entry
name="java:jboss/exported/jms/queue/testQueue"/>
                                </jms-queue>
                        </jms-destinations>
                </hornetq-server>
        </subsystem>

And my route looks like this: 
        public void configure() throws Exception {
                from("direct:start")
                        .to(("jms:queue:testQueue"))
        }

I also created a JBoss application user and added it to a "guest"
role.
        
On my test class, I send a message to "direct:start", and then I get
the exception above (cause). 

Any help will be much appreciated... thank you!

-Francis-


SGI (Corporate Head Office) • 2260 11th Avenue • Regina, SK • S4P0J9 •
www.sgi.sk.ca • 1-844-TLK-2SGI (1-844-855-2744)

This e-mail and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they are
addressed. If you are not the named addressee, please notify the sender
immediately by e-mail if you have received this e-mail by mistake and
delete this e-mail from your system. If you are not the intended
recipient you are notified that using, disclosing, copying or
distributing the contents of this information is strictly prohibited. 

You are receiving this message because you are a customer of SGI.  If
you do not wish to receive promotional messages via email, go to
https://mysgi.sgi.sk.ca/afOnlineServices/onlineservices/public/customerUnsubscribe.do
to unsubscribe (but you'll be missing out!)



Reply via email to