diff --git a/model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/initializer/InfinispanCacheInitializer.java b/model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/initializer/InfinispanCacheInitializer.java
index f7369e5b09..affc7471ab 100755
--- a/model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/initializer/InfinispanCacheInitializer.java
+++ b/model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/initializer/InfinispanCacheInitializer.java
@@ -18,7 +18,6 @@
package org.keycloak.models.sessions.infinispan.initializer;
import org.infinispan.Cache;
-import org.infinispan.commons.CacheConfigurationException;
import org.infinispan.commons.CacheException;
import org.infinispan.factories.ComponentRegistry;
import org.infinispan.manager.ClusterExecutor;
@@ -63,12 +62,12 @@ public class InfinispanCacheInitializer extends BaseCacheInitializer {
@Override
public void initCache() {
- final ComponentRegistry cr = this.workCache.getAdvancedCache().getComponentRegistry();
- try {
- cr.registerComponent(sessionFactory, KeycloakSessionFactory.class);
- } catch (UnsupportedOperationException | CacheConfigurationException ex) {
+ // due to lazy initialization, this might be called from multiple threads simultaneously, therefore, synchronize
+ synchronized (workCache) {
+ final ComponentRegistry cr = this.workCache.getAdvancedCache().getComponentRegistry();
+ // first check if already set, as Infinispan would otherwise throw a RuntimeException
if (cr.getComponent(KeycloakSessionFactory.class) != sessionFactory) {
- throw ex;
+ cr.registerComponent(sessionFactory, KeycloakSessionFactory.class);
}
}
}
diff --git a/pom.xml b/pom.xml
index 18517ac7b4..759d40338e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -81,8 +81,8 @@
2.2.3
6.2.1.Final
${hibernate-orm.version}
- 14.0.7.Final
- 4.6.0.Final
+ 14.0.8.Final
+ 4.6.2.Final
2.14.2
2.14.2
${jackson.version}
diff --git a/quarkus/runtime/src/main/resources/cache-ispn.xml b/quarkus/runtime/src/main/resources/cache-ispn.xml
index 0c21e3c1e7..59880c1a85 100644
--- a/quarkus/runtime/src/main/resources/cache-ispn.xml
+++ b/quarkus/runtime/src/main/resources/cache-ispn.xml
@@ -18,8 +18,8 @@
+ xsi:schemaLocation="urn:infinispan:config:14.0 http://www.infinispan.org/schemas/infinispan-config-14.0.xsd"
+ xmlns="urn:infinispan:config:14.0">
diff --git a/quarkus/runtime/src/main/resources/cache-local.xml b/quarkus/runtime/src/main/resources/cache-local.xml
index 758fde8b3b..b44185402a 100644
--- a/quarkus/runtime/src/main/resources/cache-local.xml
+++ b/quarkus/runtime/src/main/resources/cache-local.xml
@@ -18,8 +18,8 @@
+ xsi:schemaLocation="urn:infinispan:config:14.0 http://www.infinispan.org/schemas/infinispan-config-14.0.xsd"
+ xmlns="urn:infinispan:config:14.0">