JMS bridge between HornetQ (Jboss EAP 6.3) and Jboss messaging (Jboss 4.2.2)

I am trying to set up a JMS bridge between HornetQ built in Jboss EAP 6.3 and Jboss Messaging hosted on Jboss 4.2.2. The bridge is configured on the Jboss EAP 6.3 side - in standalone.xml, and the goal is to listen to the local HornetQ topic and publish to the remote Jboss Messaging. For this, I try to follow the guidelines described here https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.2/html/Migration_Guide/Configure_a_JMS_Bridge_to_Migrate_Existing_JMS_Messages_to_Migrate_Existing_JMS_Messages_to_Migrate_Existing_JMS_Messages_to_Migrate_Existing_JMS_Messages_to_Migrate .

    <jms-bridge name="myBridge" module="org.jbossmessaging">
                <source>
                    <connection-factory name="ConnectionFactory"/>
                    <destination name="jms/SourceTopic"/>
                </source>
                <target>
                    <connection-factory name="java:/ConnectionFactory"/>
                    <destination name="jms/TargetTopic"/>
                    <user>user</user>
                    <password>pass</password>					
                    <context>
                        <property key="java.naming.factory.initial" value="org.jnp.interfaces.NamingContextFactory"/>
                        <property key="java.naming.provider.url" value="jnp://10.26.75.194:1099"/>
                        <property key="java.naming.factory.url.pkgs" value="org.jboss.naming:org.jnp.interfaces"/>
                    </context>
                </target>				
                <quality-of-service>DUPLICATES_OK</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>
      

Run codeHide result


I created the following module:

<module xmlns="urn:jboss:module:1.1" name="org.jbossmessaging">
<properties>
    <property name="jboss.api" value="private"/>
</properties> 

<resources>
    <!-- Insert resources required to connect to the source or target   -->
    <resource-root path="jnp-client-4.0.2.jar" />
    <resource-root path="jboss-messaging.jar" />
</resources> 

<dependencies>
   <!-- Add the dependencies required by JMS Bridge code                 -->
   <module name="javax.api" />
   <module name="javax.jms.api" />
   <module name="javax.transaction.api"/>
   <!-- Add a dependency on the org.hornetq module since we send         -->
   <!-- messages to the HornetQ server embedded in the local EAP instance -->
   <module name="org.hornetq" />
   <module name="org.jboss.logging" />
</dependencies></module>

      

And when I try to start Jboss, I have the following exception:

20:49:37,101 WARN  [org.hornetq.jms.server] (ServerService Thread Pool -- 62) HQ122010: Failed to connect JMS Bridge: javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 10.26.75.194; nested exception is: 
	java.net.ConnectException: Connection timed out: connect]
	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:647) [jnpserver-3.2.3.jar:3.2.3 (build: CVSTag=JBoss_3_2_3 date=200311301445)]
	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507) [jnpserver-3.2.3.jar:3.2.3 (build: CVSTag=JBoss_3_2_3 date=200311301445)]
	at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0_40]
	at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0_40]
	at org.hornetq.jms.bridge.impl.JNDIFactorySupport.createObject(JNDIFactorySupport.java:58) [hornetq-jms-server-2.3.21.Final-redhat-1.jar:2.3.21.Final-redhat-1]
	at org.hornetq.jms.bridge.impl.JNDIDestinationFactory.createDestination(JNDIDestinationFactory.java:40) [hornetq-jms-server-2.3.21.Final-redhat-1.jar:2.3.21.Final-redhat-1]
	at org.hornetq.jms.bridge.impl.JMSBridgeImpl.setupJMSObjects(JMSBridgeImpl.java:1236) [hornetq-jms-server-2.3.21.Final-redhat-1.jar:2.3.21.Final-redhat-1]
	at org.hornetq.jms.bridge.impl.JMSBridgeImpl.start(JMSBridgeImpl.java:416) [hornetq-jms-server-2.3.21.Final-redhat-1.jar:2.3.21.Final-redhat-1]
	at org.jboss.as.messaging.jms.bridge.JMSBridgeService.startBridge(JMSBridgeService.java:99)
	at org.jboss.as.messaging.jms.bridge.JMSBridgeService$1.run(JMSBridgeService.java:78)
	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]
	at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: java.rmi.ConnectException: Connection refused to host: 10.26.75.194; nested exception is: 
	java.net.ConnectException: Connection timed out: connect
	at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619) [rt.jar:1.8.0_40]
	at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216) [rt.jar:1.8.0_40]
	at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202) [rt.jar:1.8.0_40]
	at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:130) [rt.jar:1.8.0_40]
	at org.jnp.server.NamingServer_Stub.lookup(Unknown Source) [jnpserver-3.2.3.jar:3.2.3 (build: CVSTag=JBoss_3_2_3 date=200311301445)]
	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528) [jnpserver-3.2.3.jar:3.2.3 (build: CVSTag=JBoss_3_2_3 date=200311301445)]
	... 13 more
Caused by: java.net.ConnectException: Connection timed out: connect
	at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method) [rt.jar:1.8.0_40]
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345) [rt.jar:1.8.0_40]
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) [rt.jar:1.8.0_40]
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) [rt.jar:1.8.0_40]
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) [rt.jar:1.8.0_40]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) [rt.jar:1.8.0_40]
	at java.net.Socket.connect(Socket.java:589) [rt.jar:1.8.0_40]
	at java.net.Socket.connect(Socket.java:538) [rt.jar:1.8.0_40]
	at java.net.Socket.<init>(Socket.java:434) [rt.jar:1.8.0_40]
	at java.net.Socket.<init>(Socket.java:211) [rt.jar:1.8.0_40]
	at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40) [rt.jar:1.8.0_40]
	at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:148) [rt.jar:1.8.0_40]
	at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613) [rt.jar:1.8.0_40]
	... 18 more
      

Run codeHide result


The host is available and the port is open, so the problem is in the configuration. In a module I created, I guess. I couldn't find a suitable example, so I decided to include a library containing org.jnp.interfaces.NamingContextFactory

jboss-messaging.jar in the module . Maybe something else should be involved? Or maybe I misconfigured the jmg-bridge myself?

Please help if you have any ideas)

+3


source to share


1 answer


Finally, I solved the problem. And the key was, like crazy, in the correct module configuration. So below the module.xml fits (at least for Jboss Messaging 1.4.2):

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.jbossmessaging">
<properties>
    <property name="jboss.api" value="private"/>
</properties>

<resources>
    <!-- Insert resources required to connect to the source or target   -->
    <resource-root path="jnp-client-4.0.2.jar"/>
    <resource-root path="jboss-messaging.jar"/>
    <resource-root path="jboss-aop-2.1.1.ga.jar"/>
    <resource-root path="jboss-remoting.jar"/>
    <resource-root path="jboss-common-4.2.3.jar"/>
    <resource-root path="trove-1.0.2.jar"/>
    <resource-root path="javassist.jar"/>
    <resource-root path="jboss-mdr.jar"/>
    <resource-root path="concurrent-1.3.4.jar"/>
    <resource-root path="log4j-snmp-appender.jar"/>
    <resource-root path="log4j.jar"/>
    <resource-root path="jboss-serialization.jar"/>
</resources>

<dependencies>
    <module name="javax.api"/>
    <module name="javax.jms.api"/>
    <module name="javax.transaction.api"/>
    <module name="org.hornetq"/>
    <module name="org.jboss.common-core"/>
</dependencies>
</module>

      



These configurations have been tested for both directions (I made another bridge that listened to Jboss Messaging and posted HornetQ) and both look ok

+2


source







All Articles