How to fix SEVERE Failed to initialize component Connector
Introduction
In this tutorial, we will learn how to fix SEVERE Failed to initialize component Connector HTTP/1.1-8080 error during the Apache Tomcat server. This error indicates that the server failed to start on the port 8080.
Error
SEVERE [main] org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to initialize component [Connector[HTTP/1.1-8080]]
org.apache.catalina.LifecycleException: Protocol handler initialization failed.
Port Conflict
This error happens when there is a port conflict. Here, in this case, some application is listening on the port 8080. Jenkins CI server runs and listens on port 8080 on my machine.
BindException
Caused by: java.net.BindException: Address already in use: bind at java.base/sun.nio.ch.Net.bind0(Native Method) at java.base/sun.nio.ch.Net.bind(Net.java:455) at java.base/sun.nio.ch.Net.bind(Net.java:447) at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:219) at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:80) at org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:228) at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:211) at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1141) at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1154) at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:581) at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:74) at org.apache.catalina.connector.Connector.initInternal(Connector.java:1039)
https://www.testingdocs.com/questions/how-to-find-listening-ports-on-windows/
Fix
First things first, we need to decide on which application to move off from the conflict port number. Since, Tomcat is useful application and that we want to move the secondary application from the standard port number i.e 8080. It depends on what the secondary application that’s causing the port conflict. In this case its the Jenkins server. This may vary on your computer.
#1 Option
Change the port of the Jenkins server that runs on the port 8080. This will resolve the port conflict on port 8080. Instructions to change the port for the Jenkins application.
https://www.testingdocs.com/questions/how-to-change-jenkins-port-number-on-windows/
#2 Option
This option is when we decide to move the Tomcat server from listening on port 8080.
We can fix the error by changing the port of the Apache Tomcat server.
The connector port is specified in the server.xml file under
<tomcat dir>\conf directory.
Change the connector port to let’s say 9090 port number.
<Connector port="9090" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="9443" />
Save the changes to the file.
Restart Apache Tomcat Server.