NotSerializableException on org.keycloak.services.DefaultKeycloakSession using RH-SSO 7.1 standalone cluster mode with custom User Storage SPI

Solution Verified - Updated -

Issue

Using the RH-SSO 7.1 standalone cluster mode with the following custom User Storage SPI 1 is possible to see the error below:

  • User Storage SPI
@Stateful
@Local(EjbExampleUserStorageProvider.class)
public class EjbExampleUserStorageProvider implements UserStorageProvider,
        UserLookupProvider,
        UserRegistrationProvider,
        UserQueryProvider,
        CredentialInputUpdater,
        CredentialInputValidator,
        OnUserCache
{
    private static final Logger logger = Logger.getLogger(EjbExampleUserStorageProvider.class);
    public static final String PASSWORD_CACHE_KEY = UserAdapter.class.getName() + ".password";

    @PersistenceContext
    protected EntityManager em;

    protected ComponentModel model;
protected KeycloakSession session;
...
}
  • Error
...
Caused by: org.infinispan.commons.marshall.NotSerializableException: org.keycloak.services.DefaultKeycloakSession
Caused by: an exception which occurred:
    in field session
    in field value
    in field instance
    in object java.util.concurrent.ConcurrentHashMap@3769c23c
    in object org.wildfly.clustering.ejb.infinispan.group.InfinispanBeanGroupEntry@65e67da0
    in object org.infinispan.commands.write.PutKeyValueCommand@eeb6ec6e
    in object org.infinispan.commands.tx.PrepareCommand@d8edf297
...

Environment

  • Red Hat Single Sign-On (RH-SSO) 7.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.