[keycloak-user] How to enable Infinispan cache for realms, users and user sessions in Keycloak 1.6.1?

Lohitha Chiranjeewa kalc04 at gmail.com
Thu Nov 26 08:53:49 EST 2015


Hi,

We're in the process of assessing the impact on upgrading from Keycloak
1.2.0 to 1.6.1. We came across an issue when trying to enable Infinispan
cache through the keycloak-server.json file as we used to do in 1.2.0.

We have the following entries in 1.6.1:
    "realm": {
        "provider": "infinispan"
    },

    "user": {
        "provider": "infinispan"
    },

    "userSessionPersister": {
        "provider": "infinispan"
    },
.........
    "connectionsInfinispan": {
        "default" : {
            "cacheContainer" : "java:comp/env/infinispan/Keycloak"
        }
    }

All configurations in 1.6.1 standalone-ha.xml file remains comparable (and
correct to the best of our knowledge) with the ones in 1.2.0.

With the above configs, when we start the Keycloak service the following
error(s) get logged:

18:03:31,610 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool
-- 64) 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)
    at
org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)
    at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
[rt.jar:1.7.0_45]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
[rt.jar:1.7.0_45]
    at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[rt.jar:1.7.0_45]
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[rt.jar:1.7.0_45]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
    at org.jboss.threads.JBossThread.run(JBossThread.java:320)
[jboss-threads-2.2.0.Final.jar:2.2.0.Final]
Caused by: java.lang.RuntimeException: Failed to construct public
org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher)
    at
org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:160)
    at
org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2211)
    at
org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:295)
    at
org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:236)
    at
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:112)
    at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)
    at
io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
    at
org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
    at
io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)
    at
io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:230)
    at
io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:131)
    at
io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:511)
    at
org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101)
    at
org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
    ... 6 more
Caused by: java.lang.RuntimeException: Failed to find provider infinispan
for realm
    at
org.keycloak.services.DefaultKeycloakSessionFactory.init(DefaultKeycloakSessionFactory.java:66)
    at
org.keycloak.services.resources.KeycloakApplication.createSessionFactory(KeycloakApplication.java:162)
    at
org.keycloak.services.resources.KeycloakApplication.<init>(KeycloakApplication.java:62)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method) [rt.jar:1.7.0_45]
    at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
[rt.jar:1.7.0_45]
    at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[rt.jar:1.7.0_45]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
[rt.jar:1.7.0_45]
    at
org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:148)
    ... 19 more


Is the new way to enable Infinispan different to what we had earlier? If
so, can someone please point out the correct way?


Regards,
Lohitha.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20151126/22eb9cdd/attachment.html 


More information about the keycloak-user mailing list