tim.a
tim.a

Reputation: 83

Tomcat: Failed to start connector [Connector[HTTP/1.1-auto-1]]

Hello I am trying to deploy my app on a remote tomcat server (8.5.30). In order for my app to run I need to add these lines on /conf/server.xml

<Connector SSLEnabled="true" 
                clientAuth="false" keystoreFile="blc-example.keystore" keystorePass="xx" 
                keyPass="xx" maxThreads="150"
                scheme="https" secure="true" sslProtocol="TLS" />

This works perfectly fine on my local machine. However on the remote server for some reason I am getting this error on the startup

02-Jan-2019 16:19:37.783 SEVERE [main] org.apache.catalina.core.StandardService.startInternal Failed to start connector [Connector[HTTP/1.1-auto-1]]
 org.apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-auto-1]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:440)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:681)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:353)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493)
Caused by: org.apache.catalina.LifecycleException: The connector cannot start since the specified port value of [-1] is invalid
    at org.apache.catalina.connector.Connector.startInternal(Connector.java:1011)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 11 more

I am pretty sure that tomcat can see the keystoreFile because otherwise I am getting a file not found error.

All the settings are the same with my local machine so it is highly confusing to me why this is happening. Any tips?

Upvotes: 1

Views: 12777

Answers (2)

Elyor Murodov
Elyor Murodov

Reputation: 1028

That's because of the missing port in your connector configuration.

When you don't set a port in Connector, tomcat will choose a random port from available free ports in the system.

As in your case, there might be a restriction (due to security reasons) on your remote server for the tomcat to use a random available port, that's why it's automatically defaulting to -1, which is an invalid port. And it's working locally because there are no restrictions regarding random ports on your local machine.

So, in your config, you should explicitly set the port permitted by your server platform.

Upvotes: 1

Mike K.
Mike K.

Reputation: 3789

Set a port on your connector, it does say in the error it is defaulting to an invalid port with none present:

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" 
           clientAuth="false" keystoreFile="blc-example.keystore" keystorePass="xx" 
           keyPass="xx" maxThreads="150"
           scheme="https" secure="true" sslProtocol="TLS" />

Upvotes: 1

Related Questions