Keycloak 失败,因为它找不到我的主题或带有 NullPointer 异常的默认主题
Posted
技术标签:
【中文标题】Keycloak 失败,因为它找不到我的主题或带有 NullPointer 异常的默认主题【英文标题】:Keycloak fails because it can't find my theme or default theme with NullPointer Exception 【发布时间】:2020-02-19 04:01:40 【问题描述】:当我不得不核对我所有的 docker 图像以解决另一个问题时,我有一个工作的本地 keycloak 图像。然后我用
再次调出了我的 keycloak 图像version: '3.6'
volumes:
keycloak_postgres_data:
services:
postgres-keycloak:
image: postgres:10-alpine
container_name: postgres
volumes:
- keycloak_postgres_data:/var/lib/postgresql/data
environment:
POSTGRES_DB: keycloak
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: password
keycloak:
image: jboss/keycloak:4.1.0.Final
environment:
DB_VENDOR: POSTGRES
DB_ADDR: postgres
DB_DATABASE: keycloak
DB_USER: keycloak
DB_PASSWORD: password
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: testing
ports:
- 8088:8080
volumes:
- ./themes/puretalent:/opt/jboss/keycloak/themes/puretalent
- ./themes/fifteenrock:/opt/jboss/keycloak/themes/fifteenrock
depends_on:
- postgres-keycloak
卷中提到的主题存在于同一个文件夹中,并且当我提出它时也在容器中。在领域设置中,我尝试将主题设置为我的特定主题或默认主题,但我在下面得到相同的错误。我已将其省略到相关的错误消息中。我还禁用了standalone.xml 中的缓存并重新启动了容器。
但是,我遇到了 NullPointer 异常。
keycloak_1 |
keycloak_1 | 01:18:58,781 WARN [org.keycloak.events] (default task-1) type=LOGIN_ERROR, realmId=master, clientId=odin, userId=null, ipAddress=172.20.0.1, error=invalid_user_credentials, auth_method=openid-connect, auth_type=code, response_type=code, redirect_uri=http://localhost:8082/odin/oidc_callback, code_id=9646b75e-273d-473e-a999-643d01d4cc36, response_mode=query
keycloak_1 | 01:18:58,793 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-1) Uncaught server error: java.lang.NullPointerException
keycloak_1 | at org.keycloak.theme.ExtendingThemeManager.loadTheme(ExtendingThemeManager.java:117)
keycloak_1 | at org.keycloak.theme.ExtendingThemeManager.getTheme(ExtendingThemeManager.java:108)
keycloak_1 | at org.keycloak.theme.DefaultThemeManager.getTheme(DefaultThemeManager.java:26)
keycloak_1 | at org.keycloak.theme.DefaultThemeManager.getTheme(DefaultThemeManager.java:21)
keycloak_1 | at org.keycloak.forms.login.freemarker.FreeMarkerLoginFormsProvider.getTheme(FreeMarkerLoginFormsProvider.java:262)
keycloak_1 | at org.keycloak.forms.login.freemarker.FreeMarkerLoginFormsProvider.createResponse(FreeMarkerLoginFormsProvider.java:158)
keycloak_1 | at org.keycloak.forms.login.freemarker.FreeMarkerLoginFormsProvider.createErrorPage(FreeMarkerLoginFormsProvider.java:498)
keycloak_1 | at org.keycloak.services.ErrorPage.error(ErrorPage.java:31)
keycloak_1 | at org.keycloak.authentication.AuthenticationProcessor.handleBrowserException(AuthenticationProcessor.java:728)
keycloak_1 | at org.keycloak.protocol.AuthorizationEndpointBase.handleBrowserAuthenticationRequest(AuthorizationEndpointBase.java:145)
keycloak_1 | at org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint.buildAuthorizationCodeAuthorizationResponse(AuthorizationEndpoint.java:409)
keycloak_1 | at org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint.process(AuthorizationEndpoint.java:152)
keycloak_1 | at org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint.buildGet(AuthorizationEndpoint.java:108)
…
【问题讨论】:
【参考方案1】:在客户端->我的客户端->设置->登录主题。选择您的主题。
【讨论】:
以上是关于Keycloak 失败,因为它找不到我的主题或带有 NullPointer 异常的默认主题的主要内容,如果未能解决你的问题,请参考以下文章