Apache ActiveMQ Artemis 地址已被使用
Apache ActiveMQ Artemis address already in use
在 Windows 10 日,Apache ActiveMQ Artemis 2.11.0 将无法启动,因为:
2020-03-28 23:03:04,322 INFO [org.apache.activemq.artemis.core.server] AMQ221080: Deploying address ExpiryQueue supporting [ANYCAST]
2020-03-28 23:03:04,322 INFO [org.apache.activemq.artemis.core.server] AMQ221003: Deploying ANYCAST queue ExpiryQueue on address ExpiryQueue
2020-03-28 23:03:06,418 ERROR [org.apache.activemq.artemis.core.server] AMQ224000: Failure in initialisation: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method) [rt.jar:1.8.0_212]
at sun.nio.ch.Net.bind(Net.java:433) [rt.jar:1.8.0_212]
at sun.nio.ch.Net.bind(Net.java:425) [rt.jar:1.8.0_212]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) [rt.jar:1.8.0_212]
at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:130) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:563) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1332) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:488) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:473) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:984) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:259) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:366) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:495) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor.run(SingleThreadEventExecutor.java:905) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at org.apache.activemq.artemis.utils.ActiveMQThreadFactory.run(ActiveMQThreadFactory.java:118) [artemis-commons-2.11.0.jar:2.11.0]
2020-03-28 23:03:06,423 INFO [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.11.0 [0.0.0.0, nodeID=61904c81-713a-11ea-ad5b-902b34592bce]
2020-03-28 23:03:06,978 INFO [org.apache.activemq.hawtio.branding.PluginContextListener] Initialized activemq-branding plugin
我和其他一些人一样看过这个 post。问题是我出错了,没有明确提到正在使用哪个端口,只有:
java.net.BindException: Address already in use: bind
我已经尝试了所有建议的解决方案,但都无济于事。此外,没有 conf
文件夹或 activemq.xml
文件。
更新:根据之前的陈述,我的意思是我已经检查过并且 Artemis 使用的 none 端口已经被其他 service/application 使用。
我能找到的只是经纪人 etc
文件夹中的 broker.xml
文件。 None 个标准端口正在使用中。还尝试禁用 ICS(Internet 连接共享)- 完全没有效果。
我在这里想念什么?
ActiveMQ 5.x 使用 conf/activemq.xml
,但 ActiveMQ Artemis 使用 etc/broker.xml
所以你看到的是预期的。最终这里的问题,如 the answer you cited 所述,是已经有一个代理 运行 或一些其他服务 运行 正在使用 ActiveMQ 想要绑定到的端口.
ActiveMQ Artemis 默认绑定到少数几个端口。这些论文在 etc/broker.xml
中定义。这是默认配置:
<acceptors>
<acceptor name="artemis">tcp://0.0.0.0:61616??anycastPrefix=jms.queue.;multicastPrefix=jms.topic.;tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300</acceptor>
<acceptor name="amqp">tcp://0.0.0.0:5672?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=AMQP;useEpoll=true;amqpCredits=1000;amqpLowCredits=300</acceptor>
<acceptor name="stomp">tcp://0.0.0.0:61613?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=STOMP;useEpoll=true</acceptor>
<acceptor name="hornetq">tcp://0.0.0.0:5445?protocols=HORNETQ,STOMP;useEpoll=true</acceptor>
<acceptor name="mqtt">tcp://0.0.0.0:1883?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=MQTT;useEpoll=true</acceptor>
</acceptors>
因此,默认情况下,代理绑定到这些端口:
- 61616
- 5672
- 61613
- 5445
- 1883
当您启动代理时,这些端口中的任何一个可能已经在使用中。很可能您不需要您的经纪人监听这些端口中的 所有 ,因此我建议您禁用除您绝对需要的以外的所有端口。如果这能解决您的问题,那就太好了,但如果没有,您可以使用消除过程来查找已经在使用的那个或 other answer 中的命令之一(例如 netstat
、fuser
, ETC。)。确定有问题的端口后,您可以更改 broker.xml
以使用不同的端口或停止已经在使用它的进程。
如果 none 个端口确实正在使用,那么这意味着 JVM 网络堆栈的核心部分存在错误,因为这是异常的来源。我的直觉是没有这样的错误,所以我建议使用我之前提到的消除过程。尝试注释掉所有 acceptor
元素并启动代理。由于代理不会尝试绑定到任何端口,因此应该也不例外。然后停止代理并添加 acceptor
元素之一并重新启动代理。对每个 acceptor
执行此操作,直到问题再次出现,此时您可以更改代理的配置以使用不同的端口。
我只是要添加这个,以防有人偶然发现这个 post 而上面的解决方案不起作用;
我在配置第一个代理旁边的第二个代理时遇到了这个问题。我遇到了与 Java 抛出 java.net.BindException: Address already in use: bind
相同的问题。
配置的接受器端口未使用,但问题是每个代理实例都有自己的管理控制台。因此,这个控制台也需要一个端口。在配置第二个代理时,ActiveMQ 设置了与第一个代理的控制台端口相同的默认控制台端口。
您也需要将 bootstrap.xml
中的控制台端口更改为未使用的端口。
希望这对你们中的一些人有所帮助:)
在 Windows 10 日,Apache ActiveMQ Artemis 2.11.0 将无法启动,因为:
2020-03-28 23:03:04,322 INFO [org.apache.activemq.artemis.core.server] AMQ221080: Deploying address ExpiryQueue supporting [ANYCAST]
2020-03-28 23:03:04,322 INFO [org.apache.activemq.artemis.core.server] AMQ221003: Deploying ANYCAST queue ExpiryQueue on address ExpiryQueue
2020-03-28 23:03:06,418 ERROR [org.apache.activemq.artemis.core.server] AMQ224000: Failure in initialisation: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method) [rt.jar:1.8.0_212]
at sun.nio.ch.Net.bind(Net.java:433) [rt.jar:1.8.0_212]
at sun.nio.ch.Net.bind(Net.java:425) [rt.jar:1.8.0_212]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) [rt.jar:1.8.0_212]
at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:130) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:563) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1332) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:488) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:473) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:984) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:259) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:366) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:495) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor.run(SingleThreadEventExecutor.java:905) [netty-all-4.1.34.Final.jar:4.1.34.Final]
at org.apache.activemq.artemis.utils.ActiveMQThreadFactory.run(ActiveMQThreadFactory.java:118) [artemis-commons-2.11.0.jar:2.11.0]
2020-03-28 23:03:06,423 INFO [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.11.0 [0.0.0.0, nodeID=61904c81-713a-11ea-ad5b-902b34592bce]
2020-03-28 23:03:06,978 INFO [org.apache.activemq.hawtio.branding.PluginContextListener] Initialized activemq-branding plugin
我和其他一些人一样看过这个 post。问题是我出错了,没有明确提到正在使用哪个端口,只有:
java.net.BindException: Address already in use: bind
我已经尝试了所有建议的解决方案,但都无济于事。此外,没有 conf
文件夹或 activemq.xml
文件。
更新:根据之前的陈述,我的意思是我已经检查过并且 Artemis 使用的 none 端口已经被其他 service/application 使用。
我能找到的只是经纪人 etc
文件夹中的 broker.xml
文件。 None 个标准端口正在使用中。还尝试禁用 ICS(Internet 连接共享)- 完全没有效果。
我在这里想念什么?
ActiveMQ 5.x 使用 conf/activemq.xml
,但 ActiveMQ Artemis 使用 etc/broker.xml
所以你看到的是预期的。最终这里的问题,如 the answer you cited 所述,是已经有一个代理 运行 或一些其他服务 运行 正在使用 ActiveMQ 想要绑定到的端口.
ActiveMQ Artemis 默认绑定到少数几个端口。这些论文在 etc/broker.xml
中定义。这是默认配置:
<acceptors>
<acceptor name="artemis">tcp://0.0.0.0:61616??anycastPrefix=jms.queue.;multicastPrefix=jms.topic.;tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300</acceptor>
<acceptor name="amqp">tcp://0.0.0.0:5672?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=AMQP;useEpoll=true;amqpCredits=1000;amqpLowCredits=300</acceptor>
<acceptor name="stomp">tcp://0.0.0.0:61613?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=STOMP;useEpoll=true</acceptor>
<acceptor name="hornetq">tcp://0.0.0.0:5445?protocols=HORNETQ,STOMP;useEpoll=true</acceptor>
<acceptor name="mqtt">tcp://0.0.0.0:1883?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=MQTT;useEpoll=true</acceptor>
</acceptors>
因此,默认情况下,代理绑定到这些端口:
- 61616
- 5672
- 61613
- 5445
- 1883
当您启动代理时,这些端口中的任何一个可能已经在使用中。很可能您不需要您的经纪人监听这些端口中的 所有 ,因此我建议您禁用除您绝对需要的以外的所有端口。如果这能解决您的问题,那就太好了,但如果没有,您可以使用消除过程来查找已经在使用的那个或 other answer 中的命令之一(例如 netstat
、fuser
, ETC。)。确定有问题的端口后,您可以更改 broker.xml
以使用不同的端口或停止已经在使用它的进程。
如果 none 个端口确实正在使用,那么这意味着 JVM 网络堆栈的核心部分存在错误,因为这是异常的来源。我的直觉是没有这样的错误,所以我建议使用我之前提到的消除过程。尝试注释掉所有 acceptor
元素并启动代理。由于代理不会尝试绑定到任何端口,因此应该也不例外。然后停止代理并添加 acceptor
元素之一并重新启动代理。对每个 acceptor
执行此操作,直到问题再次出现,此时您可以更改代理的配置以使用不同的端口。
我只是要添加这个,以防有人偶然发现这个 post 而上面的解决方案不起作用;
我在配置第一个代理旁边的第二个代理时遇到了这个问题。我遇到了与 Java 抛出 java.net.BindException: Address already in use: bind
相同的问题。
配置的接受器端口未使用,但问题是每个代理实例都有自己的管理控制台。因此,这个控制台也需要一个端口。在配置第二个代理时,ActiveMQ 设置了与第一个代理的控制台端口相同的默认控制台端口。
您也需要将 bootstrap.xml
中的控制台端口更改为未使用的端口。
希望这对你们中的一些人有所帮助:)