1

After updating from Spring boot 2.1.13 to the latest 2.2.5 Some of my Tomcat applications are failing to deploy to cloud foundry.

The error message in the logs

   2020-03-23T13:13:34.84-0400 [APP/PROC/WEB/0] OUT 2020-03-23 17:13:34.848  WARN 28 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.springframework.boot.autoconfigure.security.oauth2.OAuth2AutoConfiguration]; nested exception is java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2RestOperationsConfiguration$RequestScopedConfiguration
   2020-03-23T13:13:34.85-0400 [APP/PROC/WEB/0] OUT 2020-03-23 17:13:34.859  INFO 28 --- [           main] ConditionEvaluationReportLoggingListener :
   2020-03-23T13:13:34.85-0400 [APP/PROC/WEB/0] OUT Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT 2020-03-23 17:13:34.865 ERROR 28 --- [           main] o.s.boot.SpringApplication               : Application run failed
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.springframework.boot.autoconfigure.security.oauth2.OAuth2AutoConfiguration]; nested exception is java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2RestOperationsConfiguration$RequestScopedConfiguration
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:609)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:310)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:249)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:599)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser.access$800(ConfigurationClassParser.java:110)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.lambda$processGroupImports$1(ConfigurationClassParser.java:811)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at java.util.ArrayList.forEach(ArrayList.java:1257)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:808)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:779)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:192)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:319)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at com.kroger.cxp.app.PythonApplication.main(PythonApplication.java:11)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at java.lang.reflect.Method.invoke(Method.java:498)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT Caused by: java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2RestOperationsConfiguration$RequestScopedConfiguration
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:225)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser.processMemberClasses(ConfigurationClassParser.java:371)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:271)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:249)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:599)
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT     ... 30 common frames omitted
   2020-03-23T13:13:34.86-0400 [APP/PROC/WEB/0] OUT Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'vcap.services.oauth.credentials.clientId' in value "${vcap.services.oauth.credentials.clientId}"

This only happens when deploying to CF, and only after the upgrade. I verified that nothing in the properties has changed, and the user provided services do have the correct values.

ndrone
  • 3,524
  • 2
  • 23
  • 37
  • How do you provide the `${vcap.services.oauth.credentials.clientId}` value? Properties-file, startup parameter, environment variable etc? If you're using `application-.yml` (or `.properties`) make sure the profile is active. – Misantorp Mar 23 '20 at 19:30
  • application.yml with profile. Yes the profile is active because it's pulling the correct UPS definition key – ndrone Mar 23 '20 at 21:30

1 Answers1

1

This is a known issue introduced in Spring Boot 2.2.5.RELEASE. It will be fixed in 2.2.6.RELEASE, which is currently scheduled for release on 26 March 2020. For now you can back the Spring Boot version off to 2.2.4.RELEASE.

Scott Frederick
  • 4,184
  • 19
  • 22