After upgrade Spring Boot version from 2.6.6 to 2.6.7, I'm getting below error while executing web client rest calls. Any idea?
Sample code
public void execute(BiConsumer<ResponseEntity<JsonNode>, Throwable> responseConsumer) {
WebClient.RequestBodyUriSpec uriSpec = getUriSpec();
Mono<ResponseEntity<JsonNode>> responseEntityMono = uriSpec
.uri(this::buildUri)//"localhost:1234")//
.headers(this::setHeaders)
.body(insertBody())
.retrieve().onRawStatus(i -> i == 599,
response -> response.bodyToMono(String.class)
.map(body -> new ExternalException(599, body)))
.toEntity(JsonNode.class);
CompletableFuture<ResponseEntity<JsonNode>> completableFuture = responseEntityMono.toFuture();
completableFuture.whenCompleteAsync(responseConsumer);
}
Upgrade pom.xml
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>3.5.3</version>
</dependency>
The method that can't be found is in the class MonoSink (in reactor-core project): https://github.com/reactor/reactor-core/blob/main/reactor-core/src/main/java/reactor/core/publisher/MonoSink.java
Since this was an exception you got after upgrading from spring boot version 2.6.6, I guess that the class that can't find it is HttpClientConnect (in project reactor-netty-http). It would be good to have the whole stack exception though.
@jiangjianbo is not wrong saying that you need to update reactor-core to solve this but not to version 3.4.3. It should be at least the version 3.4.17 (That said I would take latest one, which at the time of writing this is 3.4.19). As you can see in version 3.4.16 contextView() was not yet created: https://github.com/reactor/reactor-core/blob/v3.4.16/reactor-core/src/main/java/reactor/core/publisher/MonoSink.java
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With