我正在尝试在Docker中运行Keycloak,但是它引发了错误。
这是docker文件:
FROM jboss/keycloak:4.1.0.Final
WORKDIR /opt/jboss/keycloak
COPY realm-export.json initial_data.json
RUN ./bin/standalone.sh -Dkeycloak.migration.action=import -Dkeycloak.migration.provider=singleFile -Dkeycloak.migration.file=initial_data.json -Dkeycloak.migration.strategy=OVERWRITE_EXISTING
我正在使用该realm-export.json文件,因为那里有一些配置。 而显示的错误就是这个:
12:04:35,033 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 48) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./auth: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./auth: java.lang.RuntimeException: RESTEASY003325: Failed to construct public org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:84)
Caused by: java.lang.RuntimeException: RESTEASY003325: Failed to construct public org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher)
Caused by: java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "typedScopes" (class org.keycloak.representations.idm.authorization.ResourceRepresentation), not marked as ignorable (11 known properties: "ownerManagedAccess", "owner", "icon_uri", "attributes", "type", "name", "uri", "displayName", "scopes", "resource_scopes", "_id"])
at [Source: java.io.FileInputStream@6d0b4fbd; line: 690, column: 29] (through reference chain: org.keycloak.representations.idm.RealmRepresentation["clients"]->java.util.ArrayList[2]->org.keycloak.representations.idm.ClientRepresentation["authorizationSettings"]->org.keycloak.representations.idm.authorization.ResourceServerRepresentation["resources"]->java.util.ArrayList[2]->org.keycloak.representations.idm.authorization.ResourceRepresentation["typedScopes"])
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "typedScopes" (class org.keycloak.representations.idm.authorization.ResourceRepresentation), not marked as ignorable (11 known properties: "ownerManagedAccess", "owner", "icon_uri", "attributes", "type", "name", "uri", "displayName", "scopes", "resource_scopes", "_id"])
at [Source: java.io.FileInputStream@6d0b4fbd; line: 690, column: 29] (through reference chain: org.keycloak.representations.idm.RealmRepresentation["clients"]->java.util.ArrayList[2]->org.keycloak.representations.idm.ClientRepresentation["authorizationSettings"]->org.keycloak.representations.idm.authorization.ResourceServerRepresentation["resources"]->java.util.ArrayList[2]->org.keycloak.representations.idm.authorization.ResourceRepresentation["typedScopes"])
这在结尾处显示:
12:04:35,121 ERROR [org.jboss.as.server] (ServerService Thread Pool -- 45) WFLYSRV0022: Deploy of deployment "keycloak-server.war" was rolled back with no failure message
ERROR: Service 'keycloak' failed to build: The command '/bin/sh -c ./bin/standalone.sh -Dkeycloak.migration.action=import -Dkeycloak.migration.provider=singleFile -Dkeycloak.migration.file=initial_data.json -Dkeycloak.migration.strategy=OVERWRITE_EXISTING' returned a non-zero code: 1
p.s。当我在DockerFile中注释此代码时
RUN ./bin/standalone.sh -Dkeycloak.migration.action=import -Dkeycloak.migration.provider=singleFile -Dkeycloak.migration.file=initial_data.json -Dkeycloak.migration.strategy=OVERWRITE_EXISTING
然后它执行得很好,但是我确实需要在此处添加该realm-export.json文件。
答案 0 :(得分:1)
typedScopes
从4.0.0版本更改为scopes
,您从旧版本的keycloak生成了realm-export.json文件