无法使用spring-security-oauth2和Tomcat从CF解析ClientId



从Spring boot 2.1.13更新到最新的2.2.5之后,我的一些Tomcat应用程序无法部署到云铸造。

日志中的错误消息

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}"

这种情况仅在部署到CF时发生,并且仅在升级后发生。我验证了属性中没有任何更改,并且用户提供的服务具有正确的值。

这是Spring Boot2.2.5.RELEASE中引入的一个已知问题。它将在2.2.6.RELEASE中修复,目前计划于2020年3月26日发布。现在,您可以将Spring Boot版本回退到2.2.4.RELEASE

相关内容

  • 没有找到相关文章

最新更新