opensingular/singular-keycloak-database-federation

User Fetching Error on Keycloak Latest Version

Opened this issue · 4 comments

Singular keycloak database federation is not working on keycloak docker image quay.io/keycloak/keycloak:22.0

We cannot fetch the users from mysql ! We can confirm that we can connect to it . But whenever we pull, it is saying that sync in progress.

I will reproduce the issue again and let me show u with logs and screenshots.

Can confirm that it does not work with the latest version of Keycloak - 22.0.1. I get the below error when trying to query a user from a successfully mapped SQL DB:

ERROR [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-25) Uncaught server error: java.lang.AbstractMethodError: Receiver class org.opensingular.dbuserprovider.DBUserStorageProvider does not define or inherit an implementation of the resolved method 'abstract org.keycloak.models.UserModel getUserByUsername(org.keycloak.models.RealmModel, java.lang.String)' of interface org.keycloak.storage.user.UserLookupProvider.
at org.keycloak.storage.UserStorageManager.lambda$getUserByUsername$20(UserStorageManager.java:369)
at org.keycloak.utils.ServicesUtils.lambda$timeBoundOne$1(ServicesUtils.java:83)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:400)
at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258)
at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:528)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647)
at org.keycloak.storage.UserStorageManager.getUserByUsername(UserStorageManager.java:369)
at org.keycloak.models.cache.infinispan.UserCacheSession.getUserByUsername(UserCacheSession.java:269)
at org.keycloak.models.utils.KeycloakModelUtils.findUserByNameOrEmail(KeycloakModelUtils.java:251)
at org.keycloak.authentication.authenticators.browser.AbstractUsernameFormAuthenticator.getUserFromForm(AbstractUsernameFormAuthenticator.java:188)
at org.keycloak.authentication.authenticators.browser.AbstractUsernameFormAuthenticator.getUser(AbstractUsernameFormAuthenticator.java:167)
at org.keycloak.authentication.authenticators.browser.AbstractUsernameFormAuthenticator.validateUserAndPassword(AbstractUsernameFormAuthenticator.java:148)
at org.keycloak.authentication.authenticators.browser.UsernamePasswordForm.validateForm(UsernamePasswordForm.java:55)
at org.keycloak.authentication.authenticators.browser.UsernamePasswordForm.action(UsernamePasswordForm.java:48)
at org.keycloak.authentication.DefaultAuthenticationFlow.processAction(DefaultAuthenticationFlow.java:154)
at org.keycloak.authentication.AuthenticationProcessor.authenticationAction(AuthenticationProcessor.java:986)
at org.keycloak.services.resources.LoginActionsService.processFlow(LoginActionsService.java:378)
at org.keycloak.services.resources.LoginActionsService.processAuthentication(LoginActionsService.java:349)
at org.keycloak.services.resources.LoginActionsService.authenticateInternal(LoginActionsService.java:341)
at org.keycloak.services.resources.LoginActionsService.authenticate(LoginActionsService.java:322)
at org.keycloak.services.resources.LoginActionsService.authenticateForm(LoginActionsService.java:406)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:154)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:118)
at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:560)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:452)
at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:413)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:415)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:378)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:174)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:131)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:33)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:429)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:240)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:154)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:157)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:229)
at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:82)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:147)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.handle(VertxRequestHandler.java:84)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.handle(VertxRequestHandler.java:44)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1284)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:177)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:141)
at io.quarkus.vertx.http.runtime.options.HttpServerCommonHandlers$1.handle(HttpServerCommonHandlers.java:58)
at io.quarkus.vertx.http.runtime.options.HttpServerCommonHandlers$1.handle(HttpServerCommonHandlers.java:36)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1284)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:177)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:141)
at org.keycloak.quarkus.runtime.integration.web.QuarkusRequestFilter.lambda$createBlockingHandler$0(QuarkusRequestFilter.java:82)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
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:1623)

@lukaszgi @viniciusuriel @victor-torres @dla-c-box @rohit-userfacet @ayoubAnbara @1CMTdev
a fix for this would highly be appreciated since based on my tests, latest version of KC working with Singular is 18.0.2.

