-
Notifications
You must be signed in to change notification settings - Fork 324
Closed
Description
When CF Java Client is used in an application that also uses WebClient from Spring WebFlux 2.1.x.RELEASE, exceptions are thrown from Netty and connections to CF fail.
The relevant exception is:
Caused by: java.lang.IllegalArgumentException: 'httpRedirects' is already in use
at io.netty.util.ConstantPool.createOrThrow(ConstantPool.java:113) ~[netty-common-4.1.31.Final.jar:4.1.31.Final]
at io.netty.util.ConstantPool.newInstance(ConstantPool.java:95) ~[netty-common-4.1.31.Final.jar:4.1.31.Final]
at io.netty.util.AttributeKey.newInstance(AttributeKey.java:55) ~[netty-common-4.1.31.Final.jar:4.1.31.Final]
at reactor.netty.http.client.HttpClientOperations.<clinit>(HttpClientOperations.java:720) ~[reactor-netty-0.8.3.RELEASE.jar:0.8.3.RELEASE]
The root of the issue is clashing versions of reactor-netty.
- CFJC
3.xdepends onio.projectreactor.ipc:reactor-netty:0.7.x.RELEASE(viaspring-boot-dependencies:2.0.x). - Spring WebFlux
2.1.xdepends onio.projectreactor.netty.reactor-netty:0.8.x.RELEASE.
These versions of reactor-netty both have a class with a static initializer that registers a "constant" with Netty:
reactor-netty:0.7.x.RELEASE: reactor.ipc.netty.http.client.HttpClientOperationsreactor-netty:0.8.x.RELEASE: reactor.netty.http.client.HttpClientOperations
Whichever of these initializers runs first wins, and the second one fails. When the HttpClientOperations used by CFJC fails to initialize, the exception above appears in stdout but the app will start. Subsequent calls to CFJC result in long delays followed by a timeout.
pdelagrave