Issue
We recently upgraded tomcat from version 7 to tomcat 9.x on Centos. When we start tomcat we are seeing the following error - org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to initialize component [Connector[HTTP/1.1-8080]] Caused by: java.net.BindException: Address already in use
Server.xml changes: Connector port="8060" protocol="org.apache.coyote.http11.Http11Protocol" redirectPort="8080" proxyName="myproxy" proxyPort="443" scheme="https" /> Even though catalina.out displays this error, our application runs fine. We verified there is no other service running on port 8080 and when we switch back to tomcat 7 there is no error displayed in logs. We do have nginx as a reverse proxy in front of tomcat but it listens on port 80 and 443 and talks to tomcat9 on port 8060 (http://127.0.0.1:8060). We have now spent full 2 days to resolve this issue and any help will be greatly appreciated.
Sorry for being ignorant, what is the purpose of redirectPort in Connector? In the above case does it mean that nginx will talk to tomcat on port 8060 and tomcat will internally redirect the request to port 8080?
Thanks in advance.
Solution
Figured the issue, Jboss was running on the same VM at the same port which was causing "Address already in use" error.
lsof -n -i :80 | grep LISTEN -> command to find the pid running on port 8080
ps -ef | grep pid ->to see what is running on the specified pid.
Answered By - NJavalearner