I have upgraded our app from springboot 2.1.4.Release to 2.5.0 and updated relevant jars for running the application. But when I am trying to deploy and run the app in aws ECS , it is giving the following error. But when I deploy the earlier commit (before the upgrade) it is able to deploy fine. It is not able to read the aws Secrets manager to read the values from there. On looking carefully, I found there's a difference in startup of the springboot.
The error in the aws ECS logs:
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cloudPlatformSecuirtyResourceServerConfig': Unsatisfied dependency expressed through field 'uaaResourceInfo'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'UAAResourceInfoConfig': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'moa.aws.secrets.uaa.clientId' in value "${moa.aws.secrets.uaa.clientId}"
The failed startup log for the springboot is:
<html>
<body>
<!--StartFragment-->
2021-08-25T15:23:58.958-04:00 | . ____ _ __ _ _
-- | --
| 2021-08-25T15:23:58.958-04:00 | /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
| 2021-08-25T15:23:58.958-04:00 | ( ( )\___ \| '_ \| '_\| \| '_ \/ _` \| \ \ \ \
| 2021-08-25T15:23:58.958-04:00 | \\/ ___)\| \|_)\| \| \| \| \| \|\| (_\| \| ) ) ) )
| 2021-08-25T15:23:58.958-04:00 | ' \|____\| .__\|_\| \|_\|_\| \|_\__, \| / / / /
| 2021-08-25T15:23:58.958-04:00 | =========\|_\|==============\|___/=/_/_/_/
| 2021-08-25T15:23:58.962-04:00 | :: Spring Boot :: (v2.5.4)
| 2021-08-25T15:23:59.480-04:00 | 2021-08-25 19:23:59 [main] INFO c.g.d.o.m.MoaApplication.logStarting - Starting MoaApplication using Java 1.8.0_212 on ip-10-228-213-136.ec2.internal with PID 1 (/app/bin/app.jar started by appuser in /app/bin)
| 2021-08-25T15:23:59.481-04:00 | 2021-08-25 19:23:59 [main] DEBUG c.g.d.o.m.MoaApplication.logStarting - Running with Spring Boot v2.5.4, Spring v5.3.9
| 2021-08-25T15:23:59.482-04:00 | 2021-08-25 19:23:59 [main] INFO c.g.d.o.m.MoaApplication.logStartupProfileInfo - The following profiles are active: aws,security
| 2021-08-25T15:24:06.781-04:00 | 2021-08-25 19:24:06 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate.registerRepositoriesIn - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
| 2021-08-25T15:24:08.744-04:00 | 2021-08-25 19:24:08 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate.registerRepositoriesIn - Finished Spring Data repository scanning in 1897 ms. Found 29 JPA repository interfaces.
| 2021-08-25T15:24:09.852-04:00 | 2021-08-25 19:24:09 [main] INFO o.s.c.c.s.GenericScope.setSerializationId - BeanFactory id=3f7fcd35-a014-3876-860d-0948165034d3
| 2021-08-25T15:24:12.681-04:00 | 2021-08-25 19:24:12 [main] INFO o.s.b.w.e.t.TomcatWebServer.initialize - Tomcat initialized with port(s): 9090 (http)
| 2021-08-25T15:24:12.766-04:00 | Aug 25, 2021 19:24:12 +0000 [1 1] com.newrelic INFO: Server Info: Apache Tomcat/9.0.52
| 2021-08-25T15:24:12.784-04:00 | 2021-08-25 19:24:12 [main] INFO o.a.c.c.StandardService.log - Starting service [Tomcat]
| 2021-08-25T15:24:12.842-04:00 | 2021-08-25 19:24:12 [main] INFO o.a.c.c.StandardEngine.log - Starting Servlet engine: [Apache Tomcat/9.0.52]
| 2021-08-25T15:24:13.257-04:00 | 2021-08-25 19:24:13 [main] INFO o.a.c.c.C.[.[.[/moa/api/v1].log - Initializing Spring embedded WebApplicationContext
| 2021-08-25T15:24:13.257-04:00 | 2021-08-25 19:24:13 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext.prepareWebApplicationContext - Root WebApplicationContext: initialization completed in 13567 ms
| 2021-08-25T15:24:13.279-04:00 | 2021-08-25 19:24:13 [main] ERROR o.s.b.w.e.t.TomcatStarter.onStartup - Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'cloudPlatformSecuirtyResourceServerConfig': Unsatisfied dependency expressed through field 'uaaResourceInfo'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'UAAResourceInfoConfig': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'moa.aws.secrets.uaa.clientId' in value "${moa.aws.secrets.uaa.clientId}"
| 2021-08-25T15:24:13.641-04:00 | 2021-08-25 19:24:13 [main] INFO o.a.c.c.StandardService.log - Stopping service [Tomcat]
| 2021-08-25T15:24:13.974-04:00 | 2021-08-25 19:24:13 [main] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext.refresh - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
| 2021-08-25T15:24:14.044-04:00 | 2021-08-25 19:24:14 [main] INFO o.s.b.a.l.ConditionEvaluationReportLoggingListener.logMessage -
| 2021-08-25T15:24:14.044-04:00 | Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
| 2021-08-25T15:24:14.147-04:00 | 2021-08-25 19:24:14 [main] ERROR o.s.b.SpringApplication.reportFailure - Application run failed
| 2021-08-25T15:24:14.147-04:00 | org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:163)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332)
| 2021-08-25T15:24:14.147-04:00 | at com.ge.digital.oa.moa.MoaApplication.main(MoaApplication.java:16)
| 2021-08-25T15:24:14.147-04:00 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 2021-08-25T15:24:14.147-04:00 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
| 2021-08-25T15:24:14.147-04:00 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| 2021-08-25T15:24:14.147-04:00 | at java.lang.reflect.Method.invoke(Method.java:498)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
| 2021-08-25T15:24:14.147-04:00 | Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:450)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:199)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:182)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:160)
| 2021-08-25T15:24:14.147-04:00 | ... 16 common frames omitted
| 2021-08-25T15:24:14.147-04:00CopyCaused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cloudPlatformSecuirtyResourceServerConfig': Unsatisfied dependency expressed through field 'uaaResourceInfo'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'UAAResourceInfoConfig': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'moa.aws.secrets.uaa.clientId' in value "${moa.aws.secrets.uaa.clientId}" | Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cloudPlatformSecuirtyResourceServerConfig': Unsatisfied dependency expressed through field 'uaaResourceInfo'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'UAAResourceInfoConfig': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'moa.aws.secrets.uaa.clientId' in value "${moa.aws.secrets.uaa.clientId}"
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1413)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:410)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:212)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:203)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addServletContextInitializerBeans(ServletContextInitializerBeans.java:97)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.web.servlet.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:86)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:260)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:234)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.web.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:53)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5219)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
| 2021-08-25T15:24:14.147-04:00 | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
| 2021-08-25T15:24:14.147-04:00 | at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
| 2021-08-25T15:24:14.147-04:00 | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
| 2021-08-25T15:24:14.147-04:00 | at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:263)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:927)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
| 2021-08-25T15:24:14.147-04:00 | at org.apache.catalina.startup.Tomcat.start(Tomcat.java:486)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123)
| 2021-08-25T15:24:14.147-04:00 | ... 21 common frames omitted
| 2021-08-25T15:24:14.147-04:00CopyCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'UAAResourceInfoConfig': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'moa.aws.secrets.uaa.clientId' in value "${moa.aws.secrets.uaa.clientId}" | Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'UAAResourceInfoConfig': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'moa.aws.secrets.uaa.clientId' in value "${moa.aws.secrets.uaa.clientId}"
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1413)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:410)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:657)
| 2021-08-25T15:24:14.147-04:00 | ... 71 common frames omitted
| 2021-08-25T15:24:14.147-04:00CopyCaused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'moa.aws.secrets.uaa.clientId' in value "${moa.aws.secrets.uaa.clientId}" | Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'moa.aws.secrets.uaa.clientId' in value "${moa.aws.secrets.uaa.clientId}"
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:180)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:239)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.core.env.AbstractPropertyResolver.resolveNestedPlaceholders(AbstractPropertyResolver.java:230)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.context.properties.source.ConfigurationPropertySourcesPropertyResolver.getProperty(ConfigurationPropertySourcesPropertyResolver.java:79)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.boot.context.properties.source.ConfigurationPropertySourcesPropertyResolver.getProperty(ConfigurationPropertySourcesPropertyResolver.java:60)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.core.env.AbstractEnvironment.getProperty(AbstractEnvironment.java:588)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.context.support.PropertySourcesPlaceholderConfigurer$1.getProperty(PropertySourcesPlaceholderConfigurer.java:137)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.context.support.PropertySourcesPlaceholderConfigurer$1.getProperty(PropertySourcesPlaceholderConfigurer.java:133)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:85)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.core.env.PropertySourcesPropertyResolver.getPropertyAsRawString(PropertySourcesPropertyResolver.java:74)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:153)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:239)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:936)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1321)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:657)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
| 2021-08-25T15:24:14.147-04:00 | at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
| 2021-08-25T15:24:14.147-04:00 | ... 91 common frames omitted
| 2021-08-25T15:24:14.149-04:00 | Aug 25, 2021 19:24:14 +0000 [1 6] com.newrelic.agent.Agent INFO: JVM is shutting down
| 2021-08-25T15:24:14.156-04:00 | Aug 25, 2021 19:24:14 +0000 [1 6] com.newrelic.agent.Agent INFO: New Relic Agent has shutdown
<!--EndFragment-->
</body>
</html>
The only difference I can see between the successful deployment and failed deployment is, the container is loading and initializing the PropertySourceBootstrapConfiguration bean by itself for successful deployment
This is linked to the same question asked by me in this post but the suggestion didnt help much. https://stackoverflow.com/questions/68914818/upgrading-from-springboot-2-1-4-release-to-2-5-0-is-giving-illegal-runtime-excep/68919045?noredirect=1#comment121808996_68919045
Below is the build.gradle: ( Anything after the //OSS Scan fix comment is added extra in this upgrade commit)
buildscript {
ext {
springBootVersion = '2.5.0'
}
repositories {
mavenCentral()
jcenter()
maven {
url "https://artifactory.build.ge.com/ARJLY"
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
name = "oa-publish-repo"
}
maven { url "https://repo.spring.io/plugins-release" }
maven { url "https://repo.spring.io/libs-release" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
//docker
classpath('se.transmode.gradle:gradle-docker:1.2')
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'maven-publish'
apply plugin: 'distribution'
apply plugin: 'application'
apply plugin: 'docker'
apply plugin: 'jacoco'
group = 'com.ge.digital.oa.moa'
archivesBaseName = 'moa-svc'
sourceCompatibility = 1.8
wrapper {
gradleVersion = '6.8'
}
//dependencyManagement {
// imports {
// mavenBom 'org.springframework.cloud:spring-cloud-aws:2.0.1.RELEASE'
// }
//}
repositories {
mavenCentral()
add buildscript.repositories.getByName("oa-publish-repo")
maven { url "https://repo.spring.io/libs-release" }
}
mainClassName = "com.ge.digital.oa.moa.MoaApplication"
eclipse {
classpath {
downloadSources = true
}
}
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}
sourceSets {
generated
}
sourceSets.generated.java.srcDirs = ['src/main/generated']
configurations{
querydslapt
}
dependencies {
implementation('com.ge.digital.oa.common:oa-common:3.0.0') {
exclude module: 'slf4j-log4j12'
exclude group: 'io.micrometer', module: 'micrometer-core'
exclude group: 'org.springframework.hateoas', module: 'spring-hateoas'
exclude group: 'org.springframework.cloud', module: 'spring-cloud-context'
}
//implementation('org.springframework.security:spring-security-oauth2-client')
implementation('org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.5.0')
implementation('org.springframework.boot:spring-boot-starter-web')
implementation('org.springframework.boot:spring-boot-starter-webflux')
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
implementation('org.apache.commons:commons-lang3');
implementation('commons-fileupload:commons-fileupload:1.4')
implementation("com.h2database:h2")
implementation('org.postgresql:postgresql:42.2.13')
compileOnly('org.projectlombok:lombok')
annotationProcessor('org.projectlombok:lombok')
implementation('org.springframework.boot:spring-boot-starter-actuator')
implementation("org.flywaydb:flyway-core")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.junit.jupiter:junit-jupiter-engine")
developmentOnly("org.springframework.boot:spring-boot-devtools")
implementation('com.opencsv:opencsv:5.5')
compile ("org.apache.commons:commons-csv:1.5")
compile("com.querydsl:querydsl-core:4.2.1")
compile("com.querydsl:querydsl-jpa:4.2.1")
compile("com.querydsl:querydsl-apt:4.2.1:jpa")
annotationProcessor(
"javax.persistence:javax.persistence-api",
"com.querydsl:querydsl-apt:4.2.1:jpa"
)
implementation("org.hibernate:hibernate-envers:5.4.31.Final")
// https://mvnrepository.com/artifact/com.vladmihalcea/hibernate-types-52
implementation group: 'com.vladmihalcea', name: 'hibernate-types-52', version: '2.10.3'
//OSS Scan fix
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-validation
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation', version: '2.5.0'
// https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-context
implementation group: 'org.springframework.cloud', name: 'spring-cloud-context', version: '3.0.0'
// https://mvnrepository.com/artifact/commons-io/commons-io
implementation group: 'commons-io', name: 'commons-io', version: '2.7'
// https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on
implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.64'
// https://mvnrepository.com/artifact/com.google.guava/guava
implementation group: 'com.google.guava', name: 'guava', version: '30.0-jre'
// https://mvnrepository.com/artifact/org.springframework.security.oauth/spring-security-oauth2
//implementation group: 'org.springframework.security.oauth', name: 'spring-security-oauth2', version: '2.3.6.RELEASE'
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.12.0'
// https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-aws-secrets-manager-config
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-aws-secrets-manager-config', version: '2.2.6.RELEASE'
compile group: 'com.amazonaws', name: 'aws-java-sdk-secretsmanager', version: '1.11.355'
Here is my application.yml for the AWS deployment
ignoreSiteHeader: true
ignoreTenantHeader: true
server:
port: 9090
compression:
enabled: true
mime-types: text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json
min-response-size: 1024
servlet:
context-path: /moa/api/v1/
spring:
application:
name: moa-svc
flyway:
locations:
- classpath:db/migration
schemas:
- moa
datasource:
url: ${moa.aws.secrets.moa.db_url}
username: ${moa.aws.secrets.moa.db_username}
password: ${moa.aws.secrets.moa.db_password}
driver-class-name: org.postgresql.Driver
hikari:
maximum-pool-size: 25
mvc:
date-format: yyyy-MM-dd
jpa:
open-in-view: false
database-platform: org.hibernate.dialect.PostgreSQL95Dialect
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQL95Dialect
temp.use_jdbc_metadata_defaults: false
order_inserts: true
order_updates: true
jdbc:
time_zone: UTC
batch_size: 50
batch_versioned_data: true
lob:
non_contextual_creation: true
org:
hibernate:
envers:
audit_strategy: org.hibernate.envers.strategy.ValidityAuditStrategy
track_entities_changed_in_revision: false
audit_strategy_validity_store_revend_timestamp: true
hibernate:
ddl-auto: none
logging:
level:
.: info
root: info
pattern:
console: '%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{5}.%M - %msg%n'
ups:
security:
root: OA.MOA
app:
domain: ${ups.app.domain}
path: /ups/api/v1/
uaa:
accessTokenURI: ${uaa.accessTokenURI}
clientId: ${moa.aws.secrets.uaa.clientId}
clientSecret: ${moa.aws.secrets.uaa.clientSecret}
clientScope: oa.ups.reader,uaa.resource
---
spring:
config:
activate:
on-profile: local
main:
allow-bean-definition-overriding: true
jpa:
show-sql: false
logging:
level:
.: info
root: info
com.ge.digital: debug
# org.hibernate.type.descriptor.sql: trace
---
spring:
config:
activate:
on-profile: aws
use-legacy-processing: true
main:
allow-bean-definition-overriding: true
Comment From: snicoll
This is linked to the same question asked by me in this post but didnt get any resposne
You did get a response though. Some changes are required to upgrade from Spring Boot 2.1.x to 2.5.x and legacy processing can be used to validate that the issue you're experiencing is related to the configuration change. Please review the release notes and, in particular, the Config Data Migration Guide.
We can't provide support based on some logs and a build snippet. If reviewing the above did not help you, please share a sample sample that reproduces the problem you're experiencing. You can do so by attaching the zip of the project here or sharing the link to a GitHub repository.
Comment From: romit7
Yeah...I tried suggestion in the StackOverFlow by adding the legacy-processing= true in application.yml file ...but I am getting the same issue..but when I deploy 2.1.4.Release spring boot...it deploys fine...The only difference in startup is the 2.1.4container loads the propertySourceBootstrapConfiguration bean automatically on startup where as for 2.5.0 it doesnot and that causes the problem on finding the placeholder @Value in application.yml file
Comment From: philwebb
I'm afraid we can't diagnose the problem from the limited information provided by the logs. You should start by upgrading to the latest patch releases of Spring Boot (v2.5.4). If that doesn't help, please provide a sample application that replicates the issue.
Comment From: romit7
@philwebb Thnx for the suggestion , the problem is it is running fine on local..as I am giving the value in the application.properties file..but when I am trying to deploy in AWS ECS ..that is when it is not able to resolve the placeholder in application.yml...I have updated the spring to 2.5.4 (as you suggested) and updated my post with the complete log from AWS ...kindly see if you can give some pointers and also given my application.yml
Comment From: scottfrederick
In the SO post, you said in a comment:
in local I am giving the value in application.properties but in aws ECS it should resolve that path in application.yml and read from the secrets manager
Spring Boot does not have any integration with AWS Secrets Manager. Your build.gradle
shows a dependency on org.springframework.cloud:spring-cloud-starter-aws-secrets-manager-config:2.2.6.RELEASE
and it's more likely the root cause of this problem is in that project. Version 2.3.0
is the latest version of Spring Cloud AWS and might support Spring Boot 2.5.x better than 2.2.6.RELEASE
does. If upgrading Spring Cloud AWS doesn't help, please open an issue in Spring Cloud AWS. We can re-open this issue if investigation by the Spring Cloud AWS team indicates there's something Boot needs to do.