[keycloak-dev] Keycloak Clustering 1.1.0.Final - Getting infinispan type casting error (DefaultCacheContainer to EmbeddedCacheManager) in DefaultInfinispanConnectionProviderFactory

Marek Posolda mposolda at redhat.com
Wed Feb 25 09:46:34 EST 2015


You should ensure that infinispan jars are not in your.war/WEB-INF/lib . 
Instead you should add file 
your.war/WEB-INF/jboss-deployment-structure.xml and put dependencies on 
all necessary modules there. See 
auth-server.war/WEB-INF/jboss-deployment-structure.xml and especially 
this line: 
https://github.com/keycloak/keycloak/blob/master/server/src/main/webapp/WEB-INF/jboss-deployment-structure.xml#L8

Marek

On 25.2.2015 13:21, Bappaditya Gorai (bgorai) wrote:
>
> Hi ,
>
> Thanks for your response.
>
> keycloak-war-dist 1.1.0.Final works for me too.
>
> Actually I have custom application similar to “ups-auth-server” . In 
> pom.xml I am using  “*keycloak-dependencies-server-min*” artifact  and 
> added necessary infinispan related dependencies 
> (keycloak-connections-infinispan, keycloak-model-sessions-infinispan, 
> keycloak-invalidation-cache-infinispan).
>
> Yes, I have added additional *“infinispan-core”* dependency in my 
> pom.xml as jboss class loader was unable to find 
> EmbeddedCacheManager.class .
>
> I see in your pom.xml you are using 
> “*keycloak-dependencies-server-all” *, do I need to use the same ( 
> although I may not need all the dependencies)?
>
> Thanks
>
> Bappaditya Gorai
>
> *From:*Marek Posolda [mailto:mposolda at redhat.com]
> *Sent:* Tuesday, February 24, 2015 7:46 PM
> *To:* Bappaditya Gorai (bgorai); keycloak-dev at lists.jboss.org
> *Subject:* Re: [keycloak-dev] Keycloak Clustering 1.1.0.Final - 
> Getting infinispan type casting error (DefaultCacheContainer to 
> EmbeddedCacheManager) in DefaultInfinispanConnectionProviderFactory
>
> Hi,
>
> I can't reproduce the issue. It's strange as 
> org.jboss.as.clustering.infinispan.DefaultCacheContainer is subclass 
> of org.infinispan.manager.EmbeddedCacheManager. Didn't you do some 
> packaging changes like adding infinispan jars to 
> auth-server.war/WEB-INF/lib or something like that?
>
> What I did for clustered Keycloak on EAP 6.3:
>
> 1) Unpack keycloak-war-dist 1.1.0.Final to my jboss-eap 6.3
> 2) Configured standalone/configuration/standalone-ha.xml and add this 
> under infinispan subsystem:
>
>  <cache-container name="keycloak" jndi-name="infinispan/Keycloak" 
> start="EAGER">
>   <transport lock-timeout="60000"/>
>   <distributed-cache name="sessions" mode="SYNC" owners="2" 
> segments="60"/>
>   <distributed-cache name="loginFailures" mode="SYNC" owners="2" 
> segments="60"/>
>   <invalidation-cache name="realms" mode="SYNC"/>
>   <invalidation-cache name="users"  mode="SYNC"/>
>  </cache-container>
>
> 3) Configured standalone/configuration/keycloak-server.json and add this:
>
> "connectionsInfinispan": {
>     "default" : {
>         "cacheContainer" : "java:jboss/infinispan/Keycloak"
>     }
> }
>
> and also switch realmCache, userCache and userSessions to use: 
> "provider": "infinispan"
>
> 4) Then run server with command:
> ./standalone.sh -c standalone-ha.xml
>
> Let me know if these steps work for you.
>
> Marek
>
> On 24.2.2015 14:07, Bappaditya Gorai (bgorai) wrote:
>
>     In my standalone configuration file I am using following subsystem
>     version for infinispan, not sure whether it has any relevance to
>     my issue.
>
>     <subsystem xmlns="urn:jboss:domain:infinispan:1.5">
>
>     Thanks
>
>     Bappaditya Gorai
>
>     *From:*Bappaditya Gorai (bgorai)
>     *Sent:* Monday, February 23, 2015 2:46 PM
>     *To:* keycloak-dev at lists.jboss.org
>     <mailto:keycloak-dev at lists.jboss.org>
>     *Subject:* Keycloak Clustering 1.1.0.Final - Getting infinispan
>     type casting error (DefaultCacheContainer to EmbeddedCacheManager)
>     in DefaultInfinispanConnectionProviderFactory
>
>     Hi Team,
>
>     I am trying  configure  Keycloak in clustered environment (EAP
>     6.3), however getting following error (stack trace is provided
>     below) . I have followed instructions provided in “*Chapter 24.
>     Clustering*” in Keycloak Guide
>     (http://docs.jboss.org/keycloak/docs/1.1.0.Final/userguide/html/clustering.html).
>     Let me know if I am missing something.
>
>     13:23:25,681 ERROR
>     [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/auth]]
>     (ServerService Thread Pool -- 62) JBWEB000289: Servlet Keycloak
>     REST Interface threw load() exception:
>     *java.lang.ClassCastException:
>     org.jboss.as.clustering.infinispan.DefaultCacheContainer cannot be
>     cast to org.infinispan.manager.EmbeddedCacheManager*
>
>             at
>     org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFactory.initContainerManaged(*DefaultInfinispanConnectionProviderFactory.java:70*)
>     [keycloak-connections-infinispan-1.1.0.Final.jar:1.1.0.Final]
>
>             at
>     org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFactory.lazyInit(DefaultInfinispanConnectionProviderFactory.java:59)
>     [keycloak-connections-infinispan-1.1.0.Final.jar:1.1.0.Final]
>
>             at
>     org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFactory.create(DefaultInfinispanConnectionProviderFactory.java:30)
>     [keycloak-connections-infinispan-1.1.0.Final.jar:1.1.0.Final]
>
>             at
>     org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFactory.create(DefaultInfinispanConnectionProviderFactory.java:18)
>     [keycloak-connections-infinispan-1.1.0.Final.jar:1.1.0.Final]
>
>     Thanks
>
>     Bappaditya Gorai
>
>
>
>
>     _______________________________________________
>
>     keycloak-dev mailing list
>
>     keycloak-dev at lists.jboss.org  <mailto:keycloak-dev at lists.jboss.org>
>
>     https://lists.jboss.org/mailman/listinfo/keycloak-dev
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-dev/attachments/20150225/d8e18a35/attachment-0001.html 


More information about the keycloak-dev mailing list