8 Replies Latest reply on Apr 10, 2015 7:29 AM by Justas D

    JMS bridge between standalone WildFly instances.

    Justas D Newbie

      Is there any decent example of up to date JMS bridge configuration between two standalone WildFly instances?

      Including security is preferred.

        • 2. Re: JMS bridge between standalone WildFly instances.
          Justas D Newbie

          I have tried this already. The thing is that I receive this error:

           

          Failed to connect JMS Bridge: javax.naming.AuthenticationException: Failed to connect to any server. Servers tried: [http-remoting://10.100.148.252:8080 (Authentication failed: the server presented no authentication mechanisms)] [Root exception is javax.security.sasl.SaslException: Authentication failed: the server presented no authentication mechanisms]

           

          I have added user on remote server, but it does not change error message.

          • 3. Re: JMS bridge between standalone WildFly instances.
            Justin Bertram Master

            Simply adding a user on the remote server likely isn't sufficient.  Are you also configuring the bridge with the proper credentials both for the JMS and JNDI connections?

             

            I'm curious why you are using a JMS bridge between Wildfly instances.  If they are both running HornetQ then a HornetQ core bridge would make more sense.

            • 4. Re: JMS bridge between standalone WildFly instances.
              Justas D Newbie

              Thanks for the tip. I have reconfigured bridge configuration, but still, no success.

               

              Destination host:

              /subsystem=messaging/hornetq-server=default/:write-attribute(name=security-enabled,value=true)

              /subsystem=messaging/hornetq-server=default/:write-attribute(name=persistence-enabled,value=true)

              /subsystem=messaging/hornetq-server=default/jms-queue=sc.myqueue.input/:add(entries=["jms/queue/sc/myqueue/input","java:jboss/exported/jms/queue/sc/myqueue/input"])

               

               

              Source host:

              /subsystem=messaging/hornetq-server=default/:write-attribute(name=security-enabled,value=true)

              /subsystem=messaging/hornetq-server=default/:write-attribute(name=persistence-enabled,value=true)

              /socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=messaging-remote-my:add(host=10.100.158.62, port=8080)

              /subsystem=messaging/hornetq-server=default/remote-connector=http-remote-my:add(socket-binding="messaging-remote-my")

              /subsystem=messaging/hornetq-server=default/jms-queue=sc.myqueue.input/:add(entries=["jms/queue/sc/myqueue/input","java:jboss/exported/jms/queue/sc/myqueue/input"])

              /subsystem=messaging/hornetq-server=default/bridge=my-bridge/:add(user=jmsuser,password=user-pass,queue-name=jms.queue.sc.myqueue.input,forwarding-address=jms.queue.sc.myqueue.input,static-connectors=["http-remote-my"])

               

              Error on source host:

              DEBUG [org.hornetq.core.client] (Thread-5 (HornetQ-server-HornetQServerImpl::serverUUID=ce9b99ea-ddf4-11e4-abe3-777f798844ba-187561483)) Started Netty Connector version unknown

              DEBUG [org.hornetq.core.client] (Thread-5 (HornetQ-server-HornetQServerImpl::serverUUID=ce9b99ea-ddf4-11e4-abe3-777f798844ba-187561483)) Remote destination: /10.100.158.62:8080

              WARN  [org.hornetq.core.server] (Thread-5 (HornetQ-server-HornetQServerImpl::serverUUID=ce9b99ea-ddf4-11e4-abe3-777f798844ba-187561483)) HQ222099: Bridge BridgeImpl@67c6fdda [name=my-bridge, queue=QueueImpl[name=jms.queue.sc.myqueue.input, postOffice=PostOfficeImpl [server=HornetQServerImpl::serverUUID=ce9b99ea-ddf4-11e4-abe3-777f798844ba]]@53c884b2 targetConnector=ServerLocatorImpl (identity=Bridge my-bridge) [initialConnectors=[TransportConfiguration(name=http-remote-my, factory=org-hornetq-core-remoting-impl-netty-NettyConnectorFactory) ?port=8080&host=10-100-158-62&local-address=0-0-0-0], discoveryGroupConfiguration=null]] is unable to connect to destination. It will be disabled.: java.lang.NullPointerException

                      at org.hornetq.core.client.impl.ClientSessionFactoryImpl$PingRunnable.send(ClientSessionFactoryImpl.java:1823) [hornetq-core-client-2.4.5.Final.jar:]

                      at org.hornetq.core.client.impl.ClientSessionFactoryImpl.getConnection(ClientSessionFactoryImpl.java:1423) [hornetq-core-client-2.4.5.Final.jar:]

                      at org.hornetq.core.client.impl.ClientSessionFactoryImpl.getConnectionWithRetry(ClientSessionFactoryImpl.java:1121) [hornetq-core-client-2.4.5.Final.jar:]

                      at org.hornetq.core.client.impl.ClientSessionFactoryImpl.connect(ClientSessionFactoryImpl.java:266) [hornetq-core-client-2.4.5.Final.jar:]

                      at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:881) [hornetq-core-client-2.4.5.Final.jar:]

                      at org.hornetq.core.server.cluster.impl.BridgeImpl.createSessionFactory(BridgeImpl.java:819) [hornetq-server-2.4.5.Final.jar:]

                      at org.hornetq.core.server.cluster.impl.BridgeImpl.connect(BridgeImpl.java:888) [hornetq-server-2.4.5.Final.jar:]

                      at org.hornetq.core.server.cluster.impl.BridgeImpl$ConnectRunnable.run(BridgeImpl.java:1106) [hornetq-server-2.4.5.Final.jar:]

                      at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:104) [hornetq-core-client-2.4.5.Final.jar:]

                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_40]

                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_40]

                      at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_40]

               

               

              Should I setup acceptor or else?

              • 5. Re: JMS bridge between standalone WildFly instances.
                Justin Bertram Master

                You've got a few errors on the "Source host."

                 

                This command is wrong:

                 

                /subsystem=messaging/hornetq-server=default/remote-connector=http-remote-my:add(socket-binding="messaging-remote-my")
                

                 

                It should be:

                 

                /subsystem=messaging/hornetq-server=default/http-connector=http-remote-my:add(socket-binding="messaging-remote-my")
                

                 

                Since you are connecting to 10.100.158.62:8080 (i.e. the HTTP port on the remote server) then you should use the HTTP connector rather than the normal "remote" (i.e. Netty) connector.

                 

                Also, you need to create the core queue for the core bridge, e.g.:

                 

                /subsystem=messaging/hornetq-server=default/queue=jms.queue.sc.myqueue.input:add(queue-address=jms.queue.sc.myqueue.input)
                

                 

                Even though you create the JMS queue later (with the required JNDI bindings) you need to explicitly create the core queue because core bridges are deployed before JMS artifacts and if the core queue isn't available then the bridge will not be deployed.

                 

                I recreated your environment with the corrected connector and core queue and everything worked fine.

                 

                Also, you don't need to enable security and persistence explicitly as those are enabled by default.

                • 6. Re: JMS bridge between standalone WildFly instances.
                  Justas D Newbie

                  I have updated my configuration according to yours provided, but now I receive (address-settings is default):

                  WARN  [org.hornetq.core.server] (ServerService Thread Pool -- 56) HQ222171: Bridge my-bridge forwarding address jms.queue.sc.myqueue.input could not be resolved on address-settings configuration

                   

                  <subsystem xmlns="urn:jboss:domain:messaging:2.0">

                      <hornetq-server>

                          <journal-file-size>102400</journal-file-size>

                   

                          <connectors>

                              <http-connector name="http-connector" socket-binding="http">

                                  <param key="http-upgrade-endpoint" value="http-acceptor"/>

                              </http-connector>

                              <http-connector name="http-connector-throughput" socket-binding="http">

                                  <param key="http-upgrade-endpoint" value="http-acceptor-throughput"/>

                                  <param key="batch-delay" value="50"/>

                              </http-connector>

                              <http-connector name="http-remote-my" socket-binding="messaging-remote-my"/>

                              <in-vm-connector name="in-vm" server-id="0"/>

                          </connectors>

                   

                          <acceptors>

                              <http-acceptor http-listener="default" name="http-acceptor"/>

                              <http-acceptor http-listener="default" name="http-acceptor-throughput">

                                  <param key="batch-delay" value="50"/>

                                  <param key="direct-deliver" value="false"/>

                              </http-acceptor>

                              <in-vm-acceptor name="in-vm" server-id="0"/>

                          </acceptors>

                   

                          <core-queues>

                              <queue name="jms.queue.sc.myqueue.input">

                                  <address>jms.queue.sc.myqueue.input</address>

                              </queue>

                          </core-queues>

                   

                          <bridges>

                              <bridge name="my-bridge">

                                  <queue-name>jms.queue.sc.myqueue.input</queue-name>

                                  <forwarding-address>jms.queue.sc.myqueue.input</forwarding-address>

                                  <user>jmsuser</user>

                                  <password>user-pass</password>

                                  <static-connectors>

                                      <connector-ref>

                                                  http-remote-my

                                      </connector-ref>

                                  </static-connectors>

                              </bridge>

                          </bridges>

                   

                          <security-settings>

                              <security-setting match="#">

                                  <permission type="send" roles="guest"/>

                                  <permission type="consume" roles="guest"/>

                                  <permission type="createNonDurableQueue" roles="guest"/>

                                  <permission type="deleteNonDurableQueue" roles="guest"/>

                              </security-setting>

                          </security-settings>

                   

                          <address-settings>

                              <address-setting match="#">

                                  <dead-letter-address>jms.queue.DLQ</dead-letter-address>

                                  <expiry-address>jms.queue.ExpiryQueue</expiry-address>

                                  <max-size-bytes>10485760</max-size-bytes>

                                  <page-size-bytes>2097152</page-size-bytes>

                                  <message-counter-history-day-limit>10</message-counter-history-day-limit>

                              </address-setting>

                          </address-settings>

                   

                          <jms-connection-factories>

                              <connection-factory name="InVmConnectionFactory">

                                  <connectors>

                                      <connector-ref connector-name="in-vm"/>

                                  </connectors>

                                  <entries>

                                      <entry name="java:/ConnectionFactory"/>

                                  </entries>

                              </connection-factory>

                              <connection-factory name="RemoteConnectionFactory">

                                  <connectors>

                                      <connector-ref connector-name="http-connector"/>

                                  </connectors>

                                  <entries>

                                      <entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>

                                  </entries>

                              </connection-factory>

                              <pooled-connection-factory name="hornetq-ra">

                                  <transaction mode="xa"/>

                                  <connectors>

                                      <connector-ref connector-name="in-vm"/>

                                  </connectors>

                                  <entries>

                                      <entry name="java:/JmsXA"/>

                                      <entry name="java:jboss/DefaultJMSConnectionFactory"/>

                                  </entries>

                              </pooled-connection-factory>

                          </jms-connection-factories>

                   

                          <jms-destinations>

                              <jms-queue name="ExpiryQueue">

                                  <entry name="java:/jms/queue/ExpiryQueue"/>

                              </jms-queue>

                              <jms-queue name="DLQ">

                                  <entry name="java:/jms/queue/DLQ"/>

                              </jms-queue>

                              <jms-queue name="sc.myqueue.input">

                                  <entry name="jms/queue/sc/myqueue/input"/>

                                  <entry name="java:jboss/exported/jms/queue/sc/myqueue/input"/>

                              </jms-queue>

                          </jms-destinations>

                      </hornetq-server>

                  </subsystem>

                  • 7. Re: JMS bridge between standalone WildFly instances.
                    Justin Bertram Master

                    I get that same WARN message on my setup.  It's nothing to worry about.  It's logged because the <forwarding-address> is remote rather than local.  That WARN has been removed in later versions of HornetQ to avoid confusion.

                    • 8. Re: JMS bridge between standalone WildFly instances.
                      Justas D Newbie

                      Yes, bridge works, thank you for your help