Infinispan cache names

I have copied cache-ispn.xml file from base Keycloak image, and I have rename the caches names like:

        <replicated-cache name="**keycloak**-work">
            <expiration lifespan="-1"/>
        </replicated-cache>

so prefix ‘keycloak’ is added so on Infinispan server (external) I can distinguish what caches are for Keycloak, what not.

But this does not work, and I am still getting WARNS and ERROS about old cache names like they are hardcoded in Keycloak:

"org.infinispan.client.hotrod.logging.Log_$logger","loggerName":"org.infinispan.HOTROD","level":"WARN","logDesc":"ISPN004005: Error received from the server: org.infinispan.server.hotrod.CacheNotFoundException: Cache with name 'work' not found amongst the configured caches
org.jboss.logging.Logger","loggerName":"org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler","level":"ERROR","logDesc":"ERROR: java.lang.NullPointerException: Cannot invoke \"org.infinispan.configuration.cache.ConfigurationBuilder.persistence()\" because \"builder\" is null

Is this is possible or I have to stick with predefined cache names?

Not possible. Keycloak uses those names internally to get the caches from infinispan.

There is a Infinispan cache alias:

So I will first try with that.

If not, I have found InfinispanConnectionSpi in Keycloak that have InfinispanConnectionProvider where all values are hardcoded.
So idea is to add custom InfinispanConnectionSpi with custom InfinispanConnectionProvider created with custom values and just make use of new SPI like:
KC_SPI_CONNECTIONS_INFINISPAN_PROVIDER={my-ispn}

Will let you know here guys!

Look like not posible to make it customisable. Maybe but it is require a lot code changes for such a thing. We may open GH ticket for Keycloak maintainers for this.

1 Like