The custom provider uses code with the resteasy-client like this in keycloak 21:
UriBuilder url = UriBuilder.fromPath(baseURL);
ResteasyClient client = (ResteasyClient) ClientBuilder.newClient();
ResteasyWebTarget target = client.target(url);
this.proxy = target.proxy(MyClientInterface.class);
This fails in Keycloak 25 because the resteasy libraries do no longer exist. I've tried to add the dependency org.jboss.resteasy:resteasy-client:6.2.9.Final
but it fails with an error like this:
2024-08-05 11:05:03,822 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-5) Uncaught server error: java.lang.ClassCastException: class org.jboss.resteasy.reactive.server.jaxrs.ContainerRequestContextImpl cannot be cast to class org.jboss.resteasy.core.interception.jaxrs.PostMatchContainerRequestContext (org.jboss.resteasy.reactive.server.jaxrs.ContainerRequestContextImpl and org.jboss.resteasy.core.interception.jaxrs.PostMatchContainerRequestContext are in unnamed module of loader io.quarkus.bootstrap.runner.RunnerClassLoader @51cdd8a)
at org.jboss.resteasy.plugins.providers.sse.SseEventSinkInterceptor.filter(SseEventSinkInterceptor.java:24)
at org.jboss.resteasy.reactive.server.handlers.ResourceRequestFilterHandler.handle(ResourceRequestFilterHandler.java:48)
at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:131)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:582)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:1583)
The keycloak upgrade guide just mentions "Migration will be needed" at https://www.keycloak.org/docs/latest/upgrading/index.html#resteeasy-reactive without providing any details what to do to accomplish this.
How do I migrate my code to Keycloak 25? What code changes are needed? Which dependencies do I have to add to Keycloak?
java.net.http.HttpClient
as a workaround. – Boomerang