dasniko / testcontainers-keycloak

A Testcontainer implementation for Keycloak IAM & SSO.
Apache License 2.0
328 stars 51 forks source link

Not able to reach newly added endpoint after deploy withExtensionClassesFrom #36

Closed VolodymyrMordas closed 3 years ago

VolodymyrMordas commented 3 years ago

ive created extension that extends rest-api of keycloak. but after deploy classes like .withExtensionClassesFrom("target/classes") Im not able to reach endpoints developed in that ext

is this correct that providers are not register well withing withExtensionClassesFrom? what's I potentially can do to fix this?

VolodymyrMordas commented 3 years ago

ok then

ive got an error during deployment

22:32:12,623 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990 22:32:15,145 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-13) Uncaught server error: java.lang.NoClassDefFoundError: org/keycloak/services/managers/AppAuthManager$BearerTokenAuthenticator at deployment.-495401560-extensions.jar//xxx.x.rest.UsersResource.<init>(UsersResource.java:22) at deployment.-495401560-extensions.jar//xxx.x.rest.UsersResourceProvider.getResource(UsersResourceProvider.java:15) at org.keycloak.keycloak-services@12.0.4//org.keycloak.services.resources.RealmsResource.resolveRealmExtension(RealmsResource.java:285) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566)

dasniko commented 3 years ago

Hi, thanks for reporting. Your issue seems to not related to this project, as testing custom resource endpoints works pretty fine. I just added some test code for this scenario with this commit and both endpoints, public and secured, give the proper responses.

As I only see your posted log and nothing else, I suppose you forgot to specify some dependencies properly, thus the "NoClassDefFoundError".

VolodymyrMordas commented 3 years ago

thx @dasniko for your answer and example