JasonS
March 31, 2022, 2:35pm
1
Hi
I am writing a custom endpoint and I want to use the the AuthzClient
My jar is built in maven and I have
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-authz-client</artifactId>
<version>13.0.1</version>
<scope>provided</scope>
</dependency>
As a dependeny
I even added it to the shaded jar plugin as well as an includes
However at runtime I keep getting
14:31:23,018 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-2) Uncaught server error: java.lang.NoClassDefFoundError: org/keycloak/authorization/client/AuthzClient
Please can I get some help to resolve this as I am now stuck
1 Like
xgp
March 31, 2022, 9:48pm
2
Are you running the Quarkus (17) version or the legacy Wildfly version? With Wildfly, I had to add the authz client as a module, and then make my extension depend on that module.
JasonS
March 31, 2022, 10:09pm
3
How do you add it as a module?
Did you fix it? I have a similar issue when creating the AuthzClient object. The dependency you wrote (version 17.0.0, same as my Keycloak) in Maven as well as the JAR of it in the class path.
I run the Keycloak Quarkus version
Quarkus version cause me a similar problem with the same error displayed
I got it to work and I added the following into my pom.xml file
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-authz-client</artifactId>
<version>18.0.0</version>
<scope>provided</scope>
</dependency>
I then also had
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${maven.shade.version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>org.keycloak.keycloak-services:*</include>
<include>org.keycloak.authorization.client:*</include>
<include>org.keycloak:*</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
It then worked for me
I tried this but I got the same error