<div dir="ltr"><div>Starting the Keycloak Postgres HA Docker Image fails due to a problem with loading OffilineUserSessions - see stacktrace below.</div><div><br></div><div>There is an already resolved?! issue <a href="https://issues.jboss.org/browse/KEYCLOAK-1999">https://issues.jboss.org/browse/KEYCLOAK-1999</a> filed for Keycloak 1.6.0 that shows some </div><div>workaround suggestions, but I think disabling the support for offline sessions is not a fix to the actual problem...</div><div><br></div><div>Would be great to have a real fix, since this hinders the Keycloak Server to start.</div><div><br></div><div>Just verified this with:</div><div>- jboss/keycloak-ha-postgres:latest</div><div>- jboss/keycloak-ha-postgres:1.7.0.Release</div><div>- jboss/keycloak-ha-postgres:1.6.1.Release<br></div><div>- jboss/keycloak-ha-postgres:1.6.0.Release<br></div><div><br></div><div>Steps to reproduce:</div><div><br></div><div># Start Postgres Instance:</div><div>docker run --name kc-db -e POSTGRES_DATABASE=keycloak -e POSTGRES_USER=keycloak -e POSTGRES_PASSWORD=password -e POSTGRES_ROOT_PASSWORD=password -p 25432:5432 -d postgres<br></div><div><br></div><div># Start KC Server</div><div>docker run --name kc-server1 --link kc-db:postgres -e POSTGRES_DATABASE=keycloak -e POSTGRES_USER=keycloak -e POSTGRES_PASSWORD=password -p 8101:8080 jboss/keycloak-ha-postgres<br></div><div><br></div><div>#Exception during start:</div><div>...</div><div><div>10:33:54,461 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 62) WFLYCLINF0002: Started offlineSessions cache from keycloak container</div><div>10:33:54,472 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 62) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./auth: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./auth: java.lang.RuntimeException: Failed to construct public org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher)</div><div><span class="" style="white-space:pre">        </span>at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)</div><div><span class="" style="white-space:pre">        </span>at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)</div><div><span class="" style="white-space:pre">        </span>at java.util.concurrent.FutureTask.run(FutureTask.java:262)</div><div><span class="" style="white-space:pre">        </span>at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)</div><div><span class="" style="white-space:pre">        </span>at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)</div><div><span class="" style="white-space:pre">        </span>at java.lang.Thread.run(Thread.java:745)</div><div><span class="" style="white-space:pre">        </span>at org.jboss.threads.JBossThread.run(JBossThread.java:320)</div><div>Caused by: java.lang.RuntimeException: Failed to construct public org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher)</div><div><span class="" style="white-space:pre">        </span>at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:160)</div><div><span class="" style="white-space:pre">        </span>at org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2211)</div><div><span class="" style="white-space:pre">        </span>at org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:295)</div><div><span class="" style="white-space:pre">        </span>at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:236)</div><div><span class="" style="white-space:pre">        </span>at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:112)</div><div><span class="" style="white-space:pre">        </span>at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)</div><div><span class="" style="white-space:pre">        </span>at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)</div><div><span class="" style="white-space:pre">        </span>at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)</div><div><span class="" style="white-space:pre">        </span>at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)</div><div><span class="" style="white-space:pre">        </span>at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:230)</div><div><span class="" style="white-space:pre">        </span>at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:131)</div><div><span class="" style="white-space:pre">        </span>at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:511)</div><div><span class="" style="white-space:pre">        </span>at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101)</div><div><span class="" style="white-space:pre">        </span>at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)</div><div><span class="" style="white-space:pre">        </span>... 6 more</div><div>Caused by: java.lang.NullPointerException</div><div><span class="" style="white-space:pre">        </span>at org.keycloak.models.sessions.infinispan.initializer.OfflineUserSessionLoader.init(OfflineUserSessionLoader.java:25)</div><div><span class="" style="white-space:pre">        </span>at org.keycloak.models.sessions.infinispan.initializer.InfinispanUserSessionInitializer$1.run(InfinispanUserSessionInitializer.java:100)</div><div><span class="" style="white-space:pre">        </span>at org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:244)</div><div><span class="" style="white-space:pre">        </span>at org.keycloak.models.sessions.infinispan.initializer.InfinispanUserSessionInitializer.getOrCreateInitializerState(InfinispanUserSessionInitializer.java:97)</div><div><span class="" style="white-space:pre">        </span>at org.keycloak.models.sessions.infinispan.initializer.InfinispanUserSessionInitializer.startLoading(InfinispanUserSessionInitializer.java:148)</div><div><span class="" style="white-space:pre">        </span>at org.keycloak.models.sessions.infinispan.initializer.InfinispanUserSessionInitializer.loadPersistentSessions(InfinispanUserSessionInitializer.java:78)</div><div><span class="" style="white-space:pre">        </span>at org.keycloak.models.sessions.infinispan.InfinispanUserSessionProviderFactory$3.run(InfinispanUserSessionProviderFactory.java:111)</div><div><span class="" style="white-space:pre">        </span>at org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:244)</div><div><span class="" style="white-space:pre">        </span>at org.keycloak.models.sessions.infinispan.InfinispanUserSessionProviderFactory.loadPersistentSessions(InfinispanUserSessionProviderFactory.java:102)</div><div><span class="" style="white-space:pre">        </span>at org.keycloak.models.sessions.infinispan.InfinispanUserSessionProviderFactory$2.onEvent(InfinispanUserSessionProviderFactory.java:86)</div><div><span class="" style="white-space:pre">        </span>at org.keycloak.services.DefaultKeycloakSessionFactory.publish(DefaultKeycloakSessionFactory.java:47)</div><div><span class="" style="white-space:pre">        </span>at org.keycloak.services.resources.KeycloakApplication.&lt;init&gt;(KeycloakApplication.java:87)</div><div><span class="" style="white-space:pre">        </span>at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)</div><div><span class="" style="white-space:pre">        </span>at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)</div><div><span class="" style="white-space:pre">        </span>at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)</div><div><span class="" style="white-space:pre">        </span>at java.lang.reflect.Constructor.newInstance(Constructor.java:526)</div><div><span class="" style="white-space:pre">        </span>at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:148)</div><div><span class="" style="white-space:pre">        </span>... 19 more</div><div><br></div><div>10:33:54,516 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation (&quot;add&quot;) failed - address: ([(&quot;deployment&quot; =&gt; &quot;keycloak-server.war&quot;)]) - </div></div></div>