Getting NullPointerException when trying to login to RH-SSO realm

Solution Verified - Updated -

Issue

  • Trying to connect to the master realm in RH-SSO admin console, I've got an NullPointerException exception as below. The problem is just in this realm, the other realms work correctly.

    2019-10-16 16:48:13,232 WARN  [org.keycloak.events] (default task-3) type=LOGIN_ERROR, realmId=master, clientId=security-admin-console, userId=null, ipAddress=xx.xxx.xxx.xx, error=invalid_user_credentials, auth_method=openid-connect, auth_type=code, response_type=code, redirect_uri=https://hostname-fqdn:port/auth/admin/master/console/, code_id=0e377cc5-ee42-4911-9d66-da5a6806ac7c, response_mode=fragment
    2019-10-16 16:48:13,232 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-3) Uncaught server error: java.lang.NullPointerException
            at org.keycloak.forms.login.freemarker.FreeMarkerLoginFormsProvider.handleThemeResources(FreeMarkerLoginFormsProvider.java:278)
            at org.keycloak.forms.login.freemarker.FreeMarkerLoginFormsProvider.createResponse(FreeMarkerLoginFormsProvider.java:167)
            at org.keycloak.forms.login.freemarker.FreeMarkerLoginFormsProvider.createErrorPage(FreeMarkerLoginFormsProvider.java:463)
            at org.keycloak.services.ErrorPage.error(ErrorPage.java:31)
            at org.keycloak.authentication.AuthenticationProcessor.handleBrowserException(AuthenticationProcessor.java:671)
            at org.keycloak.protocol.AuthorizationEndpointBase.handleBrowserAuthenticationRequest(AuthorizationEndpointBase.java:147)
            at org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint.buildAuthorizationCodeAuthorizationResponse(AuthorizationEndpoint.java:395)
            at org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint.build(AuthorizationEndpoint.java:139)
            at sun.reflect.GeneratedMethodAccessor456.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
            at java.lang.reflect.Method.invoke(Method.java:508)
            ...
            ...
    
  • When accessing to my client application, the redirection to RH-SSO login page fails with HTTP 500 Error and the sso server logs show a NullPointerException as per below:

    11:26:10,970 WARN  [org.keycloak.services] (default task-1) KC-SERVICES0013: Failed authentication: java.lang.NullPointerException
        at org.keycloak.theme.ExtendingThemeManager.loadTheme(ExtendingThemeManager.java:117)
        at org.keycloak.theme.ExtendingThemeManager.getTheme(ExtendingThemeManager.java:95)
        at org.keycloak.theme.DefaultThemeManager.getTheme(DefaultThemeManager.java:26)
        at org.keycloak.theme.DefaultThemeManager.getTheme(DefaultThemeManager.java:21)
        at org.keycloak.forms.login.freemarker.FreeMarkerLoginFormsProvider.getTheme(FreeMarkerLoginFormsProvider.java:267)
        at org.keycloak.forms.login.freemarker.FreeMarkerLoginFormsProvider.createResponse(FreeMarkerLoginFormsProvider.java:160)
        at org.keycloak.forms.login.freemarker.FreeMarkerLoginFormsProvider.createLogin(FreeMarkerLoginFormsProvider.java:450)
        at org.keycloak.authentication.authenticators.browser.UsernamePasswordForm.challenge(UsernamePasswordForm.java:87)
        at org.keycloak.authentication.authenticators.browser.UsernamePasswordForm.authenticate(UsernamePasswordForm.java:73)
        at org.keycloak.authentication.DefaultAuthenticationFlow.processFlow(DefaultAuthenticationFlow.java:221)
        at org.keycloak.authentication.DefaultAuthenticationFlow.processFlow(DefaultAuthenticationFlow.java:148)
        at org.keycloak.authentication.AuthenticationProcessor.authenticateOnly(AuthenticationProcessor.java:910)
        at org.keycloak.authentication.AuthenticationProcessor.authenticate(AuthenticationProcessor.java:779)
        at org.keycloak.protocol.AuthorizationEndpointBase.handleBrowserAuthenticationRequest(AuthorizationEndpointBase.java:139)
        at org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint.buildAuthorizationCodeAuthorizationResponse(AuthorizationEndpoint.java:419)
        at org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint.process(AuthorizationEndpoint.java:152)
        at org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint.buildGet(AuthorizationEndpoint.java:108)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        ...
        ...
    
    [0m11:26:10,972 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-1) Uncaught server error: java.lang.NullPointerException
        at org.keycloak.theme.ExtendingThemeManager.loadTheme(ExtendingThemeManager.java:117)
        at org.keycloak.theme.ExtendingThemeManager.getTheme(ExtendingThemeManager.java:95)
        at org.keycloak.theme.DefaultThemeManager.getTheme(DefaultThemeManager.java:26)
        at org.keycloak.theme.DefaultThemeManager.getTheme(DefaultThemeManager.java:21)
        at org.keycloak.forms.login.freemarker.FreeMarkerLoginFormsProvider.getTheme(FreeMarkerLoginFormsProvider.java:267)
        at org.keycloak.forms.login.freemarker.FreeMarkerLoginFormsProvider.createResponse(FreeMarkerLoginFormsProvider.java:160)
        at org.keycloak.forms.login.freemarker.FreeMarkerLoginFormsProvider.createErrorPage(FreeMarkerLoginFormsProvider.java:506)
        at org.keycloak.services.ErrorPage.error(ErrorPage.java:31)
        at org.keycloak.authentication.AuthenticationProcessor.handleBrowserException(AuthenticationProcessor.java:728)
        at org.keycloak.protocol.AuthorizationEndpointBase.handleBrowserAuthenticationRequest(AuthorizationEndpointBase.java:141)
        at org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint.buildAuthorizationCodeAuthorizationResponse(AuthorizationEndpoint.java:419)
        at org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint.process(AuthorizationEndpoint.java:152)
        at org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint.buildGet(AuthorizationEndpoint.java:108)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        ...
    

Environment

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

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