tliub666
tliub666

Reputation: 31

Method threw 'java.lang.IllegalStateException' exception. Cannot evaluate jdk.proxy2.$Proxy134.toString()

Dependencies: spring boot 3.0.4 spring-weblux 6.0.6

I have created the HttpExchange Client:

@HttpExchange("${path.to.baseUrl}")
public interface ExternalClient {

   @PostExchange("${path.to.endpoint}")
   Mono<Object> post(@RequestBody Object object);

}

@Bean
public ExternalClient externalClient(HttpServiceProxyFactory httpServiceProxyFactory) {
    return httpServiceProxyFactory.createClient(ExternalClient.class);
}

@Bean
public HttpServiceProxyFactory httpServiceProxyFactory(WebClient webClient) {
    return HttpServiceProxyFactory.builder(WebClientAdapter.forClient(webClient))
            .embeddedValueResolver(configurableBeanFactory::resolveEmbeddedValue)
            .build();
}

The created externalClient bean works fine, but in debug mode it returns: Method threw 'java.lang.IllegalStateException' exception. Cannot evaluate jdk.proxy2.$Proxy134.toString()

Upvotes: 3

Views: 1880

Answers (1)

Ji Yeon Park
Ji Yeon Park

Reputation: 1

It's an option of editing tool like IntelliJ IDEA. After unchecking 'Enable toString() object view in Settings > Debugger > Java, the exception is going to disappear under debugging mode. When the proxy class like ExternalClient.class injects, 'ExternalClient.class' has no toString(). That's why the debugger shows IllegalStateException.

Upvotes: 0

Related Questions