Super Java Host
  1. Home
  2. Guides
  3. Fix address already in use

How to fix "Address already in use" on port 8080

Only one program can listen on a port. The error means another process already has it, often an older copy of your own application.

The error

You will see one of these:

java.net.BindException: Address already in use
Web server failed to start. Port 8080 was already in use.
Caused by: java.net.BindException: Address already in use (Bind failed)

1. Find the process

sudo ss -ltnp | grep ':8080'
# or
sudo lsof -i :8080

The output shows the process id and name, for example users:(("java",pid=1234,fd=45)). Look at what it is:

ps -fp 1234
systemctl status 1234 --no-pager   # shows the service if it is one

2. Decide what to do

  • It is an old copy of your own app. Stop it properly with sudo systemctl stop myapp. If it was started by hand and you do not need it, kill 1234 and wait a few seconds. Use kill -9 only if it ignores a normal kill.
  • It is Tomcat, and you also start Spring Boot on 8080. Two Java servers cannot share a port. Give each its own.
  • It is a service started by systemd that restarts itself. Killing the process does nothing, because systemd starts it again. Stop and disable the unit instead.

3. Move your application to another port

Spring Boot:

java -jar app.jar --server.port=8081
# or in application.properties
server.port=8081
# or in the systemd unit
Environment=SERVER_PORT=8081

Tomcat: change port="8080" in the HTTP Connector of server.xml. Tomcat also uses port 8005 for its shutdown command and 8009 for AJP on some versions, so a second Tomcat instance needs different values for those as well.

4. The port stays busy after a stop

A closed connection waits in the TIME_WAIT state for a short time. Java servers normally set the socket option that avoids this. If you still see the error right after a restart, wait half a minute or check that the old process is really gone with pgrep -af java.

5. Run several apps on one server

Give every application its own port (8081, 8082, 8083) and let Nginx route by domain name. Bind each one to 127.0.0.1 so that only the proxy can reach them.

Questions about fix address already in use

How do I see all ports that are in use?

Run sudo ss -ltnp. It lists every listening TCP port with its process.

Last updated October 29, 2026.

Your own Java server, billed monthly

Plans from €15.30 a month. Set up for you, or run for you.