<p dir="ltr">Yeah, we have to fix server-ha-postgres. Overriding keycloak-server.json has probably become redundant.</p>
<div class="gmail_quote">On Dec 14, 2015 5:18 PM, &quot;Marek Posolda&quot; &lt;<a href="mailto:mposolda@redhat.com">mposolda@redhat.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div>There is missing declaration of
      userSessionPersister in the keycloak-server.json file. I bet that
      if you add this:<br>
      <br>
      &quot;userSessionPersister&quot;: {<br>
          &quot;provider&quot;: &quot;jpa&quot;<br>
      },<br>
      <br>
      to the file
      <a href="https://github.com/jboss-dockerfiles/keycloak/blob/master/server-ha-postgres/keycloak-server.json" target="_blank">https://github.com/jboss-dockerfiles/keycloak/blob/master/server-ha-postgres/keycloak-server.json</a>,
      the things will start to work.<br>
      <br>
      Will be cool if you could doublecheck and possibly send PR if it
      helps <span><span> :-) </span></span><br>
      <br>
      The even more proper solution will be to avoid having
      keycloak-server.json in the docker image, as the file becomes
      outdated during each update in Keycloak. Docker image should have
      some script or something to edit the existing file &quot;on the fly&quot;
      and update it to use cluster. <br>
      Actually not sure if separate keycloak-server.json is still needed
      as in latest Keycloak, keycloak-server.json already contains
      configuration for connections-infinispan (which it wasn&#39;t before
      AFAIK)<br>
      <br>
      Marek<br>
      <br>
      On 14/12/15 11:52, Thomas Darimont wrote:<br>
    </div>
    <blockquote type="cite">
      <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" target="_blank"><a href="https://issues.jboss.org/browse/KEYCLOAK-1999" target="_blank">https://issues.jboss.org/browse/KEYCLOAK-1999</a></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 style="white-space:pre-wrap">        </span>at
org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)</div>
          <div><span style="white-space:pre-wrap">        </span>at
            java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)</div>
          <div><span style="white-space:pre-wrap">        </span>at
            java.util.concurrent.FutureTask.run(FutureTask.java:262)</div>
          <div><span style="white-space:pre-wrap">        </span>at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)</div>
          <div><span style="white-space:pre-wrap">        </span>at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)</div>
          <div><span style="white-space:pre-wrap">        </span>at
            java.lang.Thread.run(Thread.java:745)</div>
          <div><span style="white-space:pre-wrap">        </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 style="white-space:pre-wrap">        </span>at
org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:160)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2211)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:295)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:236)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:112)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)</div>
          <div><span style="white-space:pre-wrap">        </span>at
io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)</div>
          <div><span style="white-space:pre-wrap">        </span>at
io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)</div>
          <div><span style="white-space:pre-wrap">        </span>at
io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:230)</div>
          <div><span style="white-space:pre-wrap">        </span>at
io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:131)</div>
          <div><span style="white-space:pre-wrap">        </span>at
io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:511)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)</div>
          <div><span style="white-space:pre-wrap">        </span>... 6 more</div>
          <div>Caused by: java.lang.NullPointerException</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.keycloak.models.sessions.infinispan.initializer.OfflineUserSessionLoader.init(OfflineUserSessionLoader.java:25)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.keycloak.models.sessions.infinispan.initializer.InfinispanUserSessionInitializer$1.run(InfinispanUserSessionInitializer.java:100)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:244)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.keycloak.models.sessions.infinispan.initializer.InfinispanUserSessionInitializer.getOrCreateInitializerState(InfinispanUserSessionInitializer.java:97)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.keycloak.models.sessions.infinispan.initializer.InfinispanUserSessionInitializer.startLoading(InfinispanUserSessionInitializer.java:148)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.keycloak.models.sessions.infinispan.initializer.InfinispanUserSessionInitializer.loadPersistentSessions(InfinispanUserSessionInitializer.java:78)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.keycloak.models.sessions.infinispan.InfinispanUserSessionProviderFactory$3.run(InfinispanUserSessionProviderFactory.java:111)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:244)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.keycloak.models.sessions.infinispan.InfinispanUserSessionProviderFactory.loadPersistentSessions(InfinispanUserSessionProviderFactory.java:102)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.keycloak.models.sessions.infinispan.InfinispanUserSessionProviderFactory$2.onEvent(InfinispanUserSessionProviderFactory.java:86)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.keycloak.services.DefaultKeycloakSessionFactory.publish(DefaultKeycloakSessionFactory.java:47)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.keycloak.services.resources.KeycloakApplication.&lt;init&gt;(KeycloakApplication.java:87)</div>
          <div><span style="white-space:pre-wrap">        </span>at
            sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
            Method)</div>
          <div><span style="white-space:pre-wrap">        </span>at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)</div>
          <div><span style="white-space:pre-wrap">        </span>at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)</div>
          <div><span style="white-space:pre-wrap">        </span>at
            java.lang.reflect.Constructor.newInstance(Constructor.java:526)</div>
          <div><span style="white-space:pre-wrap">        </span>at
org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:148)</div>
          <div><span style="white-space:pre-wrap">        </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>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
keycloak-user mailing list
<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a></pre>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
keycloak-user mailing list<br>
<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br></blockquote></div>