Thanks in advance.

Can you please share the steps to reproduce this issue @rosaliei .

@rohit-userfacet

Issue Reproducing Steps

Keycloak Version: quay.io/keycloak/keycloak:21.1.1

We are trying to connect to mysql as per screenshot.

Screenshot 2023-10-06 at 12 05 24 PM

Then we can connect to db successfully. When we try to sync and click sync all users, we have this issue.

Screenshot 2023-10-06 at 12 05 15 PM

Then I got the logs from server.

2023-10-06 08:04:18,252 ERROR [io.quarkus.vertx.http.runtime.QuarkusErrorHandler] (executor-thread-4) HTTP Request to /admin/realms/master/ui-ext/brute-force-user?briefRepresentation=true&first=0&max=11&search=da failed, error id: 14a8d773-ecba-4219-bf90-8887d69eb409-1: java.lang.AbstractMethodError: Receiver class org.opensingular.dbuserprovider.DBUserStorageProvider does not define or inherit an implementation of the resolved method 'abstract java.util.stream.Stream searchForUserStream(org.keycloak.models.RealmModel, java.lang.String, java.lang.Integer, java.lang.Integer)' of interface org.keycloak.storage.user.UserQueryProvider.
2023-10-06T08:04:18.256951789Z at org.keycloak.storage.UserStorageManager.lambda$searchForUserStream$24(UserStorageManager.java:443)
2023-10-06T08:04:18.256956786Z at org.keycloak.storage.UserStorageManager.lambda$query$10(UserStorageManager.java:254)
2023-10-06T08:04:18.256959882Z at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
2023-10-06T08:04:18.256962997Z at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
2023-10-06T08:04:18.256966571Z at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
2023-10-06T08:04:18.256970838Z at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
2023-10-06T08:04:18.256975521Z at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
2023-10-06T08:04:18.256978520Z at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395)
2023-10-06T08:04:18.256981390Z at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258)
2023-10-06T08:04:18.256996603Z at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258)
2023-10-06T08:04:18.257000218Z at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510)
2023-10-06T08:04:18.257003231Z at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)

