3

我在 docker 容器(Container-A)中安装了一个 wildfly 10 实例。如果我尝试从同一引擎(Server-B,引擎)的其他容器中查找队列,一切正常。

相反,当尝试使用映射到容器的端口 7080 上的服务器 B 的 IP 地址从引擎(服务器 C)的同一网络上的虚拟机中查找队列时,我遇到了问题(请参阅下面的跟踪) 8080 端口。

我尝试打开从 Server-C 到 Container-A 的 telnet 连接(使用 Server-B ip 地址和 7080 端口),连接看起来正常。

谁能帮我??

C:\App>java -jar my-jar.jar
log4j:WARN No appenders could be found for logger (com.myApp.S
etUpBowcaster).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more in
fo.
2017-05-30 18:44:01 INFO  SetUpBowcaster:? - PROCESSORS BUSES INITIALIZATION
2017-05-30 18:44:01 INFO  xnio:93 - XNIO version 3.3.4.Final
2017-05-30 18:44:01 INFO  nio:55 - XNIO NIO Implementation Version 3.3.4.Final
2017-05-30 18:44:01 INFO  remoting:73 - JBoss Remoting version 4.0.18.Final
2017-05-30 18:44:01 INFO  remoting:103 - EJBCLIENT000017: Received server versio
n 2 and marshalling strategies [river]
2017-05-30 18:44:01 INFO  remoting:219 - EJBCLIENT000013: Successful version han
dshake completed for receiver context EJBReceiverContext{clientContext=org.jboss
.ejb.client.EJBClientContext@15b3e5b, receiver=Remoting connection EJB receiver
[connection=Remoting connection <56467971>,channel=jboss.ejb,nodename=my-jms-master]} on channel Channel ID b9880cf2 (outbound) of Remoting connec
tion 71d15f18 to /10.0.0.247:7080
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further detail
s.
2017-05-30 18:44:02 INFO  client:45 - JBoss EJB Client version 2.1.4.Final
2017-05-30 18:44:03 ERROR client:686 - AMQ214016: Failed to create netty connect
ion
java.nio.channels.UnresolvedAddressException
        at sun.nio.ch.Net.checkAddress(Net.java:123)
        at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:622)
        at io.netty.channel.socket.nio.NioSocketChannel.doConnect(NioSocketChann
el.java:209)
        at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(Abs
tractNioChannel.java:207)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultCh
annelPipeline.java:1097)
        at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(Abstract
ChannelHandlerContext.java:471)
        at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChanne
lHandlerContext.java:456)
        at io.netty.channel.ChannelOutboundHandlerAdapter.connect(ChannelOutboun
dHandlerAdapter.java:47)
        at io.netty.channel.CombinedChannelDuplexHandler.connect(CombinedChannel
DuplexHandler.java:167)
        at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(Abstract
ChannelHandlerContext.java:471)
        at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChanne
lHandlerContext.java:456)
        at io.netty.channel.ChannelDuplexHandler.connect(ChannelDuplexHandler.ja
va:50)
        at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(Abstract
ChannelHandlerContext.java:471)
        at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChanne
lHandlerContext.java:456)
        at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChanne
lHandlerContext.java:438)
        at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipelin
e.java:908)
        at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:203)
        at io.netty.bootstrap.Bootstrap$2.run(Bootstrap.java:166)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(Single
ThreadEventExecutor.java:358)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThread
EventExecutor.java:112)
        at java.lang.Thread.run(Thread.java:745)
Exception in thread "main" com.myApp.exceptions.ProcessorStart
upException: javax.jms.JMSException: Failed to create session factory
        at com.myApp.SetUpBowcaster.main(Unknown Source)
Caused by: javax.jms.JMSException: Failed to create session factory
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.crea
teConnectionInternal(ActiveMQConnectionFactory.java:727)
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.crea
teQueueConnection(ActiveMQConnectionFactory.java:284)
        at com.myApp.applicationLayer.jms.BowcasterProcessorsH
andlersManager.setUpJmsConnection(Unknown Source)
        at com.myApp.applicationLayer.jms.BowcasterProcessorsH
andlersManager.<init>(Unknown Source)
        at com.myApp.applicationLayer.jms.BowcasterProcessorsH
andlersManager.getInstance(Unknown Source)
        ... 1 more
Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ1190
07: Cannot connect to server(s). Tried with all available servers.]
        at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.create
SessionFactory(ServerLocatorImpl.java:777)
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.crea
teConnectionInternal(ActiveMQConnectionFactory.java:724)
        ... 5 more
2017-05-30 18:44:03 INFO  remoting:482 - EJBCLIENT000016: Channel Channel ID b98
80cf2 (outbound) of Remoting connection 71d15f18 to /10.0.0.247:7080 can no long
er process messages
4

2 回答 2

2

我通过以这种方式创建连接来解决:

Map<String, Object> connectionParams = new HashMap<String, Object>();
connectionParams.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.HOST_PROP_NAME, nattedIp); // <-- PUT THE NATTED IP HERE!
connectionParams.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, nattedPort);
connectionParams.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.HTTP_UPGRADE_ENABLED_PROP_NAME, "true");
connectionParams.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.HTTP_UPGRADE_ENDPOINT_PROP_NAME, "http-acceptor");

TransportConfiguration transportConfiguration = new org.apache.activemq.artemis.api.core.TransportConfiguration(JMS_NETTY_CONNECTOR_FACTORY_PROPERTY_NAME, connectionParams);

ActiveMQConnectionFactory jmsConnnectionFactory =     ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.TOPIC_CF, transportConfiguration);

if (jmsConnnectionFactory != null) {    
    jmsConnnection = jmsConnnectionFactory.createConnection();
}
于 2017-07-13T15:34:43.933 回答
0

address:port 可能需要完全限定。我通过更改代码中的以下属性来解决此问题:

artemis.nodes=machine-artemis-01:port

至:

artemis.nodes=machine-artemis-01.place.company.com:port
于 2017-07-07T15:03:25.023 回答