org.springframework.context.ApplicationContextException: Unable to start web server
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:164) ~[actuator-webmvc:3.0.0-SNAPSHOT]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:578) ~[actuator-webmvc:6.0.0-SNAPSHOT]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[actuator-webmvc:3.0.0-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[actuator-webmvc:3.0.0-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432) ~[actuator-webmvc:3.0.0-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[actuator-webmvc:3.0.0-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) ~[actuator-webmvc:3.0.0-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291) ~[actuator-webmvc:3.0.0-SNAPSHOT]
    at com.example.actuator.webmvc.ActuatorWebMvcApplication.main(ActuatorWebMvcApplication.java:10) ~[actuator-webmvc:na]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142) ~[na:na]
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104) ~[na:na]
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:486) ~[actuator-webmvc:3.0.0-SNAPSHOT]
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:210) ~[actuator-webmvc:3.0.0-SNAPSHOT]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:183) ~[actuator-webmvc:3.0.0-SNAPSHOT]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:161) ~[actuator-webmvc:3.0.0-SNAPSHOT]
    ... 8 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:1059) ~[actuator-webmvc:10.1.1]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) ~[actuator-webmvc:10.1.1]
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:556) ~[na:na]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) ~[actuator-webmvc:10.1.1]
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:1015) ~[na:na]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) ~[actuator-webmvc:10.1.1]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173) ~[actuator-webmvc:10.1.1]
    at org.apache.catalina.startup.Tomcat.start(Tomcat.java:485) ~[na:na]
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123) ~[na:na]
    ... 13 common frames omitted
Caused by: java.lang.IllegalArgumentException: port out of range:-1
    at java.base@17.0.5/java.net.InetSocketAddress.checkPort(InetSocketAddress.java:152) ~[actuator-webmvc:na]
    at java.base@17.0.5/java.net.InetSocketAddress.<init>(InetSocketAddress.java:197) ~[actuator-webmvc:na]
    at org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:245) ~[actuator-webmvc:10.1.1]
    at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:201) ~[actuator-webmvc:10.1.1]
    at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1172) ~[actuator-webmvc:10.1.1]
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1185) ~[actuator-webmvc:10.1.1]
    at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:577) ~[actuator-webmvc:10.1.1]
    at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:79) ~[actuator-webmvc:10.1.1]
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:1056) ~[actuator-webmvc:10.1.1]
    ... 21 common frames omitted

Comment From: philwebb

Checkout https://github.com/graalvm/native-build-tools and run ./gradlew :boot:actuator-webmvc:nativeAppTest to replicate.

Comment From: wilkinsona

Superseded by #33064.