Resolve "Address already in use" in Tomcat

Home > Search
  by

"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.

~]# cat catalina.out
. . .
Caused by: java.net.BindException: Address already in use

 

This error means there is another process on the server using the port that the Tomcat JVM will be using. The HTTP and HTTPS port that are being used by the Tomcat JVM are defined in the catalina.properties file. The catalina.properties file is located in the tomcat_home/profiles/jvm_name/conf/ directory. In this example, ports 8080 and 8443 are being used by the JVM.

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

 

If you have two or more Tomcat JVMs on the same server, one of the other Tomcat JVMs may be using the same port as the new Tomcat JVM. The grep command can be used to view the ports being used by each Tomcat JVM. In this example, every JVM configured to use port 8080 will be found.

~]# grep -R /path/to/tomcat/profiles -ie 'nio.http.port=8080'
~]# grep -R /path/to/tomcat/profiles -ie 'nio.https.port=8443'

 

Or, the netstat command may also be able to identify the other process on the server that is using the port.

~]# netstat | grep 8080

 


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 using the -15 signal. 

~]# kill -15 12345

 

Start Tomcat or TC Server.

~]# $catalina_home/bin/startup.sh

 


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 in the box below so that we can be sure you are a human.




Comments