Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot resolve symbol for both RetryExceptionWrapper.class #171

Open
ENate opened this issue May 22, 2023 · 9 comments
Open

Cannot resolve symbol for both RetryExceptionWrapper.class #171

ENate opened this issue May 22, 2023 · 9 comments

Comments

@ENate
Copy link

ENate commented May 22, 2023

Describe the bug
Please provide details of the problem, including the version of Spring Cloud that you
are using.

Resilience4j version: spring cloud circuit breaker version: 3.0.1

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

org.springframework.integration.handler.advice.RequestHandlerCircuitBreakerAdvice 

dependency.
Code snippet is shown:

public Mono<MyModel> getSomeModelIdEtc(int id) {
        // DONE Auto-generated method stub
        return Mono.zip(
                        .......
                        someClass
                                .getSomeModelId(id)
                        .onErrorMap(RetryExceptionWrapper.class, Throwable::getCause)
                        .onErrorReturn(CircuitBreakerOpenException.class, getFallbackValue(id)),
    }
@ryanjbaxter
Copy link
Contributor

This just happens when changing the JDK version? Could you provide a sample that reproduces the problem?

@ENate
Copy link
Author

ENate commented May 22, 2023

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.circuitbreakerand related plugins. Yes this happens with migrating the code to spring boot 3.0.7, spring cloud 2022.0.2 and JDK 17.

@ryanjbaxter
Copy link
Contributor

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.

@ENate
Copy link
Author

ENate commented May 23, 2023

I will try to prepare a minimal example then.

@spring-cloud-issues
Copy link

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.

@ENate
Copy link
Author

ENate commented Jun 5, 2023

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.

@ryanjbaxter
Copy link
Contributor

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.

@spring-cloud-issues
Copy link

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.

@spring-cloud-issues
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants