14 Replies Latest reply on Nov 19, 2018 10:01 AM by jbertram

    WildFly HornetQ jms bridge to ActiveMQ

    ss1100

      Hi all, I'm trying to setup a jms bridge between WildFly's HornetQ and an ActiveMQ server.  I've found 3 articles online, all at least a year old, describing how to do this and they all describe essentially the same process.  The main one is here:

       

      http://blog.c2b2.co.uk/2014/01/connecting-jboss-wildfly-7-to-activemq.html

       

      We're running WildFly 9.0.1Final (I know this example is running v7, but I haven't found anything more recent and the jboss.org documentation might as well be written in Chinese for a DBA like me) and we can't get the darn messaging subsystem to startup.  Attached is the config file we're using in standalone mode and the log file containing the startup process and the error message.  For brevity, the error is the following:

       

      2015-09-29 19:20:11,995 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([

          ("subsystem" => "messaging"),

          ("jms-bridge" => "simple-jms-bridge")

      ]) - failure description: {"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.messaging.jms-bridge.simple-jms-bridge is missing [jboss.naming.context.java.\" ConnectionFactory \", jboss.naming.context.java.\" queue\".\"JMSBridgeTargetQ \", jboss.naming.context.java.\" AMQConnectionFactory \", jboss.naming.context.java.\" queue\".\"JMSBridgeSourceQ \"]"]}

      2015-09-29 19:20:12,033 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report

      WFLYCTL0184:    New missing/unsatisfied dependencies:

            service jboss.naming.context.java." AMQConnectionFactory " (missing) dependents: [service jboss.messaging.jms-bridge.simple-jms-bridge]

            service jboss.naming.context.java." ConnectionFactory " (missing) dependents: [service jboss.messaging.jms-bridge.simple-jms-bridge]

            service jboss.naming.context.java." queue"."JMSBridgeSourceQ " (missing) dependents: [service jboss.messaging.jms-bridge.simple-jms-bridge]

            service jboss.naming.context.java." queue"."JMSBridgeTargetQ " (missing) dependents: [service jboss.messaging.jms-bridge.simple-jms-bridge]

       

      This doesn't make sense to me, does it mean jboss.messaging.jms-bridge.simple-jms-bridge is missing when it's called by jboss.naming.context.java..., or that jboss.messaging.jms-bridge.simple-jms-bridge is missing the jboss.naming.context.java.... dependency?  I assume the 4 missing dependencies below are just trickled down because the one above caused the simple-jms-bridge  to fail.

       

      I feel like this is so close...  Please help!

        • 1. Re: WildFly HornetQ jms bridge to ActiveMQ
          jbertram

          The article you linked is pretty messed up, in my opinion.  Here are a few thoughts:

          • You should remove all the extraneous spaces at the beginning and end of your configuration.  For example, you use <connection-factory name=" ConnectionFactory "/> when it should be <connection-factory name="ConnectionFactory"/> (noticed the spaces have been removed).  That kind of problem exists throughout the bridge's configuration.
          • There's absolutely no need to use the ActiveMQ JCA RA with the JMS bridge, and I would argue doing so creates extra work and unnecessary complexity.  Think of the JMS bridge just like any remote JMS client.  All it needs to connect to any remote JMS provide is the right client libraries and JNDI look-up information (i.e. initial context properties, JNDI look-up names for connection factory and destination).  There is a perfect example of this in the Wildfly documentation.  Just create a module with the ActiveMQ JMS client libraries and then configure the bridge with the appropriate initial context properties and JNDI names for connection factory and destination.  It should be really straight-forward.
          • 2. Re: WildFly HornetQ jms bridge to ActiveMQ
            ss1100

            The spaces were causing the problems.  Of course it's something like that...  I even noticed them earlier but thought "naah, that wouldn't be causing it"...

             

            Unfortunately, I need the WildFly servers to still be able to queue up messages when they're disconnected from the ActiveMQ server which is why we're choosing to use HornetQ and a JMS bridge.

             

            Thanks for the feedback!

            • 3. Re: WildFly HornetQ jms bridge to ActiveMQ
              jbertram

              Unfortunately, I need the WildFly servers to still be able to queue up messages when they're disconnected from the ActiveMQ server which is why we're choosing to use HornetQ and a JMS bridge.

              I'm not sure why you say that's unfortunate.  This is a normal bridge use-case.

               

              Was this point meant to address my comment about not using the ActiveMQ JCA RA?  If so, I don't see how it's related.

              • 4. Re: WildFly HornetQ jms bridge to ActiveMQ
                ss1100

                I'm not sure what you mean by not using "ActiveMQ JCA RA", are you referring to not using ActiveMQ in particular?  I'm not a Java guy nor a server guy, so this is very foreign to me.

                • 5. Re: WildFly HornetQ jms bridge to ActiveMQ
                  jbertram

                  I'm not sure what you mean by not using "ActiveMQ JCA RA", are you referring to not using ActiveMQ in particular?

                  No, I'm not referring to ActiveMQ itself.

                   

                  The first two steps in the article you linked are:

                  1. Download the ActiveMQ resource adapter archive
                  2. Install and configure the resource adapter in WildFly 7

                   

                  The "ActiveMQ resource adapter" referenced here is the same as the "ActiveMQ JCA RA" that I mentioned (RA stands for "resource adapter").  My point is that you don't, in fact, need the ActiveMQ JCA resource adapter to set up your JMS bridge and that including the RA in the setup is unnecessarily complex.  You just need the ActiveMQ client libraries and the proper initial context properties.  There's a simple example of this kind of setup in the Wildfly documentation which I linked previously.

                   

                  I'm not a Java guy nor a server guy, so this is very foreign to me.

                  You're certainly jumping in the deep end then with attempting to configure a Java application server.

                  • 6. Re: WildFly HornetQ jms bridge to ActiveMQ
                    ss1100

                    Ok, thanks for your help!  I'll take a look at the documentation and see if I can migrate away from the resource adapter.

                    • 7. Re: WildFly HornetQ jms bridge to ActiveMQ
                      mdimouchy

                      Hi Justin,

                       

                      I am very interested by this article and I follow the different steps but I am facing to a jndi problem.

                       

                      My context : W7K / Java 1.8 / ActiveMQ 5.12.1 / WildFly 9.0.2 Final

                       

                      Step 1) Install ActiveMQ

                      Step 2) Install WildfFly

                      Step 3) Create org.activemq.main module with activemq-all-5.12.1.jar, jndi.properties & module.xml files

                      Step 4) Declare the Bridge like this

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

                      <source>

                        <connection-factory name="QueueConnectionFactory"/>

                        <destination name="queueMap"/>

                        <context>

                         <property key="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>

                         <property key="java.naming.provider.url"    value="tcp://localhost:61616"/>

                        </context>

                      </source>

                      <target>

                        <connection-factory name="ConnectionFactory"/>

                        <destination name="/jms/targetQ"/>

                      </target>

                      <quality-of-service>AT_MOST_ONCE</quality-of-service>

                      <failure-retry-interval>500</failure-retry-interval>

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

                      <max-batch-size>500</max-batch-size>

                      <max-batch-time>500</max-batch-time>

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

                      </jms-bridge> 

                       

                      And the problem is :

                      [org.hornetq.jms.server] (ServerService Thread Pool -- 66) HQ122010: Failed to connect JMS Bridge: javax.naming.NameNotFoundException: queueMap

                        at org.apache.activemq.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:235)

                       

                      After hours, I don't identify the solution...

                      How to declare correctly the queue ? In a separate file like jndi.properties and where to put the file ? In the naming subsystem ?

                      I am lost.

                       

                      Thanks in advance.

                      • 8. Re: WildFly HornetQ jms bridge to ActiveMQ
                        jbertram

                        First of all, you shouldn't hi-jack other people's threads, especially when they've already been marked as answered.

                         

                        In regards to your actual questions you should review the documentation for the initial context provider you are using.  In general, every JNDI client implementation is different so each potentially requires different configuration.  If your JNDI lookup is failing with a NameNotFoundException then I expect the problem is either on the server or the client both of which are ActiveMQ implementations and I'm not terribly familiar with either.

                        • 9. Re: WildFly HornetQ jms bridge to ActiveMQ
                          gazzonyx

                          Thanks, Justin!  I just found my way here after reading that article and seeing your response at the bottom.  You've saved me time twice today.  Kudos.

                          • 10. Re: WildFly HornetQ jms bridge to ActiveMQ
                            ipage

                            Justin, could I just confirm your answer please?  Is there also no need to use the resource adapter if using distributed transactions?  I tried to configure the bridge to use XA but it complains that the ActiveMQManagedConnectionFactory isn't an XAConnectionFactory (which of course it isn't).


                            Many thanks.

                            • 11. Re: WildFly HornetQ jms bridge to ActiveMQ
                              jbertram

                              That's correct.  Even if you're using XA you shouldn't need to use a resource adapter with the JMS bridge.  Normal JMS connection factories can implement XA just fine.  You can configure local, standard HornetQ/Artemis JMS connection factories to support XA.  I imagine whatever other provider you're connecting to supports the same kind of configuration.

                              • 12. Re: WildFly HornetQ jms bridge to ActiveMQ
                                ipage

                                Great, thanks Justin.

                                • 13. Re: WildFly HornetQ jms bridge to ActiveMQ
                                  uyphu

                                  Hi Justin,

                                   

                                  Currently I has been migrating from Jboss Eap 6.3 to Wildfly 11 so I need to create a jms-bridge in Wildfly 11 send message to Jboss Eap 6.3.

                                  In Jboss i am using jms-topic and in Wildfly 11 using jms-queue so what do you recommend me to do in this case?

                                   

                                  Thanks,

                                  Phu

                                  • 14. Re: WildFly HornetQ jms bridge to ActiveMQ
                                    jbertram

                                    Please create a new thread and ask your question there rather than tagging onto this old thread which has already been answered.  Thanks!