apache / apache/grails-core

Grails 4.x reloading fails with LifecycleException when adding dependency on spring-cloud-starter-netflix-hystrix

Open
#11,431 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

### Task List

- [x] Steps to reproduce provided
- [x] Stacktrace (if present) provided
- [x] Example that reproduces the problem uploaded to Github
- [x] Full description of the issue provided (see below)

### Steps to Reproduce

1. Create a new grails app with rest-api profile
2. Add the following dependencies to build.gradle:

compile "org.springframework.cloud:spring-cloud-starter-netflix-hystrix:2.1.3.RELEASE"
compile "org.springframework.cloud:spring-cloud-starter-netflix-hystrix-dashboard:2.1.3.RELEASE"

2. start grails app using grails wrapper ./grailsw run-app
3. Do any modification in /grails-app/controllers/helloworld/spring/hystrix/ApplicationController.groovy

### Expected Behaviour

No exception occurs, auto reloading succeeds.

### Actual Behaviour

LifecycleException occurs:

> org.apache.catalina.LifecycleException: Protocol handler start failed
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1008)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:227)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:263)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:195)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:297)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
at grails.boot.GrailsApp.run(GrailsApp.groovy:97)
at grails.boot.GrailsApp.run(GrailsApp.groovy:458)
at grails.boot.GrailsApp.run(GrailsApp.groovy:445)
at helloworld.spring.hystrix.Application.main(Application.groovy:11)
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.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:230)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:213)
at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1124)
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1210)
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:585)
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1005)
... 20 common frames omitted

### Environment Information

- **Operating System**: Mac OS Catalina 10.15.0
- **Grails Version:** 4.0.1
- **JDK Version:** OpenJDK Runtime Environment Corretto-8.222.10.1 (build 1.8.0_222-b10)
- **Container Version (If Applicable):** -

### Example Application

https://github.com/jakobdoc/helloworld-spring-hystrix

Contributor guide

Open the contributing guide

Research direction

Start with the linked example application and its build.gradle, then run ./grailsw run-app and modify grails-app/controllers/helloworld/spring/hystrix/ApplicationController.groovy to reproduce the reload failure. Trace the LifecycleException and its Address already in use cause; done means reloading succeeds without the exception when the Hystrix dependencies are present.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, spring-boot
Domain
backend, developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.