5 Replies Latest reply on May 7, 2015 11:58 AM by romsky007

    jms-bridge to read messages from AS 5.2 with hornetq

    romsky007

      Salut,

       

      I try to configure standalone-full.xml to add jams-bridge to JBOSS 5.2 server with HornetQ.

       

             </hornetq-server>

                  <jms-bridge name="myBridge" module="org.hornetq">

                      <source>

                          <connection-factory name="ConnectionFactory"/>

                          <destination name="JMS_BE2FE_CLUSTER"/>

                          <user>guest</user>

                          <password>guest</password>

                          <context>

                              <property key="java.naming.provider.url" value="remote://172.30.5.81:4447"/>

                              <property key="java.naming.security.principal" value="guest"/>

                              <property key="java.naming.security.credentials" value="guest"/>

                          </context>

                      </source>

                      <target>

                          <connection-factory name="ConnectionFactory"/>

                          <destination name="java:global/jms/topic/BE2FE"/>

                      </target>

                      <quality-of-service>ONCE_AND_ONLY_ONCE</quality-of-service>

                      <failure-retry-interval>1000</failure-retry-interval>

                      <max-retries>1</max-retries>

                      <max-batch-size>10</max-batch-size>

                      <max-batch-time>100</max-batch-time>

                      <add-messageID-in-header>true</add-messageID-in-header>

                  </jms-bridge>

      </subsystem>

       

      By this configuration I've got following error:

       

      17:33:26,138 WARN  [org.hornetq.jms.server] (pool-3-thread-1) HQ122010: Failed to connect JMS Bridge: javax.naming.NameNotFoundException: JMS_BE2FE_CLUSTER -- service jboss.naming.context.java.JMS_BE2FE_CLUSTER

       

       

      How to solve that bridge?

       

      Thank you!

        • 1. Re: jms-bridge to read messages from AS 5.2 with hornetq
          jbertram

          I'm not clear on your use-case here.  Is the server referenced in the "source" section of the bridge configuration a JBoss AS 5.2 instance?

           

          As far as the error you're receiving, the bridge is simply saying it can't find the JNDI name "JMS_BE2FE_CLUSTER" on the "source" server.  This is almost certainly an environmental or configuration issue and you haven't provided enough information (e.g. the "source" server's JMS configuration) to comment further.

          • 2. Re: jms-bridge to read messages from AS 5.2 with hornetq
            romsky007

            The source destination is a clustered topic. It runs on AS 5.2 and is defined in hornetq-jms.xml as

               <topic name="clu.JMS_BE2FE_CLUSTER">

                  <entry name="/JMS_BE2FE_CLUSTER" />

               </topic>

             

            The target topic java:global/jms/topic/BE2FE runs on WildFly 8.2 .

             

            There are some examples where

            <property key="java.naming.provider.url" value="remote://172.30.5.81:4447"/>

            or

            <property key="java.naming.provider.url" value="jnp://172.30.5.81:1099"/>


            I tried many combinations, but got no luck.



            • 3. Re: jms-bridge to read messages from AS 5.2 with hornetq
              jbertram

              Consider the bridge just like a plain, remote client that is using the JMS and JNDI APIs to lookup and use resources from the server.  The JNDI names and context properties used by the bridge are the same as those which would be used by such a client.  JBoss AS 5.2 doesn't listen for JNDI connections on port 4447 nor does the JNDI implementation understand "remote://".  All that stuff came later in JBoss AS 7.  You're going to need to use something like this:

               

              <context>
                  <property key="java.naming.provider.url" value="jnp://172.30.5.81:1099"/>
                  <property key="java.naming.factory.initial" value="org.jnp.interfaces.NamingContextFactory"/>
                  <property key="java.naming.factory.url.pkgs" value="org.jboss.naming:org.jnp.interfaces"/>
              </context>
              
              • 4. Re: jms-bridge to read messages from AS 5.2 with hornetq
                romsky007

                Finally I've got it running...

                 

                I had to create new module(org.jboss.as.jms-client):

                 

                <?xml version="1.0" encoding="UTF-8"?>

                <module xmlns="urn:jboss:module:1.3" name="org.jboss.as.jms-client">

                    <resources>

                        <resource-root path="hornetq-core-client-2.2.13.Final.jar"/>

                        <resource-root path="hornetq-jms-client-2.2.13.Final.jar"/>

                        <resource-root path="jboss-as-build-config-7.1.1.Final.jar"/>

                        <resource-root path="jboss-ejb-client-1.0.0.Final.jar"/>

                        <resource-root path="jboss-logging-3.1.0.GA.jar"/>

                        <resource-root path="jboss-marshalling-1.3.11.GA.jar"/>

                        <resource-root path="jboss-marshalling-river-1.3.11.GA.jar"/>

                        <resource-root path="jboss-remote-naming-1.0.2.Final.jar"/>

                        <resource-root path="jboss-remoting-3.2.3.GA.jar"/>

                        <resource-root path="jboss-sasl-1.0.0.Final.jar"/>

                        <resource-root path="netty-3.2.6.Final.jar"/>

                        <resource-root path="xnio-api-3.0.3.GA.jar"/>

                        <resource-root path="xnio-nio-3.0.3.GA.jar"/>

                        <resource-root path="jnp-client-4.2.2.GA.jar"/>

                        <resource-root path="jbossall-client-4.2.2.GA.jar"/>

                    </resources>

                 

                    <dependencies>

                        <module name="javax.api"/>

                        <module name="javax.jms.api"/>

                    </dependencies>

                </module>

                 

                The jar's are given from this maven dependencies:

                <dependency>

                    <groupId>org.jboss.as</groupId>

                    <artifactId>jboss-as-jms-client-bom</artifactId>

                    <version>7.1.1.Final</version>

                    <type>pom</type>

                </dependency>

                • 5. Re: jms-bridge to read messages from AS 5.2 with hornetq
                  romsky007

                  And yet changes in standalone-full.xml:

                   

                              <jms-bridge name="myBridge" module="org.jboss.as.jms-client">

                                  <source>

                                      <connection-factory name="ConnectionFactory"/>

                                      <destination name="JMS_BE2FE_CLUSTER"/>

                                      <user>guest</user>

                                      <password>guest</password>

                                      <context>

                                          <property key="java.naming.factory.initial" value="org.jnp.interfaces.NamingContextFactory"/>

                                          <property key="java.naming.provider.url" value="jnp://172.30.5.81:1099"/>

                                          <property key="java.naming.factory.url.pkgs" value="org.jboss.ejb.client.naming:org.jboss.naming.client:org.jnp.interfaces"/>

                                          <property key="java.naming.security.principal" value="guest"/>

                                          <property key="java.naming.security.credentials" value="guest"/>

                                      </context>

                                  </source>

                                  <target>

                                      <connection-factory name="ConnectionFactory"/>

                                      <destination name="java:global/jms/topic/CFD.BE2FE"/>

                                  </target>

                                  <quality-of-service>ONCE_AND_ONLY_ONCE</quality-of-service>

                                  <failure-retry-interval>1000</failure-retry-interval>

                                  <max-retries>1</max-retries>

                                  <max-batch-size>10</max-batch-size>

                                  <max-batch-time>100</max-batch-time>

                                  <add-messageID-in-header>true</add-messageID-in-header>

                              </jms-bridge>