Unable to start the registry service and getting an error as Failed to bind to server socket: tcp://0.0.0.0:2010/Registry due to: java.net.BindException: Address already in use

Document ID : KB000009027
Last Modified Date : 14/02/2018
Show Technical Document Details
Issue:

I am trying to restart my registry service which was running before. When I restart the service, registry is going down immediately and noticed below error in registry.log

2017-12-18 06:21:11,338Z (06:21) [main] ERROR com.itko.lisa.net.ActiveMQFactory - Bad start
java.io.IOException: Failed to bind to server socket: tcp://0.0.0.0:2010/Registry due to: java.net.BindException: Address already in use
	at com.itko.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:33)
	at com.itko.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:139)
	at com.itko.activemq.transport.tcp.TcpTransportFactory.doBind(TcpTransportFactory.java:60)
	at com.itko.activemq.transport.TransportFactory.bind(TransportFactory.java:131)
	at com.itko.activemq.broker.BrokerService.createTransportConnector(BrokerService.java:1941)
	at com.itko.activemq.broker.BrokerService.addConnector(BrokerService.java:253)
	at com.itko.lisa.net.ActiveMQFactory.startBroker(ActiveMQFactory.java:438)
	at com.itko.lisa.net.ActiveMQFactory.getBrokerServerQueueConnection(ActiveMQFactory.java:595)
	at com.itko.lisa.net.ServerRequestHandler.startRemoteServer(ServerRequestHandler.java:272)
	at com.itko.lisa.net.ServerRequestHandler.startRemoteServer(ServerRequestHandler.java:261)
	at com.itko.lisa.net.ServerRequestHandler.registerTarget(ServerRequestHandler.java:108)
	at com.itko.lisa.coordinator.LisaServerObjectImpl.register(LisaServerObjectImpl.java:105)
	at com.itko.lisa.coordinator.TestRegistryImpl.<init>(TestRegistryImpl.java:294)
	at com.itko.lisa.coordinator.TestRegistryImpl.main(TestRegistryImpl.java:2152)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
	at com.install4j.runtime.launcher.UnixLauncher.main(Unknown Source)
Caused by: java.net.BindException: Address already in use
	at java.net.PlainSocketImpl.socketBind(Native Method)
	at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
	at java.net.ServerSocket.bind(ServerSocket.java:375)
	at java.net.ServerSocket.<init>(ServerSocket.java:237)
	at javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:231)
	at com.itko.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:135)
	... 18 more
Cause:

This can happen, if same port is used by other services

   Ex. port number for Registry is 2010, if the same port is used by other component, you will see this error.

OR  previous service instance (Registry, coordinator, simulator, etc) has not stopped properly.

Resolution:

On Windows:

Check the running process from Taskmanager and if the process is still in running state, End the process and make sure it disappear from Taskmanager. Once the process has stopped completely, restart the Devtest service.

 

On Linux:

Check the running process using command "ps -ef | grep Registry" (without quotes). If you see the process details, kill the process using "kill -9 <processid>". Once the process has stopped completely, restart the Devtest service.