Search code examples
keycloakkeycloak-services

keycloak RealmResourceProvider spi gives 404


I am creating a spi to do my otp config

When I deploy it as a jar and call the url auth/realms/{{myream}}/OTPConfig/otp/{{myusername}}

I get

Caused by: java.lang.ClassNotFoundException: org.keycloak.utils.TotpUtils from [Module "deployment.otp-config-spi-1.0-SNAPSHOT.jar" from Service Module Loader]

I then package and deploy as a war which includes the required dependencies and it deploys successfully but the same url fails with 404

My id is public static final String ID = "OTPConfig";

I have also seen the following error

WFLYCTL0186:   Services which failed to start:      service jboss.deployment.unit."keycloak-services-13.0.1.jar".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "keycloak-services-13.0.1.jar"

I need this jar as I am using import org.keycloak.utils.TotpUtils;

It might be that the "error": "HTTP 404 Not Found" is not the actual issue?

Thanks


Solution

  • Go with the JAR instead of WAR and add a dependency to your JAR's META-INF/MANIFEST.MF file like this:

    Manifest-Version: 1.0
    Dependencies: org.keycloak.keycloak-services
    Sealed: true