Activemq can't run due to address already in use error

前端 未结 16 1396
余生分开走
余生分开走 2021-02-12 18:06

How to solve the error?

Java Runtime: Oracle Corporation 1.7.0_05 E:\\Program Files\\Java\\jdk1.7.0_05\\jre
  Heap sizes: current=1004928k  free=994439k  max=100         


        
相关标签:
16条回答
  • 2021-02-12 19:00

    I had the same issue and it seems the port is blocked by another JVM using AMQ connection (ServiceMix as a client of the AMQ service).

    Restarting the ServiceMix unlocked the port reservation and the ActiveMQ Service restarted without issues.

    Note that the previous ActiveMQ process was no running anymore and this seems a limitation of two JVM's and Windows blocking the port as a client still use it. This is not because two instances are trying to start at the same time.

    This perhaps does not answer your specific problem, but it can also helps other people having the same setup.

    0 讨论(0)
  • 2021-02-12 19:02

    For those who landed on this page through google, pay attention to whether the port in conflict matches your error message.

    In this question, the port in conflict is 61616 (Openwire protocol). But if the conflicted port is 5672(AMQP), it might be that there are multiple amqp message brokers installed on the same system.

    RabbitMQ and ActiveMQ running on the same machine

    0 讨论(0)
  • 2021-02-12 19:02

    I faced the same problem with the error being:

    ERROR | Failed to start ActiveMQ JMS Message Broker (localhost, null). Reason: java.io.IOException: Transport Connector could not be registered in JMX: Failed to bind to server socket: tcp://0.0.0.0:61616 due to: java.net.BindException: Address already in use

    Following steps maybe useful:

    1. find the process id that is using this port (in your case, 61616). In command promt write: netstat -a -o -n and look at the process id.
    2. Next kill the process from Task Manager or taskkill /F /PID "process id"

    http://sourcecode-kk.blogspot.in/2013/02/kill-process-running-on-certain-port-in.html

    Cheers.

    0 讨论(0)
  • 2021-02-12 19:04

    The error is telling you that there is either already a broker running or some other service running that is using the required ports that ActiveMQ want to bind its TCP transport and JMX service to. You can see this in the error string "Failed to bind to server socket: tcp://0.0.0.0:61616 due to: java.net.BindException: Address already in use:" and "Transport Connector could not be registered in JMX: Failed to bind to server socket: tcp://0.0.0.0:61616 due to: java.net.BindException: Address already in use:"

    To resolve the issue you need to figure out what is running that is using those ports, or change the config to use other ports

    0 讨论(0)
  • 2021-02-12 19:04

    find the process id using the port number from error logs.

    fuser [port number]/tcp
    

    then use kill -9 [pid] to kill that process.

    0 讨论(0)
  • 2021-02-12 19:04

    When we ran into this issue, we found that the default port (61616) is in the "ephemeral port" range (see https://en.wikipedia.org/wiki/Ephemeral_port for a little background). My understanding is that the OS (Windows 2012 in our case) can allocate the port to whatever it wants so long as it's not already in use. For us, it was fine most of the time, but very occasionally when the server booted up, Windows allocated port 61616 to something else before activemq started, so when activemq tried to start, we got this error.

    The following excerpt is taken from "http://blogs.technet.com/b/askds/archive/2007/08/24/dynamic-client-ports-in-windows-server-2008-and-windows-vista-or-how-i-learned-to-stop-worrying-and-love-the-iana.aspx" which discusses how to set the ephemeral port range in Windows (this article calls them "dynamic ports"):

    In Vista and 2008, most administration of things at the network stack level is handled via NETSH. Using NETSH, it’s possible to see what your dynamic port range is set to on a per server basis:

    netsh int ipv4 show dynamicport tcp

    netsh int ipv4 show dynamicport udp

    netsh int ipv6 show dynamicport tcp

    netsh int ipv6 show dynamicport udp

    These commands will output the dynamic port range currently in use. Kind of a neat fact is that you can have different ranges for TCP and UDP, or for IPv4 and IPv6, although they all start off the same.

    In Windows Server 2003 the range always defaults to starting with TCP port 1024, and that is hard-coded. But in Vista/2008, you can move the starting point of the range around. So if you needed to, you could tell your servers to use ports 5000 through 15000 for dynamic port allocations, or any contiguous range of ports you wanted. To do this, you use NETSH again:

    netsh int ipv4 set dynamicport tcp start=10000 num=1000

    netsh int ipv4 set dynamicport udp start=10000 num=1000

    netsh int ipv6 set dynamicport tcp start=10000 num=1000

    netsh int ipv4 set dynamicport udp start=10000 num=1000

    The examples above would set your dynamic port range to start at port 10000 and go through port 11000 (1000 ports).

    A few important things to know about the port range:

    • The smallest range of ports you can set is 255.

    • The lowest starting port that you can set is 1025.

    • The highest end port (based on the range you set) cannot exceed 65535.

    For more information on this, check out KB 929851.

    0 讨论(0)
提交回复
热议问题