<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Camel/Spring integration between JBoss MQ-s
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/tbenke">Tamas Benke</a> in <i>JBoss Messaging</i> - <a href="https://community.jboss.org/message/801818#801818">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hello Everybody!</p><p>I have worked for a while on a Camel route, between some JBoss MQ-s and other (file, Karaf log) endpoints.</p><p>I use Apache ServiceMix 4.4.2 (with Camel 2.8.5 and Spring 3.0.6.RELEASE inside), and JBoss [EAP] 5.1.1, under Microsoft Windows 7 Professional 64-bit SP1.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I had to shift (with +300) the port set of JBoss to avoid interference with ServiceMix and Oracle 11g database, so that I run JBoss with this command:</p><p>&#160;&#160;&#160; run.bat -Djboss.service.binding.set=ports-03</p><p>I have created two JBoss queue-s by means of the admin console of JBoss, with JNDI names queue/Test1 and queue/Test2.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I collected a set of JBoss dependency JARs, and OSGi-fied them with the BND tool:</p><p>&#160;&#160;&#160; concurrent.jar</p><p>&#160;&#160;&#160; javassist.jar</p><p>&#160;&#160;&#160; jboss-aop-client.jar</p><p>&#160;&#160;&#160; jboss-client.jar</p><p>&#160;&#160;&#160; jboss-common-core.jar</p><p>&#160;&#160;&#160; jboss-ha-client.jar</p><p>&#160;&#160;&#160; jboss-ha-legacy-client.jar</p><p>&#160;&#160;&#160; jboss-javaee.jar</p><p>&#160;&#160;&#160; jboss-logging-spi.jar</p><p>&#160;&#160;&#160; jboss-mdr.jar</p><p>&#160;&#160;&#160; jboss-messaging-client.jar</p><p>&#160;&#160;&#160; jboss-remoting.jar</p><p>&#160;&#160;&#160; jboss-security-spi.jar</p><p>&#160;&#160;&#160; jboss-serialization.jar</p><p>&#160;&#160;&#160; jmx-invoker-adaptor-client.jar</p><p>&#160;&#160;&#160; jnp-client.jar</p><p>&#160;&#160;&#160; trove.jar</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have used some other JARs as well, but I think, they didn't make any difference:</p><p>&#160;&#160;&#160; jbossmq.jar</p><p>&#160;&#160;&#160; jbossall-client.jar</p><p>&#160;&#160;&#160; jbossmq-client.jar</p><p>&#160;&#160;&#160; jboss-jmx.jar</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have used this Spring camel-context.xml (containing 3 route definitions):</p><p><strong style="font-family: courier new,courier;">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</strong></p><p><strong style="font-family: courier new,courier;"><span>&lt;beans xmlns="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans" rel="nofollow" target="_blank">http://www.springframework.org/schema/beans</a><span>"</span></strong></p><p><strong style="font-family: courier new,courier;"><span>&#160;&#160;&#160;&#160;&#160;&#160; xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" rel="nofollow" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>"</span></strong></p><p><strong style="font-family: courier new,courier;"><span>&#160;&#160;&#160;&#160;&#160;&#160; xmlns:camel="</span><a class="jive-link-external-small" href="http://camel.apache.org/schema/spring" rel="nofollow" target="_blank">http://camel.apache.org/schema/spring</a><span>"</span></strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160; xsi:schemaLocation="</strong></p><p><strong style="font-family: courier new,courier;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans" rel="nofollow" target="_blank">http://www.springframework.org/schema/beans</a></strong></p><p><strong style="font-family: courier new,courier;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans/spring-beans.xsd" rel="nofollow" target="_blank">http://www.springframework.org/schema/beans/spring-beans.xsd</a></strong></p><p><strong style="font-family: courier new,courier;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><a class="jive-link-external-small" href="http://camel.apache.org/schema/spring" rel="nofollow" target="_blank">http://camel.apache.org/schema/spring</a></strong></p><p><strong style="font-family: courier new,courier;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><a class="jive-link-external-small" href="http://camel.apache.org/schema/spring/camel-spring.xsd" rel="nofollow" target="_blank">http://camel.apache.org/schema/spring/camel-spring.xsd</a><span>"&gt;</span></strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong style="font-family: courier new,courier;"><span>&#160;&#160;&#160; &lt;camelContext xmlns="</span><a class="jive-link-external-small" href="http://camel.apache.org/schema/spring" rel="nofollow" target="_blank">http://camel.apache.org/schema/spring</a><span>"&gt;</span></strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!--route&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;from uri="file:c:/HELLO" /&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;convertBodyTo type="String" charset="UTF-8" /&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;to uri="jbossjms:queue:Test1" /&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/route--&gt;</strong></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!--route&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;from uri="timer://foo?fixedRate=true&amp;amp;period=5s" /&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;transform&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;simple&gt;ABCdef&lt;/simple&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/transform&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;to uri="jbossjms:queue:Test1" /&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/route--&gt;</strong></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;route&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;from uri="jbossjms:queue:Test1" /&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;to uri="log:Test1" /&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/route&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; &lt;/camelContext&gt;</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; &lt;bean name="jbossjms" class="org.apache.camel.component.jms.JmsComponent"&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;property name="connectionFactory" ref="jbossJmsConnectionFactory"/&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; &lt;/bean&gt;</strong></p><p>&#160;&#160;&#160; </p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; &lt;bean name="jbossJmsConnectionFactory" id="jbossJmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean"&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;property name="jndiTemplate"&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ref bean="jbossJndiTemplate" /&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/property&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;property name="jndiName"&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;value&gt;ConnectionFactory&lt;/value&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/property&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; &lt;/bean&gt;</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; &lt;bean id="jbossJndiTemplate" class="org.springframework.jndi.JndiTemplate"&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;property name="environment"&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;props&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;prop key="java.naming.factory.initial"&gt;org.jnp.interfaces.NamingContextFactory&lt;/prop&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;prop key="java.naming.provider.url"&gt;jnp://localhost:1399&lt;/prop&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;prop key="java.naming.factory.url.pkgs"&gt;org.jnp.interfaces:org.jboss.naming&lt;/prop&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;prop key="java.naming.security.principal"&gt;admin&lt;/prop&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;prop key="java.naming.security.credentials"&gt;admin&lt;/prop&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/props&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/property&gt;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; &lt;/bean&gt;</strong></p><p><strong style="font-family: courier new,courier;">&lt;/beans&gt;</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The first (File &gt;&gt; JBoss MQ) and second (Timer &gt;&gt; JBoss MQ) routes are working properly, if I drop the</p><p>above mentioned dependencies and the camel-context.xml to ServiceMix's /deploy folder.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The third (JBoss MQ &gt;&gt; Karaf log) route does not process messages, despite the consumer appears on the Test1</p><p>JBoss queue, and the bundle/route status is Active/Started.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The automatic OSGi headers of the deployed camel-context.xml are:</p><p><strong style="font-family: courier new,courier;">Manifest-Version = 2</strong></p><p><strong style="font-family: courier new,courier;">Spring-Context = *;publish-context:=false;create-asynchronously:=true</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong style="font-family: courier new,courier;">Bundle-SymbolicName = test-jms.xml</strong></p><p><strong style="font-family: courier new,courier;">Bundle-Version = 0.0.0</strong></p><p><strong style="font-family: courier new,courier;">Bundle-ManifestVersion = 2</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong style="font-family: courier new,courier;">DynamicImport-Package =</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; *</strong></p><p><strong style="font-family: courier new,courier;">Import-Package =</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; org.apache.camel.component.jms,</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; org.springframework.jndi</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The imports of this camel-context.xml artifact are:</p><p><strong style="font-family: courier new,courier;">System Bundle (0): org.osgi.service.packageadmin; version=1.2.0</strong></p><p><strong style="font-family: courier new,courier;">System Bundle (0): org.xml.sax; version=0.0.0</strong></p><p><strong style="font-family: courier new,courier;">System Bundle (0): org.apache.xerces.impl.dv.xs; version=2.11.0</strong></p><p><strong style="font-family: courier new,courier;">System Bundle (0): org.apache.xerces.impl.dv.dtd; version=2.11.0</strong></p><p><strong style="font-family: courier new,courier;">activemq-core (50): org.apache.activemq; version=5.5.1</strong></p><p><strong style="font-family: courier new,courier;">activemq-core (50): org.apache.activemq.util; version=5.5.1</strong></p><p><strong style="font-family: courier new,courier;">Spring Context (65): org.springframework.jndi; version=3.0.6.RELEASE</strong></p><p><strong style="font-family: courier new,courier;">Spring Beans (66): org.springframework.beans.factory.xml; version=3.0.6.RELEASE</strong></p><p><strong style="font-family: courier new,courier;">Spring Beans (66): org.springframework.beans.propertyeditors; version=3.0.6.RELEASE</strong></p><p><strong style="font-family: courier new,courier;">camel-core (91): org.apache.camel.spi; version=2.8.5</strong></p><p><strong style="font-family: courier new,courier;">camel-core (91): org.apache.camel; version=2.8.5</strong></p><p><strong style="font-family: courier new,courier;">camel-jms (118): org.apache.camel.component.jms; version=2.8.5</strong></p><p><strong style="font-family: courier new,courier;">jboss-common-core (463): org.jboss.util.propertyeditor; version=0.0.0</strong></p><p><strong style="font-family: courier new,courier;">jboss-common-core (463): org.jboss.util.threadpool; version=0.0.0</strong></p><p><strong style="font-family: courier new,courier;">jnp-client (464): org.jnp.interfaces; version=0.0.0</strong></p><p><strong style="font-family: courier new,courier;">jboss-remoting (469): org.jboss.remoting; version=0.0.0</strong></p><p><strong style="font-family: courier new,courier;">jboss-remoting (469): org.jboss.remoting.marshal; version=0.0.0</strong></p><p><strong style="font-family: courier new,courier;">jboss-messaging-client (476): org.jboss.jms.client; version=0.0.0</strong></p><p><strong style="font-family: courier new,courier;">jboss-messaging-client (476): org.jboss.jms.client.delegate; version=0.0.0</strong></p><p><strong style="font-family: courier new,courier;">jboss-messaging-client (476): org.jboss.jms.client.remoting; version=0.0.0</strong></p><p><strong style="font-family: courier new,courier;">jboss-messaging-client (476): org.jboss.jms.server.remoting; version=0.0.0</strong></p><p><strong style="font-family: courier new,courier;">jboss-messaging-client (476): org.jboss.messaging.util; version=0.0.0</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Of course, there are no exports.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I made a complete OSGi bundle JAR from the mentioned camel-context.xml, with the following MANIFEST.MF:</p><p><strong style="font-family: courier new,courier;">Manifest-Version: 1.0</strong></p><p><strong style="font-family: courier new,courier;">DynamicImport-Package: *</strong></p><p><strong style="font-family: courier new,courier;">Bundle-Version: 1.0.0</strong></p><p><strong style="font-family: courier new,courier;">Build-Jdk: 1.7.0_17</strong></p><p><strong style="font-family: courier new,courier;">Built-By: U522971</strong></p><p><strong style="font-family: courier new,courier;">Tool: Bnd-1.15.0</strong></p><p><strong style="font-family: courier new,courier;">Bnd-LastModified: 1362746498060</strong></p><p><strong style="font-family: courier new,courier;">Bundle-Name: A Camel Spring-DM Route</strong></p><p><strong style="font-family: courier new,courier;">Bundle-ManifestVersion: 2</strong></p><p><strong style="font-family: courier new,courier;">Created-By: Apache Maven Bundle Plugin</strong></p><p><strong style="font-family: courier new,courier;">Import-Package: javax.jms,javax.naming,javax.naming.spi,javax.net,org.</strong></p><p><strong style="font-family: courier new,courier;"> apache.activemq,org.apache.camel.component.jms,org.jboss.mq,org.jboss</strong></p><p><strong style="font-family: courier new,courier;"> .mq.referenceable,org.jnp.interfaces,org.springframework.jms.core,org</strong></p><p><strong style="font-family: courier new,courier;"> .springframework.jndi;version="[2.5,4)"</strong></p><p><strong style="font-family: courier new,courier;">Bundle-SymbolicName: jboss-route</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The org.jboss.mq package was missing, so I deployed jboss/jbossmq_3.2.3.jar (downloaded and bundlefied from a local Maven repository).</p><p>The bundle was immediately started, and the behavior of the routes was exactly the same as I mentioned above.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>It looks wery cool and simple to write down, but in reality, I spent approximately 2.5 months with it, </p><p>and after all, I still don't have a Camel/Spring config to consume from a JBoss MQ!</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have read a number of resources (including official JBoss/Camel documentation); for example:</p><p><a class="jive-link-external-small" href="http://www.jboss.org/jbossas/docs" target="_blank">http://www.jboss.org/jbossas/docs</a></p><p><a class="jive-link-external-small" href="https://issues.jboss.org/browse/JBBOOT-138" target="_blank">https://issues.jboss.org/browse/JBBOOT-138</a></p><p><a class="jive-link-external-small" href="http://www.coderanch.com/t/90486/JBoss/Failed-load-users-passwords-role" rel="nofollow" target="_blank">http://www.coderanch.com/t/90486/JBoss/Failed-load-users-passwords-role</a></p><p><a class="jive-link-external-small" href="http://docs.jboss.org/jbossas/getting_started/v5/html/tour.html#d0e569" target="_blank">http://docs.jboss.org/jbossas/getting_started/v5/html/tour.html#d0e569</a></p><p><a class="jive-link-external-small" href="http://docs.jboss.org/jbossas/jboss4guide/r4/html/ch6.chapt.html" target="_blank">http://docs.jboss.org/jbossas/jboss4guide/r4/html/ch6.chapt.html</a></p><p><a class="jive-link-external-small" href="http://www.mastertheboss.com/jboss-jms/jboss-jms-queue-example" rel="nofollow" target="_blank">http://www.mastertheboss.com/jboss-jms/jboss-jms-queue-example</a></p><p><a class="jive-link-external-small" href="http://stackoverflow.com/questions/2478729/jboss-messaging-jms" rel="nofollow" target="_blank">http://stackoverflow.com/questions/2478729/jboss-messaging-jms</a></p><p><a class="jive-link-external-small" href="http://onjava.com/pub/a/onjava/2006/02/22/asynchronous-messaging-with-spring-jms.html?page=1" rel="nofollow" target="_blank">http://onjava.com/pub/a/onjava/2006/02/22/asynchronous-messaging-with-spring-jms.html?page=1</a></p><p><a class="jive-link-external-small" href="http://forum.springsource.org/showthread.php?17491-Failed-to-convert-SpyConnectionFactory-to-ConnectionFactory" rel="nofollow" target="_blank">http://forum.springsource.org/showthread.php?17491-Failed-to-convert-SpyConnectionFactory-to-ConnectionFactory</a></p><p><a class="jive-link-external-small" href="http://integrationsphere.blogspot.hu/2011/07/camel-and-hornetq-as-jms-provider.html" rel="nofollow" target="_blank">http://integrationsphere.blogspot.hu/2011/07/camel-and-hornetq-as-jms-provider.html</a></p><p><a class="jive-link-external-small" href="http://integrationsphere.blogspot.hu/2011/07/camel-and-hornetq-as-jms-provider.html" rel="nofollow" target="_blank">http://integrationsphere.blogspot.hu/2011/07/camel-and-hornetq-as-jms-provider.html</a></p><p><a class="jive-link-external-small" href="http://java.dzone.com/articles/camel-and-hornetq-jms-provider" rel="nofollow" target="_blank">http://java.dzone.com/articles/camel-and-hornetq-jms-provider</a></p><p><a class="jive-link-external-small" href="http://www.theserverside.com/discussions/thread.tss?thread_id=9653" rel="nofollow" target="_blank">http://www.theserverside.com/discussions/thread.tss?thread_id=9653</a></p><p><a class="jive-link-external-small" href="https://community.jboss.org/thread/29768" target="_blank">https://community.jboss.org/thread/29768</a></p><p><a class="jive-link-external-small" href="http://stackoverflow.com/questions/5256060/ejb-exception-while-try-to-run-the-client" rel="nofollow" target="_blank">http://stackoverflow.com/questions/5256060/ejb-exception-while-try-to-run-the-client</a></p><p><a class="jive-link-external-small" href="http://docs.jboss.org/jbossmessaging/docs/userguide-1.4.2.GA/html/installation.html" target="_blank">http://docs.jboss.org/jbossmessaging/docs/userguide-1.4.2.GA/html/installation.html</a></p><p><a class="jive-link-external-small" href="http://mavenhub.com/c/org/jnp/interfaces/namingcontextfactory/dependency" rel="nofollow" target="_blank">http://mavenhub.com/c/org/jnp/interfaces/namingcontextfactory/dependency</a></p><p><a class="jive-link-external-small" href="https://community.jboss.org/thread/154570" target="_blank">https://community.jboss.org/thread/154570</a></p><p><a class="jive-link-external-small" href="https://community.jboss.org/message/207352#207352#207352" target="_blank">https://community.jboss.org/message/207352#207352</a></p><p><a class="jive-link-external-small" href="https://community.jboss.org/thread/175935" target="_blank">https://community.jboss.org/thread/175935</a></p><p><a class="jive-link-external-small" href="https://community.jboss.org/thread/162575" target="_blank">https://community.jboss.org/thread/162575</a></p><p><a class="jive-link-external-small" href="http://www.javamonamour.org/2011/03/me-jms-hermesjms-and-jboss.html" rel="nofollow" target="_blank">http://www.javamonamour.org/2011/03/me-jms-hermesjms-and-jboss.html</a></p><p><a class="jive-link-external-small" href="http://forum.springsource.org/showthread.php?59005-JNDI-connection-factory-config" rel="nofollow" target="_blank">http://forum.springsource.org/showthread.php?59005-JNDI-connection-factory-config</a></p><p><a class="jive-link-external-small" href="http://www.stevideter.com/2008/08/25/simplifying-spring%E2%80%99s-jms-configuration-for-jnditemplate/" rel="nofollow" target="_blank">http://www.stevideter.com/2008/08/25/simplifying-spring%E2%80%99s-jms-configuration-for-jnditemplate/</a></p><p><a class="jive-link-external-small" href="http://www.mydeveloperconnection.com/html/Spring-JNDI-Datasource..htm" rel="nofollow" target="_blank">http://www.mydeveloperconnection.com/html/Spring-JNDI-Datasource..htm</a></p><p><a class="jive-link-external-small" href="http://forum.springsource.org/showthread.php?60768-Configuring-Initial-Context" rel="nofollow" target="_blank">http://forum.springsource.org/showthread.php?60768-Configuring-Initial-Context</a></p><p><a class="jive-link-external-small" href="http://forum.springsource.org/archive/index.php/t-124901.html" rel="nofollow" target="_blank">http://forum.springsource.org/archive/index.php/t-124901.html</a></p><p><a class="jive-link-external-small" href="http://java.dzone.com/articles/bridging-between-jms-and" rel="nofollow" target="_blank">http://java.dzone.com/articles/bridging-between-jms-and</a></p><p><a class="jive-link-external-small" href="http://mail-archives.apache.org/mod_mbox/camel-users/201111.mbox/%3C1322215472697-5022416.post@n5.nabble.com%3E" rel="nofollow" target="_blank">http://mail-archives.apache.org/mod_mbox/camel-users/201111.mbox/%3C1322215472697-5022416.post@n5.nabble.com%3E</a><a class="jive-link-email-small" href="mailto:rg/mod_mbox/camel-users/201111.mbox/%3C1322215472697-5022416.post@n5.nabble.com" rel="nofollow" target="_blank">rg/mod_mbox/camel-users/201111.mbox/%3C1322215472697-5022416.post@n5.nabble.com</a><span>%3E</span></p><p><a class="jive-link-external-small" href="http://72.2.112.194/tag/spring" rel="nofollow" target="_blank">http://72.2.112.194/tag/spring</a></p><p><a class="jive-link-external-small" href="http://static.springsource.org/spring/docs/3.0.0.M3/reference/html/ch23s04.html" rel="nofollow" target="_blank">http://static.springsource.org/spring/docs/3.0.0.M3/reference/html/ch23s04.html</a></p><p><a class="jive-link-external-small" href="http://www.mentby.com/Group/apache-camel/jms-transaction-in-jboss-camel-is-not-work.html" rel="nofollow" target="_blank">http://www.mentby.com/Group/apache-camel/jms-transaction-in-jboss-camel-is-not-work.html</a></p><p><a class="jive-link-external-small" href="http://www.torsten-horn.de/techdocs/jee-jndi.htm" rel="nofollow" target="_blank">http://www.torsten-horn.de/techdocs/jee-jndi.htm</a></p><p><a class="jive-link-external-small" href="http://karaf.922171.n3.nabble.com/Paxexam-karaf-startup-issue-td3914766.html" rel="nofollow" target="_blank">http://karaf.922171.n3.nabble.com/Paxexam-karaf-startup-issue-td3914766.html</a></p><p><a class="jive-link-external-small" href="http://karaf.922171.n3.nabble.com/Paxexam-karaf-startup-issue-td3916549.html" rel="nofollow" target="_blank">http://karaf.922171.n3.nabble.com/Paxexam-karaf-startup-issue-td3916549.html</a></p><p><a class="jive-link-external-small" href="http://www.castor.org/spring-orm-integration.html" rel="nofollow" target="_blank">http://www.castor.org/spring-orm-integration.html</a></p><p><a class="jive-link-external-small" href="http://forum.springsource.org/showthread.php?120990-Error-on-using-Jndi-Template-for-Spring-Integration-amp-MQ-connection" rel="nofollow" target="_blank">http://forum.springsource.org/showthread.php?120990-Error-on-using-Jndi-Template-for-Spring-Integration-amp-MQ-connection</a></p><p><a class="jive-link-external-small" href="http://fusesource.com/docs/esb/3.5/jms/ESBJMSConnectFactoryJNDI.html" rel="nofollow" target="_blank">http://fusesource.com/docs/esb/3.5/jms/ESBJMSConnectFactoryJNDI.html</a></p><p><a class="jive-link-external-small" href="http://forum.springsource.org/showthread.php?58223-Using-JNDI-to-configure-a-JndiTemplate" rel="nofollow" target="_blank">http://forum.springsource.org/showthread.php?58223-Using-JNDI-to-configure-a-JndiTemplate</a></p><p><a class="jive-link-external-small" href="https://community.jboss.org/thread/152456" target="_blank">https://community.jboss.org/thread/152456</a></p><p><a class="jive-link-external-small" href="http://grokbase.com/t/servicemix/users/068yn1azmv/jndi-and-jbossmq" rel="nofollow" target="_blank">http://grokbase.com/t/servicemix/users/068yn1azmv/jndi-and-jbossmq</a></p><p><a class="jive-link-external-small" href="http://docs.oracle.com/javase/jndi/tutorial/TOC.html" rel="nofollow" target="_blank">http://docs.oracle.com/javase/jndi/tutorial/TOC.html</a></p><p><a class="jive-link-external-small" href="http://activemq.2283324.n4.nabble.com/Route-messages-from-HornetQ-to-ActiveMQ-td4435172.html" rel="nofollow" target="_blank">http://activemq.2283324.n4.nabble.com/Route-messages-from-HornetQ-to-ActiveMQ-td4435172.html</a></p><p><a class="jive-link-external-small" href="http://stackoverflow.com/questions/1974883/jboss-4-2-2-to-5-0-1-migrationneeded-jboss-client-jar-files" rel="nofollow" target="_blank">http://stackoverflow.com/questions/1974883/jboss-4-2-2-to-5-0-1-migrationneeded-jboss-client-jar-files</a></p><p><a class="jive-link-external-small" href="http://docs.jboss.org/jbossremoting/2.5.4.SP2/userguide/html_single/" target="_blank">http://docs.jboss.org/jbossremoting/2.5.4.SP2/userguide/html_single/</a></p><p><a class="jive-link-external-small" href="http://docs.jboss.org/jbossremoting/2.5.3.SP1/html/" target="_blank">http://docs.jboss.org/jbossremoting/2.5.3.SP1/html/</a></p><p><a class="jive-link-external-small" href="http://stackoverflow.com/questions/8561622/jboss-as-7-simple-hello-world-application" rel="nofollow" target="_blank">http://stackoverflow.com/questions/8561622/jboss-as-7-simple-hello-world-application</a></p><p><a class="jive-link-external-small" href="https://community.jboss.org/message/613171#613171" target="_blank">https://community.jboss.org/message/613171</a></p><p><a class="jive-link-external-small" href="http://www.mastertheboss.com/jboss-configuration/the-jndiproperty-pitfall" rel="nofollow" target="_blank">http://www.mastertheboss.com/jboss-configuration/the-jndiproperty-pitfall</a></p><p><a class="jive-link-external-small" href="http://www.mastertheboss.com/jboss-configuration/jboss-port-configuration" rel="nofollow" target="_blank">http://www.mastertheboss.com/jboss-configuration/jboss-port-configuration</a></p><p><a class="jive-link-external-small" href="http://www.mastertheboss.com/jboss-jms" rel="nofollow" target="_blank">http://www.mastertheboss.com/jboss-jms</a></p><p><a class="jive-link-external-small" href="http://www.mastertheboss.com/jboss-jms/jboss-jms-configuration/page-2" rel="nofollow" target="_blank">http://www.mastertheboss.com/jboss-jms/jboss-jms-configuration/page-2</a></p><p><a class="jive-link-external-small" href="http://www.mastertheboss.com/jboss-jms/jboss-jms-queue-example" rel="nofollow" target="_blank">http://www.mastertheboss.com/jboss-jms/jboss-jms-queue-example</a></p><p><a class="jive-link-external-small" href="https://issues.jboss.org/secure/attachmentzip/unzip/12400214/12330767%5B63%5D/jts-exampleJZ/src/com/arjuna/ats/tools/TxTestJR.java" target="_blank">https://issues.jboss.org/secure/attachmentzip/unzip/12400214/12330767%5B63%5D/jts-exampleJZ/src/com/arjuna/ats/tools/TxTestJR.java</a></p><p><a class="jive-link-external-small" href="http://www.mastertheboss.com/jboss-jms/jboss-jms-configuration/page-2" rel="nofollow" target="_blank">http://www.mastertheboss.com/jboss-jms/jboss-jms-configuration/page-2</a></p><p><a class="jive-link-external-small" href="http://www.mastertheboss.com/jboss-jms/jboss-jms-queue-example" rel="nofollow" target="_blank">http://www.mastertheboss.com/jboss-jms/jboss-jms-queue-example</a></p><p><a class="jive-link-external-small" href="http://stackoverflow.com/questions/11471679/spring-configure-the-datasource-through-jndi-having-remote-jboss-server" rel="nofollow" target="_blank">http://stackoverflow.com/questions/11471679/spring-configure-the-datasource-through-jndi-having-remote-jboss-server</a></p><p><a class="jive-link-external-small" href="http://fusesource.com/forums/thread.jspa?messageID=7828" rel="nofollow" target="_blank">http://fusesource.com/forums/thread.jspa?messageID=7828</a></p><p><a class="jive-link-external-small" href="https://community.jboss.org/message/439509#439509#439509" target="_blank">https://community.jboss.org/message/439509#439509</a></p><p><a class="jive-link-external-small" href="http://docs.jboss.org/jbossmessaging/docs/userguide-1.4.0.SP3/html/installation.html#install.extra-steps" target="_blank">http://docs.jboss.org/jbossmessaging/docs/userguide-1.4.0.SP3/html/installation.html#install.extra-steps</a></p><p><a class="jive-link-external-small" href="http://www.tutorials.de/enterprise-java-jee-j2ee-spring-co/355197-invalidmarshallingresource-can-not-find-valid-marshaller-data-type-jms.html" rel="nofollow" target="_blank">http://www.tutorials.de/enterprise-java-jee-j2ee-spring-co/355197-invalidmarshallingresource-can-not-find-valid-marshaller-data-type-jms.html</a></p><p><a class="jive-link-external-small" href="http://integrationsphere.blogspot.hu/2011/07/camel-and-hornetq-as-jms-provider.html" rel="nofollow" target="_blank">http://integrationsphere.blogspot.hu/2011/07/camel-and-hornetq-as-jms-provider.html</a></p><p><a class="jive-link-external-small" href="https://community.jboss.org/thread/128897" target="_blank">https://community.jboss.org/thread/128897</a></p><p><a class="jive-link-external-small" href="https://community.jboss.org/thread/1468" target="_blank">https://community.jboss.org/thread/1468</a></p><p><a class="jive-link-external-small" href="http://camel.apache.org/maven/current/camel-jms/apidocs/org/apache/camel/component/jms/JmsComponent.html" rel="nofollow" target="_blank">http://camel.apache.org/maven/current/camel-jms/apidocs/org/apache/camel/component/jms/JmsComponent.html</a><span>&#160;&#160;&#160; [JBoss JMS Component Javadoc]</span></p><p><a class="jive-link-external-small" href="http://docs.jboss.org/jbossas/jboss4guide/r4/html/ch3.chapter.html" target="_blank">http://docs.jboss.org/jbossas/jboss4guide/r4/html/ch3.chapter.html</a></p><p><a class="jive-link-external-small" href="http://www.coderanch.com/t/459111/java/java/security-manager-rmi-class-loader" rel="nofollow" target="_blank">http://www.coderanch.com/t/459111/java/java/security-manager-rmi-class-loader</a></p><p><a class="jive-link-external-small" href="https://community.jboss.org/message/197278#197278" target="_blank">https://community.jboss.org/message/197278</a></p><p><a class="jive-link-external-small" href="http://www.tutorials.de/enterprise-java-jee-j2ee-spring-co/355197-invalidmarshallingresource-can-not-find-valid-marshaller-data-type-jms.html" rel="nofollow" target="_blank">http://www.tutorials.de/enterprise-java-jee-j2ee-spring-co/355197-invalidmarshallingresource-can-not-find-valid-marshaller-data-type-jms.html</a></p><p><a class="jive-link-external-small" href="http://s139.codeinspot.com/q/878267" rel="nofollow" target="_blank">http://s139.codeinspot.com/q/878267</a></p><p><a class="jive-link-external-small" href="http://forum.springsource.org/showthread.php?90417-Using-JMS-Namespace-Support-to-configure-JBoss" rel="nofollow" target="_blank">http://forum.springsource.org/showthread.php?90417-Using-JMS-Namespace-Support-to-configure-JBoss</a></p><p><a class="jive-link-external-small" href="http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/jms.html" rel="nofollow" target="_blank">http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/jms.html</a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I had many weird errors as well (later debugged), but I still cannot make my Camel route to consume from JBoss.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have written three POJO's to send and receive from/to JBoss, as well.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>First is Sender.java:</strong></p><p><span style="font-family: courier new,courier;"><strong>package jBossMain;</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;"><strong>import javax.jms.*;</strong></span></p><p><span style="font-family: courier new,courier;"><strong>import javax.naming.*;</strong></span></p><p><span style="font-family: courier new,courier;"><strong>import java.util.Hashtable;</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;"><strong>public class Sender</strong></span></p><p><span style="font-family: courier new,courier;"><strong>{</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; public static final String JNDI_URL = "jnp://localhost:1399";</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; public static final String JNDI_CONTEXT_FACTORY = "org.jnp.interfaces.NamingContextFactory";</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; public static final String JMS_USER = null;</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; public static final String JMS_PASSWORD = null;</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; public static final String JMS_CONNECTION_FACTORY = "ConnectionFactory";</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; public static final String QUEUE_JNDI_NAME = "/queue/Test1";</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; public static void main( String[] args )</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; {</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueConnection qConn = null;</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueSession qSession = null;</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueSender qSender = null;</strong></span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; try</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Context parameters</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Hashtable&lt;String, String&gt; env = new Hashtable&lt;String, String&gt;();</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; env.put( Context.INITIAL_CONTEXT_FACTORY, JNDI_CONTEXT_FACTORY );</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; env.put( Context.PROVIDER_URL, JNDI_URL );</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if( JMS_USER != null )</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; env.put( Context.SECURITY_PRINCIPAL, JMS_USER );</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if( JMS_PASSWORD != null )</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; env.put( Context.SECURITY_CREDENTIALS, JMS_PASSWORD );</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Creating context</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Context jndiContext = new InitialContext( env );</strong></span></p><p>&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Queue connection factory</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueConnectionFactory cFactory = (QueueConnectionFactory) jndiContext.lookup(JMS_CONNECTION_FACTORY);</strong></span></p><p>&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Create Connection</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if( JMS_USER == null || JMS_PASSWORD == null )</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qConn = cFactory.createQueueConnection();</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qConn = cFactory.createQueueConnection( JMS_USER, JMS_PASSWORD );</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></span></p><p>&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Create Session</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qSession = qConn.createQueueSession( false, Session.AUTO_ACKNOWLEDGE );</strong></span></p><p>&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Lookup Queue</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Queue queue = (Queue) jndiContext.lookup(QUEUE_JNDI_NAME);</strong></span></p><p>&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Create Queue Sender</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qSender = qSession.createSender( queue );</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Start receiving messages</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qConn.start();</strong></span></p><p>&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Close JNDI context</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; jndiContext.close();</strong></span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TextMessage msg = qSession.createTextMessage("Hello World!");</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qSender.send(msg);</strong></span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Thread.sleep(2000);</strong></span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(qSender != null) qSender.close();</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(qSession != null) qSession.close();</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(qConn != null) qConn.close();</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; catch( Exception e )</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; e.printStackTrace();</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; }</strong></span></p><p><span style="font-family: courier new,courier;"><strong>}</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>Second is SerialReceiver.java</strong>, which can consume only 1 message per run:</p><p><span style="font-family: courier new,courier;"><strong>package jBossMain;</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;"><strong>import javax.jms.*;</strong></span></p><p><span style="font-family: courier new,courier;"><strong>import javax.naming.*;</strong></span></p><p><span style="font-family: courier new,courier;"><strong>import java.util.Hashtable;</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;"><strong>public class SerialReceiver</strong></span></p><p><span style="font-family: courier new,courier;"><strong>{</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; public static final String JNDI_URL = "jnp://localhost:1399";</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; public static final String JNDI_CONTEXT_FACTORY = "org.jnp.interfaces.NamingContextFactory";</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; public static final String JMS_USER = null;</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; public static final String JMS_PASSWORD = null;</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; public static final String JMS_CONNECTION_FACTORY = "ConnectionFactory";</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; public static final String QUEUE_JNDI_NAME = "/queue/Test1";</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; public static void main( String[] args )</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; {</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueConnection qConn = null;</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueSession qSession = null;</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueReceiver qReceiver = null;</strong></span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; try</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Context parameters</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Hashtable&lt;String, String&gt; env = new Hashtable&lt;String, String&gt;();</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; env.put( Context.INITIAL_CONTEXT_FACTORY, JNDI_CONTEXT_FACTORY );</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; env.put( Context.PROVIDER_URL, JNDI_URL );</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if( JMS_USER != null )</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; env.put( Context.SECURITY_PRINCIPAL, JMS_USER );</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if( JMS_PASSWORD != null )</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; env.put( Context.SECURITY_CREDENTIALS, JMS_PASSWORD );</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Creating context</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Context jndiContext = new InitialContext( env );</strong></span></p><p>&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Queue connection factory</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueConnectionFactory cFactory = (QueueConnectionFactory) jndiContext.lookup(JMS_CONNECTION_FACTORY);</strong></span></p><p>&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Create Connection</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if( JMS_USER == null || JMS_PASSWORD == null )</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qConn = cFactory.createQueueConnection();</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qConn = cFactory.createQueueConnection( JMS_USER, JMS_PASSWORD );</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></span></p><p>&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Create Session</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qSession = qConn.createQueueSession( false, Session.AUTO_ACKNOWLEDGE );</strong></span></p><p>&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Lookup Queue</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Queue queue = (Queue) jndiContext.lookup(QUEUE_JNDI_NAME);</strong></span></p><p>&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Create Queue Receiver</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qReceiver = qSession.createReceiver( queue );</strong></span></p><p>&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Start receiving messages</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qConn.start();</strong></span></p><p>&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Close JNDI context</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; jndiContext.close();</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //javax.jms.TextMessage object, body can be extracted.</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TextMessage msg = (TextMessage) qReceiver.receive();</strong></span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Thread.sleep(2000);</strong></span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(qReceiver != null) qReceiver.close();</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(qSession != null) qSession.close();</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(qConn != null) qConn.close();</strong></span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println( msg.toString() );</strong></span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Only available if msg is of type TextMessage:</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println( msg.getText() );</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; catch( Exception e )</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; e.printStackTrace();</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></span></p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; }</strong></span></p><p><span style="font-family: courier new,courier;"><strong>}</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>Third is ContinuousReceiver.java</strong>, which will receive all messages from the queue while running:</p><p><strong style="font-family: courier new,courier;">package jBossMain;</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong style="font-family: courier new,courier;">import javax.jms.*;</strong></p><p><strong style="font-family: courier new,courier;">import javax.naming.*;</strong></p><p><strong style="font-family: courier new,courier;">import java.util.Hashtable;</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong style="font-family: courier new,courier;">public class ContinuousReceiver implements MessageListener</strong></p><p><strong style="font-family: courier new,courier;">{</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; public static final String JNDI_URL = "jnp://localhost:1399";</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; public static final String JNDI_CONTEXT_FACTORY = "org.jnp.interfaces.NamingContextFactory";</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; public static final String JMS_USER = null;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; public static final String JMS_PASSWORD = null;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; public static final String JMS_CONNECTION_FACTORY = "ConnectionFactory";</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; public static final String QUEUE_JNDI_NAME = "/queue/Test1";</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; public static void main( String[] args )</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; {</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueConnection qConn = null;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueSession qSession = null;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueReceiver qReceiver = null;</strong></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; try</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Context parameters</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Hashtable&lt;String, String&gt; env = new Hashtable&lt;String, String&gt;();</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; env.put( Context.INITIAL_CONTEXT_FACTORY, JNDI_CONTEXT_FACTORY );</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; env.put( Context.PROVIDER_URL, JNDI_URL );</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if( JMS_USER != null )</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; env.put( Context.SECURITY_PRINCIPAL, JMS_USER );</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if( JMS_PASSWORD != null )</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; env.put( Context.SECURITY_CREDENTIALS, JMS_PASSWORD );</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Creating context</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Context jndiContext = new InitialContext( env );</strong></p><p>&#160;&#160;&#160; </p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Queue connection factory</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueConnectionFactory cFactory = (QueueConnectionFactory) jndiContext.lookup(JMS_CONNECTION_FACTORY);</strong></p><p>&#160;&#160;&#160; </p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Create Connection</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if( JMS_USER == null || JMS_PASSWORD == null )</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qConn = cFactory.createQueueConnection();</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qConn = cFactory.createQueueConnection( JMS_USER, JMS_PASSWORD );</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></p><p>&#160;&#160;&#160; </p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Create Session</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qSession = qConn.createQueueSession( false, Session.AUTO_ACKNOWLEDGE );</strong></p><p>&#160;&#160;&#160; </p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Lookup Queue</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Queue queue = (Queue) jndiContext.lookup(QUEUE_JNDI_NAME);</strong></p><p>&#160;&#160;&#160; </p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Create Queue Receiver</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qReceiver = qSession.createReceiver( queue );</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ContinuousReceiver CR = new ContinuousReceiver();</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qReceiver.setMessageListener( CR );</strong></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Start receiving messages</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qConn.start();</strong></p><p>&#160;&#160;&#160; </p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Close JNDI context</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; jndiContext.close();</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Thread.sleep(25000);</strong></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(qReceiver != null) qReceiver.close();</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(qSession != null) qSession.close();</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(qConn != null) qConn.close();</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; catch( Exception e )</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; e.printStackTrace();</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; }</strong></p><p>&#160;&#160;&#160; </p><p>&#160;&#160;&#160; </p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; public void onMessage( Message message )</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; {</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; try</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println( "The type of the received message is: " + message.getJMSType() );</strong></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if( message instanceof TextMessage )</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TextMessage textMessage = ( TextMessage ) message;</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println( "The text content: " + textMessage.getText() );</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println( message.toString() );</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; catch(JMSException je)</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; je.printStackTrace();</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</strong></p><p><strong style="font-family: courier new,courier;">&#160;&#160;&#160; }</strong></p><p><strong style="font-family: courier new,courier;">}</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have tried to embed these POJO-s, as Processor beans, into Camel routes, with no success.</p><p>I was not able to run them in ServiceMix. (They were originally running in Eclipse, so I bundlefied and deployed tose JBoss JARs, which were imported automatically by the IDE.)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>It is rather funny to me, that only a number of forum topics deal with such a cardinal question: how to make Camel routes between</p><p>JBoss MQ-s, and something else. JBoss MQ-s are widely used...</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Also, if there is a handful of topics on it, they do not conclude to anything, or they state some wrong,</p><p>stupid solutions, that doesn't work.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>So I kindly ask, if there is a single man/woman on the Internet, who can solve this problem IN REALITY,</p><p>please tell the EXACT solution to me.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I am especially interested in:</p><p>&#160;&#160;&#160; - the exact Camel/Spring config,</p><p>&#160;&#160;&#160; - the JAr's Import-Package statements,</p><p>&#160;&#160;&#160; - and the dependency JARs GAV values.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>[Perhaps my JBoss is not configured properly (I don't think so), or I missed some beans from the camel-context.xml...]</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>With best regards:</p><p>Tam&#225;s Benke</p><p>Junior Java developer, IOCC team</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Lufthansa Systems Hung&#225;ria Kft.</p><p>BUD LSYH - Airline Management Solutions</p><p>INFOPARK, Building E</p><p>Neumann J&#225;nos u. 1./E.</p><p>H-1117 Budapest</p><p>Hungary</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span>E-mail: </span><a class="jive-link-email-small" href="mailto:tamas.benke.U522971@LHsystems.com" rel="nofollow" target="_blank">tamas.benke.U522971@LHsystems.com</a></p><p>www.LHsystems.com</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/801818#801818">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Messaging at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2042">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>