Sunday, May 1, 2016

JMXServerManager could not create the RMI local registry java.rmi.server.ExportException: Port already in use: xxxxx; java.net.BindException:Address already in use


Have you ever faced a situation like this before ? Once you start an instance on a particular WSO2 product and it shows an error message

JMXServerManager could not create the RMI local registry java.rmi.server.ExportException: Port already in use: xxxxx; java.net.BindException:Address already in use

The reason for this is there's a server which is already running on your default port or the port with offet. Or may be a process is already running for the previous time you started the server.





Solution

Here I'm going to use the 'ps' command to check out the every process on the system matches with the keyword I'm defining ( wso2) using grep command

ps -ef|grep wso2

output in the console






Here you can see the process id's where the word 'wso2' has been used within the system. The number of process may be increased if you run multiple wso2 products on the same machine. So follow below command to destroy or kill the processes you want.

kill -9 4714 4741

(4714 and 4741 are the process id's of the currently running processes.)

It's not necessary to destroy the process with grep command ( the below stated process with 4838 id ) since it's the one we initiate to search the processes.

That's it. Not you can up the server. If you got the same error message again, make sure to adjust a port offset in carbon.xml or just follow this procedure.