AIP CONSOLE - Running AIP Console/Node Services - Error creating bean with name clientRegistrationRepository defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/reactive/ReactiveOAuth2ClientConfigurations

While starting the AIP node and AIP console services, the services are not coming up and when checking the AIP Node logs and Console logs, the below error stack is seen:

ERROR STACK in GATEWAY and NODE logs:

2024-08-12 10:38:27.627 ERROR 7488 --- [main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jsonErrorWebFluxAutoConfiguration' defined in URL [jar:file:/C:/Program%20Files/Cast/AIP-Gateway/bin/aip-gateway-app.jar!/BOOT-INF/classes!/com/castsoftware/aip/gateway/JsonErrorWebFluxAutoConfiguration.class]: Unsatisfied dependency expressed through constructor parameter 3; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration$EnableWebFluxConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.config.annotation.web.reactive.ReactiveOAuth2ClientImportSelector$OAuth2ClientWebFluxSecurityConfiguration': Unsatisfied dependency expressed through method 'setClientRegistrationRepository' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientRegistrationRepository' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/reactive/ReactiveOAuth2ClientConfigurations$ReactiveClientRegistrationRepositoryConfiguration.class]: Bean instantiation via factory method failed; nested exception is 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://HOSTNAME:8086/auth/realms/aip-realm"
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:801) ~[spring-beans-5.3.31.jar!/:5.3.31]
	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:224) ~[spring-beans-5.3.31.jar!/:5.3.31]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) ~[spring-beans-5.3.31.jar!/:5.3.31]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) ~[spring-beans-5.3.31.jar!/:5.3.31]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.31.jar!/:5.3.31]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.31.jar!/:5.3.31]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.31.jar!/:5.3.31]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.31.jar!/:5.3.31]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.31.jar!/:5.3.31]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.31.jar!/:5.3.31]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) ~[spring-beans-5.3.31.jar!/:5.3.31]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:929) ~[spring-context-5.3.31.jar!/:5.3.31]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:591) ~[spring-context-5.3.31.jar!/:5.3.31]
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66) ~[spring-boot-2.7.18.jar!/:2.7.18]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[spring-boot-2.7.18.jar!/:2.7.18]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:409) ~[spring-boot-2.7.18.jar!/:2.7.18]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.18.jar!/:2.7.18]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300) ~[spring-boot-2.7.18.jar!/:2.7.18]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1289) ~[spring-boot-2.7.18.jar!/:2.7.18]
	at com.castsoftware.aip.gateway.AipGatewayApplication.main(AipGatewayApplication.java:13) ~[classes!/:2.11.7]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[aip-gateway-app.jar:2.11.7]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[aip-gateway-app.jar:2.11.7]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[aip-gateway-app.jar:2.11.7]
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65) ~[aip-gateway-app.jar:2.11.7]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration$EnableWebFluxConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.config.annotation.web.reactive.ReactiveOAuth2ClientImportSelector$OAuth2ClientWebFluxSecurityConfiguration': Unsatisfied dependency expressed through method 'setClientRegistrationRepository' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientRegistrationRepository' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/reactive/ReactiveOAuth2ClientConfigurations$ReactiveClientRegistrationRepositoryConfiguration.class]: Bean instantiation via factory method failed; nested exception is 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://HOSTNAME:8086/auth/realms/aip-realm"
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments(AutowiredAnnotationBeanPostProcessor.java:824) ~[spring-beans-5.3.31.jar!/:5.3.31

 

Observed in AIP console versions

AIP Console 2.x.x

Observed in RDBMS

RDBMS

Yes/No

CSS3

N/A

CSS4

N/A 

Step by Step scenario

 1. Install Cast AIP Console.

2. Start service registry/SSO.

3. Start Gateway and Node services. Fail with the error stack mentioned above.

Action Plan

The issue here comes from the HTTPS/SSL Config settings in the Keycloak, as the config is

set for SSL and URL is HTTP and there is no certificate, which creates chaos in the initialization of parameters

thus failing the Gateway and the node services.

 

Perform the below actions:

To turn off SSL in Keycloak from the GUI (Admin Console), follow the below steps:

Steps to Disable SSL in Keycloak via Admin Console

  1. Login to the Admin Console:

    • Open your web browser and go to your Keycloak Admin Console URL (e.g., https://<your-keycloak-server>/auth/admin/).

    • Log in with your admin credentials.

  2. Navigate to the Realm Settings:

    • In the left-hand menu, click on "Realm Settings" under the realm you want to configure.

  3. Go to the "Login" Tab:

    • After entering the Realm Settings, click on the "Login" tab at the top.

  4. Change the SSL Required Setting:

    • Find the "Require SSL" dropdown menu.

    • Change the setting from "all requests" or "external requests" to "none".

  5. Save the Changes:

    • Scroll to the bottom and click "Save".

  6. Restart the Keycloak Server (if needed):

    • Depending on your setup, you may need to restart the Keycloak server for the changes to take effect.

  7. Now Start the AIP Gateway and the AIP Node services.

Relevant input

  • CAST AIP Console Logs

  • Detail of specific steps done

  • Any applicable screenshots

Notes/comments

Ticket # 48770

 

 

 

Have more questions? Submit a request

Comments

Powered by Zendesk