Skip to content

Unexpected type of JSON object member with key mtls_endpoint_aliases #174

@jsm174

Description

@jsm174

When trying to launch the control center via docker-compose, the following error is displayed:

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.client.registration.InMemoryReactiveClientRegistrationRepository]: Factory method 'clientRegistrationRepository' threw exception; nested exception is java.lang.IllegalArgumentException: Unable to resolve Configuration with the provided Issuer of "http://keycloak:9080/auth/realms/jhipster"
docker-jhipster-control-center-1  | 	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
docker-jhipster-control-center-1  | 	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
docker-jhipster-control-center-1  | 	... 40 common frames omitted
docker-jhipster-control-center-1  | Caused by: java.lang.IllegalArgumentException: Unable to resolve Configuration with the provided Issuer of "http://keycloak:9080/auth/realms/jhipster"
docker-jhipster-control-center-1  | 	at org.springframework.security.oauth2.client.registration.ClientRegistrations.getBuilder(ClientRegistrations.java:221)
docker-jhipster-control-center-1  | 	at org.springframework.security.oauth2.client.registration.ClientRegistrations.fromIssuerLocation(ClientRegistrations.java:145)
docker-jhipster-control-center-1  | 	at org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter.getBuilderFromIssuerIfPossible(OAuth2ClientPropertiesRegistrationAdapter.java:83)
docker-jhipster-control-center-1  | 	at org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter.getClientRegistration(OAuth2ClientPropertiesRegistrationAdapter.java:59)
docker-jhipster-control-center-1  | 	at org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter.lambda$getClientRegistrations$0(OAuth2ClientPropertiesRegistrationAdapter.java:53)
docker-jhipster-control-center-1  | 	at java.base/java.util.HashMap.forEach(Unknown Source)
docker-jhipster-control-center-1  | 	at org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter.getClientRegistrations(OAuth2ClientPropertiesRegistrationAdapter.java:52)
docker-jhipster-control-center-1  | 	at org.springframework.boot.autoconfigure.security.oauth2.client.reactive.ReactiveOAuth2ClientConfigurations$ReactiveClientRegistrationRepositoryConfiguration.clientRegistrationRepository(ReactiveOAuth2ClientConfigurations.java:56)
docker-jhipster-control-center-1  | 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
docker-jhipster-control-center-1  | 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
docker-jhipster-control-center-1  | 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
docker-jhipster-control-center-1  | 	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
docker-jhipster-control-center-1  | 	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
docker-jhipster-control-center-1  | 	... 41 common frames omitted
docker-jhipster-control-center-1  | Caused by: java.lang.RuntimeException: com.nimbusds.oauth2.sdk.ParseException: Unexpected type of JSON object member with key mtls_endpoint_aliases
docker-jhipster-control-center-1  | 	at org.springframework.security.oauth2.client.registration.ClientRegistrations.parse(ClientRegistrations.java:232)
docker-jhipster-control-center-1  | 	at org.springframework.security.oauth2.client.registration.ClientRegistrations.lambda$oidc$0(ClientRegistrations.java:157)
docker-jhipster-control-center-1  | 	at org.springframework.security.oauth2.client.registration.ClientRegistrations.getBuilder(ClientRegistrations.java:209)
docker-jhipster-control-center-1  | 	... 53 common frames omitted
docker-jhipster-control-center-1  | Caused by: com.nimbusds.oauth2.sdk.ParseException: Unexpected type of JSON object member with key mtls_endpoint_aliases
docker-jhipster-control-center-1  | 	at com.nimbusds.oauth2.sdk.util.JSONObjectUtils.getGeneric(JSONObjectUtils.java:161)
docker-jhipster-control-center-1  | 	at com.nimbusds.oauth2.sdk.util.JSONObjectUtils.getJSONObject(JSONObjectUtils.java:827)
docker-jhipster-control-center-1  | 	at com.nimbusds.oauth2.sdk.as.AuthorizationServerMetadata.parse(AuthorizationServerMetadata.java:2042)
docker-jhipster-control-center-1  | 	at com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata.parse(OIDCProviderMetadata.java:1362)
docker-jhipster-control-center-1  | 	at org.springframework.security.oauth2.client.registration.ClientRegistrations.parse(ClientRegistrations.java:229)
docker-jhipster-control-center-1  | 	... 55 common frames omitted

The top of the stack trace is misleading, because I was thinking the container couldn't reach the keycloak container. After adding a delay, connecting, and running curl, it definitely can connect:

docker ps
CONTAINER ID   IMAGE                                     COMMAND                   CREATED         STATUS         PORTS                                                                                                NAMES
7970d9c8fa91   jhipster/jhipster-control-center:v0.5.0   "/bin/sh -c 'echo \"`…"   5 seconds ago   Up 4 seconds   127.0.0.1:7419->7419/tcp                                                                             docker-jhipster-control-center-1
79d813a80176   jboss/keycloak:15.0.2                     "/opt/jboss/tools/do…"    6 seconds ago   Up 5 seconds   8080/tcp, 127.0.0.1:9080->9080/tcp, 127.0.0.1:9443->9443/tcp, 8443/tcp, 127.0.0.1:10990->10990/tcp   docker-keycloak-1
➜  ~ docker exec -it 7970d9c8fa91  /bin/bash
root@7970d9c8fa91:/# curl http://keycloak:9080/auth/realms/jhipster
{"realm":"jhipster","public_key":"....","token-service":"http://keycloak:9080/auth/realms/jhipster/protocol/openid-connect","account-service":"http://keycloak:9080/auth/realms/jhipster/account","tokens-not-before":0}
root@7970d9c8fa91:/#

Further down the stack trace:

docker-jhipster-control-center-1  | Caused by: java.lang.RuntimeException: com.nimbusds.oauth2.sdk.ParseException: Unexpected type of JSON object member with key mtls_endpoint_aliases

I think this could be similar to: jhipster/generator-jhipster#15836 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions