问题
I'm writing a suite of microservices using Quarkus. These services will be protected using Quarkus' Keycloak extension. That interaction works great and without problem. Now I'm trying to add functionality to my microservices that will essentially broker communication with Keycloak and allow me to create users/groups/roles programmatically using the Keycloak admin client. I've added the Keycloak admin client dependency to my pom.xml
:
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-admin-client</artifactId>
<version>${version.keycloak}</version>
</dependency>
My code also compiles with no problem. However, when I run it and attempt to, for example, get a list of users within my Keycloak realm, I get the following exception:
java.lang.IncompatibleClassChangeError: Found interface org.jboss.resteasy.client.jaxrs.ResteasyClient, but class was expected
I've implemented functionality like this before in other projects, but never one that uses Quarkus as its underlying implementation framework. So, my guess is it has something to do with that. But I've never seen an error like this. Can anyone give me some insight into how to get around this issue?
回答1:
java.lang.IncompatibleClassChangeError
is thrown because org.jboss.resteasy.client.jaxrs.ResteasyClient
has been changed from class to interface since Resteasy version 4.0.
- ResteasyClient.java in version 3.9
- ResteasyClient.java in version 4.0
So, you should use Resteasy version 3.x.
来源:https://stackoverflow.com/questions/58065789/keycloak-admin-client-within-quarkus-java-lang-incompatibleclasschangeerror