Hello, what would be the best way to find out if any of Tomcat connectors have 
failed to initialize at startup?
They could fail for many reasons, like when the port is already in use, or 
keystore is missing etc.
Now Tomcat prints the error in log, but I would like to find out 
programmatically if any of the connectors have failed.
Or alternatively, fail the Tomcat and shutdown it if any connectors fail.

I see that Connector has getState():

https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/util/LifecycleBase.html#getState()

public LifecycleState getState()
Obtain the current state of the source component.
Specified by:
getState in interface Lifecycle
Returns:
The current state of the source component.

DESTROYED
DESTROYING
FAILED
INITIALIZED
INITIALIZING
NEW
STARTED
STARTING
STARTING_PREP
STOPPED
STOPPING
STOPPING_PREP

If the state is any of (DESTROYED, DESTROYING, FAILED) then I think that it has 
failed.
Then question is, how to get the connectors? Is there some static method to get 
Tomcat server instance and then connectors?

I am starting Tomcat using static Bootstrap method main:
https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/startup/Bootstrap.html#main(java.lang.String[])

I wonder how to get the started Tomcat instance?

-Harri

Reply via email to