2023-10-06T08:04:18.257006248Z at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310)
2023-10-06T08:04:18.257009232Z at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735)
2023-10-06T08:04:18.257053591Z at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
2023-10-06T08:04:18.257059929Z at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
2023-10-06T08:04:18.257066484Z at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
2023-10-06T08:04:18.257070521Z at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
2023-10-06T08:04:18.257076392Z at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
2023-10-06T08:04:18.257079208Z at java.base/java.util.stream.ReferencePipeline.forEachOrdered(ReferencePipeline.java:601)
2023-10-06T08:04:18.257082072Z at com.fasterxml.jackson.datatype.jdk8.StreamSerializer.serialize(StreamSerializer.java:71)
2023-10-06T08:04:18.257084910Z at com.fasterxml.jackson.datatype.jdk8.StreamSerializer.serialize(StreamSerializer.java:15)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:480)
2023-10-06T08:04:18.257093699Z at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:400)
2023-10-06T08:04:18.257098537Z at com.fasterxml.jackson.databind.ObjectWriter$Prefetch.serialize(ObjectWriter.java:1514)
2023-10-06T08:04:18.257101549Z at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:1007)
2023-10-06T08:04:18.257104430Z at org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider.writeTo(ResteasyJackson2Provider.java:345)
2023-10-06T08:04:18.257107383Z at org.jboss.resteasy.core.interception.jaxrs.ServerWriterInterceptorContext.lambda$writeTo$1(ServerWriterInterceptorContext.java:79)
2023-10-06T08:04:18.257110398Z at io.quarkus.resteasy.runtime.standalone.VertxHttpRequest$VertxExecutionContext.executeBlockingIo(VertxHttpRequest.java:251)
2023-10-06T08:04:18.257120441Z at org.jboss.resteasy.core.interception.jaxrs.ServerWriterInterceptorContext.writeTo(ServerWriterInterceptorContext.java:79)
2023-10-06T08:04:18.257123603Z at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.syncProceed(AbstractWriterInterceptorContext.java:245)
at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:224)
2023-10-06T08:04:18.257133978Z at org.keycloak.quarkus.runtime.integration.jaxrs.TransactionalResponseInterceptor.aroundWriteTo(TransactionalResponseInterceptor.java:41)
2023-10-06T08:04:18.257137350Z at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.syncProceed(AbstractWriterInterceptorContext.java:254)
2023-10-06T08:04:18.257140513Z at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.getStarted(AbstractWriterInterceptorContext.java:170)
2023-10-06T08:04:18.257143494Z at org.jboss.resteasy.core.interception.jaxrs.ServerWriterInterceptorContext.lambda$getStarted$0(ServerWriterInterceptorContext.java:73)
2023-10-06T08:04:18.257146506Z at org.jboss.resteasy.core.interception.jaxrs.ServerWriterInterceptorContext.aroundWriteTo(ServerWriterInterceptorContext.java:93)
2023-10-06T08:04:18.257149461Z at org.jboss.resteasy.core.interception.jaxrs.ServerWriterInterceptorContext.getStarted(ServerWriterInterceptorContext.java:73)
2023-10-06T08:04:18.257152408Z at org.jboss.resteasy.core.ServerResponseWriter.lambda$writeNomapResponse$3(ServerResponseWriter.java:163)
2023-10-06T08:04:18.257155341Z at org.jboss.resteasy.core.interception.jaxrs.ContainerResponseContextImpl.filter(ContainerResponseContextImpl.java:410)
2023-10-06T08:04:18.257158354Z at org.jboss.resteasy.core.ServerResponseWriter.executeFilters(ServerResponseWriter.java:252)
2023-10-06T08:04:18.257161223Z at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:101)
2023-10-06T08:04:18.257164195Z at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:74)
2023-10-06T08:04:18.257167054Z at org.jboss.resteasy.core.SynchronousDispatcher.writeResponse(SynchronousDispatcher.java:594)
2023-10-06T08:04:18.257170018Z at org.jboss.resteasy.core.SynchronousDispatcher.invoke(
SynchronousDispatcher.java:524)
2023-10-06T08:04:18.257172857Z at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:261)
2023-10-06T08:04:18.257175821Z at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:161)
2023-10-06T08:04:18.257178697Z at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
2023-10-06T08:04:18.257181713Z at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:164)
2023-10-06T08:04:18.257184606Z at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:247)
at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:73)
2023-10-06T08:04:18.257215454Z at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:151)
2023-10-06T08:04:18.257219164Z at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.handle(VertxRequestHandler.java:82)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.handle(VertxRequestHandler.java:42)
2023-10-06T08:04:18.257235830Z at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1284)
2023-10-06T08:04:18.257238802Z at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:173)
2023-10-06T08:04:18.257242796Z at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:140)
at io.quarkus.vertx.http.runtime.StaticResourcesRecorder$2.handle(StaticResourcesRecorder.java:84)
2023-10-06T08:04:18.257251137Z at io.quarkus.vertx.http.runtime.StaticResourcesRecorder$2.handle(StaticResourcesRecorder.java:71)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1284)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:173)
2023-10-06T08:04:18.257259839Z at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:140)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder$6.handle(VertxHttpRecorder.java:430)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder$6.handle(VertxHttpRecorder.java:408)
2023-10-06T08:04:18.257268499Z at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1284)
2023-10-06T08:04:18.257271280Z at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:173)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:140)
2023-10-06T08:04:18.257277080Z at org.keycloak.quarkus.runtime.integration.web.QuarkusRequestFilter.lambda$createBlockingHandler$0(QuarkusRequestFilter.java:82)
2023-10-06T08:04:18.257280056Z at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
2023-10-06T08:04:18.257282969Z at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
2023-10-06T08:04:18.257285789Z at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
2023-10-06T08:04:18.257291518Z at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
2023-10-06T08:04:18.257297361Z at java.base/java.lang.Thread.run(Thread.java:833)
2023-10-06T08:04:18.257300554Z

Here is how I did for error reproducing.