spring-boot: Unable to start Netty (TimeoutException)

Issue: Netty is unable to start due to timeout in the latest ‘2.0.0.M3’. In ‘2.0.0.M2’ everything works fine.

2017-07-29 16:19:35.028  INFO 1698 --- [           main] o.s.w.r.r.m.a.ControllerMethodResolver   : Looking for @ControllerAdvice: org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext@1d76aeea: startup date [Sat Jul 29 16:19:30 IST 2017]; root of context hierarchy
2017-07-29 16:19:36.221  INFO 1698 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2017-07-29 16:19:41.577  INFO 1698 --- [           main] utoConfigurationReportLoggingInitializer : 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-07-29 16:19:41.595 ERROR 1698 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.boot.web.server.WebServerException: Unable to start Netty
        at org.springframework.boot.web.embedded.netty.NettyWebServer.start(NettyWebServer.java:74) ~[spring-boot-2.0.0.M3.jar:2.0.0.M3]
        at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.startReactiveWebServer(ReactiveWebServerApplicationContext.java:139) ~[spring-boot-2.0.0.M3.jar:2.0.0.M3]
        at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.finishRefresh(ReactiveWebServerApplicationContext.java:72) ~[spring-boot-2.0.0.M3.jar:2.0.0.M3]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) ~[spring-context-5.0.0.RC3.jar:5.0.0.RC3]
        at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:49) ~[spring-boot-2.0.0.M3.jar:2.0.0.M3]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.0.0.M3.jar:2.0.0.M3]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) [spring-boot-2.0.0.M3.jar:2.0.0.M3]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.M3.jar:2.0.0.M3]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1245) [spring-boot-2.0.0.M3.jar:2.0.0.M3]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1233) [spring-boot-2.0.0.M3.jar:2.0.0.M3]
        at <mypackage>.<myclass>.main(MyApplication.kt:10) [main/:na]
Caused by: reactor.core.Exceptions$ReactiveException: java.util.concurrent.TimeoutException: HttpServer couldn't be started within 3000ms
        at reactor.core.Exceptions.propagate(Exceptions.java:240) ~[reactor-core-3.1.0.M3.jar:3.1.0.M3]
        at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:87) ~[reactor-core-3.1.0.M3.jar:3.1.0.M3]
        at reactor.core.publisher.Mono.block(Mono.java:1280) ~[reactor-core-3.1.0.M3.jar:3.1.0.M3]
        at reactor.ipc.netty.tcp.BlockingNettyContext.<init>(BlockingNettyContext.java:55) ~[reactor-netty-0.7.0.M1.jar:0.7.0.M1]
        at reactor.ipc.netty.tcp.BlockingNettyContext.<init>(BlockingNettyContext.java:45) ~[reactor-netty-0.7.0.M1.jar:0.7.0.M1]
        at reactor.ipc.netty.NettyConnector.start(NettyConnector.java:53) ~[reactor-netty-0.7.0.M1.jar:0.7.0.M1]
        at org.springframework.boot.web.embedded.netty.NettyWebServer.start(NettyWebServer.java:64) ~[spring-boot-2.0.0.M3.jar:2.0.0.M3]
        ... 10 common frames omitted
        Suppressed: java.lang.Exception: #block terminated with an error
                at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:88) ~[reactor-core-3.1.0.M3.jar:3.1.0.M3]
                ... 15 common frames omitted
Caused by: java.util.concurrent.TimeoutException: HttpServer couldn't be started within 3000ms
        at reactor.ipc.netty.tcp.BlockingNettyContext.<init>(BlockingNettyContext.java:53) ~[reactor-netty-0.7.0.M1.jar:0.7.0.M1]
        ... 13 common frames omitted

Environment Kotlin: 1.1.3-2 SpringBoot: 2.0.0.M3 Java: 1.8.0_112 (build 1.8.0_112-b16)

$ ./gradlew --version

------------------------------------------------------------
Gradle 3.5.1
------------------------------------------------------------

Build time:   2017-06-16 14:36:27 UTC
Revision:     d4c3bb4eac74bd0a3c70a0d213709e484193e251

Groovy:       2.4.10
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_112 (Oracle Corporation 25.112-b16)
OS:           Mac OS X 10.12.4 x86_64

Steps to reproduce Create a project from Spring Initializr using Spring Boot: 2.0.0 M3 with Reactive Web

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 27 (9 by maintainers)

Most upvoted comments

@hendisantika, just double check you have the hostname as third field in/etc/hosts file.

127.0.0.1   localhost    mac.local
::1              localhost     mac.local

I have faced this issue around M2. I had both the entries but the missing hostname field made InetAddress.getLocalHost() to take more than 3s.