Skip to content

App Fails to Start with ClassNotFoundException on org.springframework.security.oauth2.client.registration.ClientRegistrationRepository #10

Open
@smoothed9

Description

@smoothed9

Hi
I checked out the project and followed the steps as given in the README. I created a Cosmos DB before the deploy step. The Service Binding was created through Portal and not using the command given in the README. After the service binding was created, the app was restarted through CLI. It never started and on connecting the app to Log Analytics, I could see the below entries.


2019-12-26 17:54:30.748 INFO 1 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : https://service-binding-cosmosdb.svc.azuremicroservices.io/config |  
-- | --
  | 2019-12-26 17:54:31.987 INFO 1 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=app-service-binding-cosmosdb, profiles=[default], label=null, version=null, state=null |  
  | 2019-12-26 17:54:31.988 INFO 1 --- [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='configService', propertySources=[]} |  
  | 2019-12-26 17:54:31.995 INFO 1 --- [ main] c.m.a.ServiceBindingCosmosDbApplication : No active profile set, falling back to default profiles: default |  
  | 2019-12-26 17:54:34.356 ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed |  
  |   |  
  | java.lang.IllegalStateException: Error processing condition on com.microsoft.azure.spring.autoconfigure.b2c.AADB2CAutoConfiguration$AADB2COidcAutoConfiguration.clientRegistrationRepository |  
  | at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60) ~[spring-boot-autoconfigure-2.1.7.RELEASE.jar!/:2.1.7.RELEASE] |  
  | at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108) ~[spring-context-5.1.9.RELEASE.jar!/:5.1.9.RELEASE] |  
  | at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:181) ~[spring-context-5.1.9.RELEASE.jar!/:5.1.9.RELEASE] |  
  | at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:141) ~[spring-context-5.1.9.RELEASE.jar!/:5.1.9.RELEASE] |  
  | at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117) ~[spring-context-5.1.9.RELEASE.jar!/:5.1.9.RELEASE] |  
  | at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:327) ~[spring-context-5.1.9.RELEASE.jar!/:5.1.9.RELEASE] |  
  | at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232) ~[spring-context-5.1.9.RELEASE.jar!/:5.1.9.RELEASE] |  
  | at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[spring-context-5.1.9.RELEASE.jar!/:5.1.9.RELEASE] |  
  | at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[spring-context-5.1.9.RELEASE.jar!/:5.1.9.RELEASE] |  
  | at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705) ~[spring-context-5.1.9.RELEASE.jar!/:5.1.9.RELEASE] |  
  | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) ~[spring-context-5.1.9.RELEASE.jar!/:5.1.9.RELEASE] |  
  | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.1.7.RELEASE.jar!/:2.1.7.RELEASE] |  
  | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:743) [spring-boot-2.1.7.RELEASE.jar!/:2.1.7.RELEASE] |  
  | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:390) [spring-boot-2.1.7.RELEASE.jar!/:2.1.7.RELEASE] |  
  | at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.7.RELEASE.jar!/:2.1.7.RELEASE] |  
  | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1214) [spring-boot-2.1.7.RELEASE.jar!/:2.1.7.RELEASE] |  
  | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1203) [spring-boot-2.1.7.RELEASE.jar!/:2.1.7.RELEASE] |  
  | at com.microsoft.azure.ServiceBindingCosmosDbApplication.main(ServiceBindingCosmosDbApplication.java:29) [classes!/:0.1.0] |  
  | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_232] |  
  | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_232] |  
  | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_232] |  
  | at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_232] |  
  | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [a9c8d9ae-5ec2-43bd-9970-11455bd36363:0.1.0] |  
  | at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [a9c8d9ae-5ec2-43bd-9970-11455bd36363:0.1.0] |  
  | at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) [a9c8d9ae-5ec2-43bd-9970-11455bd36363:0.1.0] |  
  | at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) [a9c8d9ae-5ec2-43bd-9970-11455bd36363:0.1.0] |  
  | Caused by: java.lang.IllegalStateException: @ConditionalOnMissingBean did not specify a bean using type, name or annotation and the attempt to deduce the bean's type failed |  
  | at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.validate(OnBeanCondition.java:409) ~[spring-boot-autoconfigure-2.1.7.RELEASE.jar!/:2.1.7.RELEASE] |  
  | at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.<init>(OnBeanCondition.java:400) ~[spring-boot-autoconfigure-2.1.7.RELEASE.jar!/:2.1.7.RELEASE] |  
  | at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.<init>(OnBeanCondition.java:375) ~[spring-boot-autoconfigure-2.1.7.RELEASE.jar!/:2.1.7.RELEASE] |  
  | at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:144) ~[spring-boot-autoconfigure-2.1.7.RELEASE.jar!/:2.1.7.RELEASE] |  
  | at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[spring-boot-autoconfigure-2.1.7.RELEASE.jar!/:2.1.7.RELEASE] |  
  | ... 25 common frames omitted |  
  | Caused by: org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanTypeDeductionException: Failed to deduce bean type for com.microsoft.azure.spring.autoconfigure.b2c.AADB2CAutoConfiguration$AADB2COidcAutoConfiguration.clientRegistrationRepository |  
  | at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.addDeducedBeanTypeForBeanMethod(OnBeanCondition.java:449) ~[spring-boot-autoconfigure-2.1.7.RELEASE.jar!/:2.1.7.RELEASE] |  
  | at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.addDeducedBeanType(OnBeanCondition.java:438) ~[spring-boot-autoconfigure-2.1.7.RELEASE.jar!/:2.1.7.RELEASE] |  
  | at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.<init>(OnBeanCondition.java:394) ~[spring-boot-autoconfigure-2.1.7.RELEASE.jar!/:2.1.7.RELEASE] |  
  | ... 28 common frames omitted |  
  | Caused by: java.lang.ClassNotFoundException: org.springframework.security.oauth2.client.registration.ClientRegistrationRepository |  
  | at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_232] |  
  | at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_232] |  
  | at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:93) ~[a9c8d9ae-5ec2-43bd-9970-11455bd36363:0.1.0] |  
  | at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_232] |  
  | at java.lang.Class.forName0(Native Method) ~[na:1.8.0_232] |  
  | at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_232] |  
  | at org.springframework.util.ClassUtils.forName(ClassUtils.java:275) ~[spring-core-5.1.9.RELEASE.jar!/:5.1.9.RELEASE] |  
  | at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.getReturnType(OnBeanCondition.java:458) ~[spring-boot-autoconfigure-2.1.7.RELEASE.jar!/:2.1.7.RELEASE] |  
  | at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.addDeducedBeanTypeForBeanMethod(OnBeanCondition.java:445) ~[spring-boot-autoconfigure-2.1.7.RELEASE.jar!/:2.1.7.RELEASE] |  
  | ... 30 common frames omitted

Do I need to manually add any dependencies to the pom? Based on the instructions, I was expecting the app to work as it is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions