Java XML-RPC java.net.BindException: Address already in use


If you are trying to run your XML-RPC-based web server and you get the following error,

XML-RPC Server Started!
JavaXmlRpcServer: java.net.BindException: Address already in use error.

This means that you have already some service running on this port that you have used to deploy your web service, to resolve this issue either you have to stop the service that's running (for example apache or IIS server running on port 80 or tomcat server if you have specified port as 8080).

BindException states that you are attempting to bind a socket to a port and the port is in use, or the requested local address could not be assigned.

How to kill the service on Unix/Linux-based environment:

  1. Open Terminal
  2. Run the command with the port used: example: lsof -i :1081
  3. You will get an output with ProcessID - PID if some process is running on it.
  4. COMMAND PID  USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
    java    4723 code2care   22u  IPv6 0x30asf0sdsdf      0t0  TCP *:pvusdfien (LISTEN)
  5. Now kill the process by running the following command: kill -9 <PID> (example: kill -9 4723)
  6. Now try to run the server you would not get BindException exception
|ADsADsAdss|

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap