[KEYCLOAK-17923] - No marshaller registered for clustered sessions in Keycloak.X

This commit is contained in:
Pedro Igor 2021-05-10 09:49:50 -03:00
parent bbc8d83f64
commit 1855a5e17c
2 changed files with 10 additions and 0 deletions

View file

@ -457,6 +457,10 @@
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-jboss-marshalling</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>

View file

@ -24,6 +24,7 @@ import java.nio.file.Paths;
import org.infinispan.commons.util.FileLookupFactory;
import org.infinispan.configuration.parsing.ConfigurationBuilderHolder;
import org.infinispan.configuration.parsing.ParserRegistry;
import org.infinispan.jboss.marshalling.core.JBossUserMarshaller;
import org.infinispan.manager.DefaultCacheManager;
import org.jboss.logging.Logger;
import org.keycloak.cluster.ManagedCacheManagerProvider;
@ -46,6 +47,11 @@ public final class QuarkusCacheManagerProvider implements ManagedCacheManagerPro
configureTransportStack(config, builder);
}
// For Infinispan 10, we go with the JBoss marshalling.
// TODO: This should be replaced later with the marshalling recommended by infinispan. Probably protostream.
// See https://infinispan.org/docs/stable/titles/developing/developing.html#marshalling for the details
builder.getGlobalConfigurationBuilder().serialization().marshaller(new JBossUserMarshaller());
return (C) new DefaultCacheManager(builder, false);
} catch (Exception e) {
throw new RuntimeException(e);