Open ENate opened 1 year ago
This just happens when changing the JDK version? Could you provide a sample that reproduces the problem?
Do I create an example? Because the issue was encountered while working on a huge project. Seems to be disappear when I used io.github.resilience4j.circuitbreaker
and related plugins. Yes this happens with migrating the code to spring boot 3.0.7, spring cloud 2022.0.2 and JDK 17.
We are running out builds with JDK 17 and don't see that problem, so a project to reproduce the problem will help figure out what is going on.
I will try to prepare a minimal example then.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
I included a method from the following :
https://github.com/ENate/kafka-mstreams/blob/main/composite-service/src/main/java/com/minejava/kafkastreams/compositeservice/servicescom/UserServicesCompI.java (methodA named userByUserId in the code)
to demonstrate how I used the spring-boot-start-circuitbreakerresilient4j dependency:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-circuitbreaker-resilience4j</artifactId>
</dependency>
to implement a circuitbreakerresilience4j call in the following manner:
// implement getUserId for methodA
public Mono<UserserviceAg> getByUserId(String userId) {
return Mono.zip(
values -> createUserAg(
(UserPayload) values[0],
(List<SubjectUtilAg>) values[1],
serviceUtil.getHostAddress()),
compositeService
.getUserById(userId)
// Legacy code uses the following
// .onErrorMap(RetryExceptionWrapper.class, Throwable::getCause)
// <<<<< Decided to change to RetryException class >>>>>>>>
.onErrorMap(RetryException.class, Throwable::getCause)
.onErrorReturn(CircuitBreakerOpenException.class, getUserFallbackValue(userId))
.doOnError(ex -> log.warn("getUser failed: {}", ex.toString()))
.log());
}
with a call to the method:
// Get user with given userId - methodB
@CircuitBreaker(name = "users")
@TimeLimiter(name = "users")
@Retry(name = "users")
public Mono<UserPayload> getUserById(String userId) {
LOG.info("Getting desired used using the Id: {}", userId);
return webClient
.get()
.uri(userIdString+userId)
.retrieve()
.bodyToMono(UserPayload.class)
.onErrorMap(WebClientResponseException.class, this::handleException);
}
with methodB' s link is:
https://github.com/ENate/kafka-mstreams/blob/main/composite-service/src/main/java/com/minejava/kafkastreams/compositeservice/service/CompositeService.java (methodB named getUserById in the code)
will result in the following exception/error:
Cannot resolve symbol for both RetryExceptionWrapper.class and CircuitBreakerOpenException
The code seems to run for now (But I need to verify the via testing) if replacing the line
.onErrorMap(RetryExceptionWrapper.class, Throwable::getCause)
with
.onErrorMap(RetryException.class, Throwable::getCause)
Using the following dependencies seem to work
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-spring-boot3</artifactId>
<version>${resilience4j.version}</version>
</dependency>
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-reactor</artifactId>
<version>${resilience4j.version}</version>
</dependency>
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-circuitbreaker</artifactId>
<version>${resilience4j.version}</version>
</dependency>
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-retry</artifactId>
<version>${resilience4j.version}</version>
</dependency>
but I want to stay with the spring boot stack. Thanks.
Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
Describe the bug Please provide details of the problem, including the version of Spring Cloud that you are using.
Java version: 17+ I tried updating some legacy code to JDK 17 and spring boot 3.0.7. But I noticed that the following error is thrown: Cannot resolve symbol for both RetryExceptionWrapper.class and CircuitBreakerOpenException . But CircuitBreakerOpenExceptionseems to be available via the
dependency. Code snippet is shown: