我尝试在 Jboss EAP 6.3 中内置的 HornetQ 和 Jboss 4.2.2 上托管的 Jboss Messaging 主题之间设置 JMS 桥。网桥在 Jboss EAP 6.3 端配置 - 在standalone.xml 中,目的是监听本地 HornetQ 主题并发布到远程 Jboss 消息。为此,我尝试遵循此处描述的建议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_Enterprise_Application_Platform_6.html 目前我将其配置如下:
<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>
我创建了下一个模块:
<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>
当我尝试启动 Jboss 时,我遇到了下一个异常:
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
主机可用且端口已打开,因此配置存在问题。我想在我创建的模块中。我还没有找到合适的例子,所以我决定在模块中包含一个包含org.jnp.interfaces.NamingContextFactory
jboss-messaging.jar 的库。也许必须涉及其他东西?或者也许我错误地配置了 jmg-bridge 本身?
如果您有任何想法,请提供帮助)