Keycloak REST api java admin client无法识别的字段“access_token”

时间:2018-06-14 17:25:47

标签: java resteasy keycloak jackson2

当我尝试使用我的java Web应用程序将用户发送到keycloak时,我收到以下错误:

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: 
Unrecognized field "access_token" (class org.keycloak.representations.AccessTokenResponse), 
not marked as ignorable (10 known properties: "tokenType", "notBeforePolicy", "otherClaims", "token", "sessionState", "refreshExpiresIn", "scope", "expiresIn", "refreshToken", "idToken"])
at [Source: org.apache.http.conn.EofSensorInputStream@ea80868; line: 1, column: 18] (through reference chain: org.keycloak.representations.AccessTokenResponse["access_token"])

之前我遇到过此错误,然后通过将resteasy-jackson-provider替换为resteasy-jackson2-provider来修复错误。

我认为一些旧的依赖项必须成为问题,因此我运行mvn dependency:tree进行验证。

所有依赖项都不包含'resteasy-jackson-provider'。 只找到以下版本的相关依赖项:

org.jboss.resteasy:resteasy-jackson2-provider:jar:3.0.12.Final
org.keycloak:keycloak-admin-client:jar:3.4.3.Final

我的本​​地keycloak安装是3.4.3.Final也是。

我的pom片段:

    <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-admin-client</artifactId>
        <version>3.4.3.Final</version>
    </dependency>
    <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-core</artifactId>
        <version>3.4.3.Final</version>
    </dependency>
    <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-model-api</artifactId>
        <version>1.8.1.Final</version>
    </dependency>
    <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-services</artifactId>
        <version>3.4.3.Final</version>
    </dependency>
    <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-jetty81-adapter</artifactId>
        <version>3.4.3.Final</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jackson2-provider</artifactId>
        <version>3.0.12.Final</version>
    </dependency>
  <dependency>
    <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxrs</artifactId>
        <version>3.0.12.Final</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-client</artifactId>
        <version>3.0.12.Final</version>
    </dependency>

我在这里遗漏了什么吗?可以用其他方式解释错误吗?这些依赖项之间是否存在版本不匹配?

0 个答案:

没有答案