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
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.