FreeKB - Resolve "Address already in use" in Tomcat
Resolve "Address already in use" in Tomcat

Home > Search


"Address already in use" appears in catalina.out or catalina.log or when running the configtest.sh command or when attempting to start a JVM.

java.net.BindException: Address already in use

 

This error means there is another process on the server using the port that the Tomcat JVM is configured to use. The stack trace error may identify the port that cannot be bound (8080 in this example).

org.apache.catalina.core.StandardServer.await create[localhost:8080]

 

You should be able to verify that the JVM is configured to use the port that cannot be bound (8080 in this example).

nio.http.port=8080

 

Ensure that the JVM is using unique ports for each protocol. For example, if both HTTP and HTTPS are using the same port, this will produce "Address already in use".

nio.http.port=8080
nio.https.port=8080

 

Sometimes, grep may spot two JVMs using the same port.

grep -R /path/to/tomcat/profiles -ie 'nio.http.port=8080'

 

Or, the netstat command may also be able to identify the other process on the server that is using the port. In this example, PID 3749 is using port 8080.

netstat -ano -p | grep 8080

Proto  Recv-Q Send-Q Local address Foreign address State PID/Program name
 udp6       0      0     [::]:8080          [::]:*       3749/java

 

You would then use the ps command to determine what application is associated with the PID.

ps -ef | grep <PID>

 


Java

If Tomcat is the only service using the port on the server, there may be some issue with Java. Determine the PID being used by Java.

~]# ps -ef | grep Java
12345 . . .

 

Kill the Java process.

~]# kill -9 12345

 

Start the JVM.

 


Webapps

If the error persists, there may be some problem with one of the webapps. Debugging issues with a webapp typicall requires that you work with the application developer. There are far too many possible application issues to list here.



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 07b8a in the box below so that we can be sure you are a human.




Comments