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:
- Open Terminal
- Run the command with the port used: example: lsof -i :1081
- You will get an output with ProcessID - PID if some process is running on it.
- Now kill the process by running the following command: kill -9 <PID> (example: kill -9 4723)
- Now try to run the server you would not get BindException exception
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 4723 code2care 22u IPv6 0x30asf0sdsdf 0t0 TCP *:pvusdfien (LISTEN)
Facing issues? Have Questions? Post them here! I am happy to answer!
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
- Get the current timestamp in Java
- Java Stream with Multiple Filters Example
- Java SE JDBC with Prepared Statement Parameterized Select Example
- Fix: UnsupportedClassVersionError: Unsupported major.minor version 63.0
- [Fix] Java Exception with Lambda - Cannot invoke because object is null
- 7 deadly java.lang.OutOfMemoryError in Java Programming
- How to Calculate the SHA Hash Value of a File in Java
- Java JDBC Connection with Database using SSL (https) URL
- How to Add/Subtract Days to the Current Date in Java
- Create Nested Directories using Java Code
- Spring Boot: JDBCTemplate BatchUpdate Update Query Example
- What is CA FE BA BE 00 00 00 3D in Java Class Bytecode
- Save Java Object as JSON file using Jackson Library
- Adding Custom ASCII Text Banner in Spring Boot Application
- [Fix] Java: Type argument cannot be of primitive type generics
- List of New Features in Java 11 (JEPs)
- Java: How to Add two Maps with example
- Java JDBC Transition Management using PreparedStatement Examples
- Understanding and Handling NullPointerException in Java: Tips and Tricks for Effective Debugging
- Steps of working with Stored Procedures using JDBCTemplate Spring Boot
- Java 8 java.util.Function and BiFunction Examples
- The Motivation Behind Generics in Java Programming
- Get Current Local Date and Time using Java 8 DateTime API
- Java: Convert Char to ASCII
- Deep Dive: Why avoid java.util.Date and Calendar Classes
- Ways to Open New Tabs or New Windows on Windows 11 Notepad - Windows-11
- Install node on Alpine Linux Docker - Docker
- Eclipse : A java Runtime Environment (JRE) or Java Development kit (JDK) must be available - Java
- How to Show the Status Bar on Windows 11 New Notepad - Windows-11
- How to turn on Bluetooth on Windows 10 - Microsoft
- What version of windows do I have? - Microsoft
- How to remove JetBrains Toolbox from Mac Startup - HowTos
- Linux: Create a New User and Password and Login Example - Linux