spring-projects/spring-credhub

spring-credhub-demo fails to deploy

joe-penske opened this issue · 5 comments

trying to deploy spring-credhub-demo on PCF and it fails with the following error:

   2020-10-14T21:46:25.21+0000 [APP/PROC/WEB/0] OUT JVM Memory Configuration: -Xmx445227K -Xss1M -XX:ReservedCodeCacheSize=240M -XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=91348K
   2020-10-14T21:46:27.84+0000 [APP/PROC/WEB/0] OUT   .   ____          _            __ _ _
   2020-10-14T21:46:27.84+0000 [APP/PROC/WEB/0] OUT  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
   2020-10-14T21:46:27.84+0000 [APP/PROC/WEB/0] OUT ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
   2020-10-14T21:46:27.84+0000 [APP/PROC/WEB/0] OUT  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
   2020-10-14T21:46:27.84+0000 [APP/PROC/WEB/0] OUT   '  |____| .__|_| |_|_| |_\__, | / / / /
   2020-10-14T21:46:27.84+0000 [APP/PROC/WEB/0] OUT  =========|_|==============|___/=/_/_/_/
   2020-10-14T21:46:27.85+0000 [APP/PROC/WEB/0] OUT  :: Spring Boot ::        (v2.0.6.RELEASE)
   2020-10-14T21:46:28.22+0000 [APP/PROC/WEB/0] OUT 2020-10-14 21:46:28.216  INFO 23 --- [           main] pertySourceApplicationContextInitializer : 'cloud' property source added
   2020-10-14T21:46:28.22+0000 [APP/PROC/WEB/0] OUT 2020-10-14 21:46:28.224  INFO 23 --- [           main] nfigurationApplicationContextInitializer : Reconfiguration enabled
   2020-10-14T21:46:28.24+0000 [APP/PROC/WEB/0] OUT 2020-10-14 21:46:28.241  INFO 23 --- [           main] o.s.credhub.demo.Application             : Starting Application on a43abc4e-ea6a-4e63-6910-b7ed with PID 23 (/home/vcap/app/BOOT-INF/classes started by vcap in /home/vcap/app)
   2020-10-14T21:46:28.24+0000 [APP/PROC/WEB/0] OUT 2020-10-14 21:46:28.244  INFO 23 --- [           main] o.s.credhub.demo.Application             : The following profiles are active: cloud
   2020-10-14T21:46:28.34+0000 [APP/PROC/WEB/0] OUT 2020-10-14 21:46:28.343  INFO 23 --- [           main] onfigReactiveWebServerApplicationContext : Refreshing org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext@6a38e57f: startup date [Wed Oct 14 21:46:28 UTC 2020]; root of context hierarchy
   2020-10-14T21:46:28.97+0000 [APP/PROC/WEB/0] OUT 2020-10-14 21:46:28.974  WARN 23 --- [           main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.springframework.credhub.demo.Application]; nested exception is java.lang.IllegalArgumentException: Could not find class [org.springframework.boot.autoconfigure.security.oauth2.client.ClientsConfiguredCondition]
   2020-10-14T21:46:28.98+0000 [APP/PROC/WEB/0] OUT 2020-10-14 21:46:28.988  INFO 23 --- [           main] ConditionEvaluationReportLoggingListener :
   2020-10-14T21:46:28.98+0000 [APP/PROC/WEB/0] OUT Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT 2020-10-14 21:46:28.995 ERROR 23 --- [           main] o.s.boot.SpringApplication               : Application run failed
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.springframework.credhub.demo.Application]; nested exception is java.lang.IllegalArgumentException: Could not find class [org.springframework.boot.autoconfigure.security.oauth2.client.ClientsConfiguredCondition]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:646) ~[spring-context-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser.lambda$processDeferredImportSelectors$2(ConfigurationClassParser.java:566) ~[spring-context-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at java.util.ArrayList.forEach(ArrayList.java:1259) ~[na:1.8.0_265]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:563) ~[spring-context-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:188) ~[spring-context-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:316) ~[spring-context-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233) ~[spring-context-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:271) ~[spring-context-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:91) ~[spring-context-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:692) ~[spring-context-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:530) ~[spring-context-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:67) ~[spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) [spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242) [spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230) [spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.credhub.demo.Application.main(Application.java:26) [classes/:na]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_265]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_265]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_265]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_265]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [app/:na]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [app/:na]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [app/:na]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [app/:na]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT Caused by: java.lang.IllegalArgumentException: Could not find class [org.springframework.boot.autoconfigure.security.oauth2.client.ClientsConfiguredCondition]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:314) ~[spring-core-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConditionEvaluator.getCondition(ConditionEvaluator.java:124) ~[spring-context-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:96) ~[spring-context-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:221) ~[spring-context-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:636) ~[spring-context-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     ... 25 common frames omitted
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT Caused by: java.lang.ClassNotFoundException: org.springframework.boot.autoconfigure.security.oauth2.client.ClientsConfiguredCondition
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_265]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_265]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:93) ~[app/:na]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_265]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.util.ClassUtils.forName(ClassUtils.java:275) ~[spring-core-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:311) ~[spring-core-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
   2020-10-14T21:46:28.99+0000 [APP/PROC/WEB/0] OUT     ... 29 common frames omitted
   2020-10-14T21:46:29.03+0000 [APP/PROC/WEB/0] OUT Exit status 1
   2020-10-14T21:46:29.04+0000 [CELL/SSHD/0] OUT Exit status 0
   2020-10-14T21:46:34.32+0000 [CELL/0] OUT Cell 6f548901-2590-4dcf-b6da-47b3920771d4 stopping instance a43abc4e-ea6a-4e63-6910-b7ed
   2020-10-14T21:46:34.32+0000 [CELL/0] OUT Cell 6f548901-2590-4dcf-b6da-47b3920771d4 destroying container for instance a43abc4e-ea6a-4e63-6910-b7ed
   2020-10-14T21:46:34.32+0000 [API/4] OUT Process has crashed with type: "web"
   2020-10-14T21:46:34.34+0000 [API/4] OUT App instance exited with guid 0115eec1-2e4a-4f6b-99f2-5d7e4f62fe31 payload: {"instance"=>"a43abc4e-ea6a-4e63-6910-b7ed", "index"=>0, "cell_id"=>"6f548901-2590-4dcf-b6da-47b3920771d4", "reason"=>"CRASHED", "exit_description"=>"APP/PROC/WEB: Exited with status 1", "crash_count"=>1, "crash_timestamp"=>1602711994298684509, "version"=>"e21ec98e-c439-4352-a002-9d1b454a0fca"}

@joe-penske The spring-credhub-demo module build has fallen behind the rest of the project a bit. Can you try updating a few versions in the build file as shown below and try again?

  • springBootVersion = "2.2.6.RELEASE" (here)
  • compile("org.springframework.credhub:spring-credhub-starter:2.1.1.RELEASE") (here)

Thank you very much @scottfrederick for your response. I updated both versions and tried redeploying to PCF. Now it produces a different error. Truly appreciate you looking into this.

2020-10-15T15:44:31.52+0000 [APP/PROC/WEB/0] OUT JVM Memory Configuration: -Xmx441590K -Xss1M -XX:ReservedCodeCacheSize=240M -XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=94985K
   2020-10-15T15:44:34.03+0000 [APP/PROC/WEB/0] OUT   .   ____          _            __ _ _
   2020-10-15T15:44:34.03+0000 [APP/PROC/WEB/0] OUT  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
   2020-10-15T15:44:34.03+0000 [APP/PROC/WEB/0] OUT ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
   2020-10-15T15:44:34.03+0000 [APP/PROC/WEB/0] OUT  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
   2020-10-15T15:44:34.04+0000 [APP/PROC/WEB/0] OUT   '  |____| .__|_| |_|_| |_\__, | / / / /
   2020-10-15T15:44:34.04+0000 [APP/PROC/WEB/0] OUT  =========|_|==============|___/=/_/_/_/
   2020-10-15T15:44:34.04+0000 [APP/PROC/WEB/0] OUT  :: Spring Boot ::        (v2.2.6.RELEASE)
   2020-10-15T15:44:34.34+0000 [APP/PROC/WEB/0] OUT 2020-10-15 15:44:34.341  INFO 20 --- [           main] pertySourceApplicationContextInitializer : 'cloud' property source added
   2020-10-15T15:44:34.35+0000 [APP/PROC/WEB/0] OUT 2020-10-15 15:44:34.356  INFO 20 --- [           main] nfigurationApplicationContextInitializer : Reconfiguration enabled
   2020-10-15T15:44:34.37+0000 [APP/PROC/WEB/0] OUT 2020-10-15 15:44:34.371  INFO 20 --- [           main] o.s.credhub.demo.Application             : Starting Application on 77e3fd88-a493-43d4-4d0d-19de with PID 20 (/home/vcap/app/BOOT-INF/classes started by vcap in /home/vcap/app)
   2020-10-15T15:44:34.37+0000 [APP/PROC/WEB/0] OUT 2020-10-15 15:44:34.372  INFO 20 --- [           main] o.s.credhub.demo.Application             : The following profiles are active: cloud
   2020-10-15T15:44:36.22+0000 [APP/PROC/WEB/0] OUT 2020-10-15 15:44:36.228  WARN 20 --- [           main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'credHubDemoController' defined in file [/home/vcap/app/BOOT-INF/classes/org/springframework/credhub/demo/CredHubDemoController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.credhub.core.CredHubOperations' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
   2020-10-15T15:44:36.33+0000 [APP/PROC/WEB/0] OUT 2020-10-15 15:44:36.336  INFO 20 --- [           main] ConditionEvaluationReportLoggingListener :
   2020-10-15T15:44:36.33+0000 [APP/PROC/WEB/0] OUT Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
   2020-10-15T15:44:36.63+0000 [APP/PROC/WEB/0] OUT 2020-10-15 15:44:36.638 ERROR 20 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :
   2020-10-15T15:44:36.63+0000 [APP/PROC/WEB/0] OUT ***************************
   2020-10-15T15:44:36.63+0000 [APP/PROC/WEB/0] OUT APPLICATION FAILED TO START
   2020-10-15T15:44:36.63+0000 [APP/PROC/WEB/0] OUT ***************************
   2020-10-15T15:44:36.63+0000 [APP/PROC/WEB/0] OUT Description:
   2020-10-15T15:44:36.63+0000 [APP/PROC/WEB/0] OUT Parameter 0 of constructor in org.springframework.credhub.demo.CredHubDemoController required a bean of type 'org.springframework.credhub.core.CredHubOperations' that could not be found.
   2020-10-15T15:44:36.63+0000 [APP/PROC/WEB/0] OUT The following candidates were found but could not be injected:
   2020-10-15T15:44:36.63+0000 [APP/PROC/WEB/0] OUT     - Bean method 'credHubTemplate' in 'CredHubTemplateConfiguration.CredHubTemplateBaseConfiguration' not loaded because @ConditionalOnClass did not find required class 'javax.servlet.http.HttpServletRequest'
   2020-10-15T15:44:36.63+0000 [APP/PROC/WEB/0] OUT     - Bean method 'credHubTemplate' in 'CredHubTemplateConfiguration.CredHubTemplateOAuth2ClientConfiguration' not loaded because @ConditionalOnClass did not find required class 'javax.servlet.http.HttpServletRequest'
   2020-10-15T15:44:36.63+0000 [APP/PROC/WEB/0] OUT     - Bean method 'credHubTemplate' in 'CredHubTemplateConfiguration.CredHubTemplateOAuth2Configuration' not loaded because @ConditionalOnClass did not find required class 'javax.servlet.http.HttpServletRequest'
   2020-10-15T15:44:36.63+0000 [APP/PROC/WEB/0] OUT Action:
   2020-10-15T15:44:36.63+0000 [APP/PROC/WEB/0] OUT Consider revisiting the entries above or defining a bean of type 'org.springframework.credhub.core.CredHubOperations' in your configuration.
   2020-10-15T15:44:36.70+0000 [APP/PROC/WEB/0] OUT Exit status 1
   2020-10-15T15:44:36.70+0000 [CELL/SSHD/0] OUT Exit status 0
   2020-10-15T15:44:42.37+0000 [CELL/0] OUT Cell 72ade8a8-e7b7-4c60-a0a4-34f493c187cd stopping instance 77e3fd88-a493-43d4-4d0d-19de
   2020-10-15T15:44:42.37+0000 [CELL/0] OUT Cell 72ade8a8-e7b7-4c60-a0a4-34f493c187cd destroying container for instance 77e3fd88-a493-43d4-4d0d-19de
   2020-10-15T15:44:42.39+0000 [API/3] OUT Process has crashed with type: "web"
   2020-10-15T15:44:42.42+0000 [API/3] OUT App instance exited with guid ee21626f-b5d9-4ed1-b403-9d3313d6ef13 payload: {"instance"=>"77e3fd88-a493-43d4-4d0d-19de", "index"=>0, "cell_id"=>"72ade8a8-e7b7-4c60-a0a4-34f493c187cd", "reason"=>"CRASHED", "exit_description"=>"APP/PROC/WEB: Exited with status 1", "crash_count"=>1, "crash_timestamp"=>1602776682346698823, "version"=>"7e693e74-ad84-43f1-9dd7-7cbf3b54928b"}
   2020-10-15T15:44:42.42+0000 [CELL/0] OUT Cell 7ee57cf4-81db-41bf-bba7-b7bea3d02a84 creating container for instance fd682896-198d-49ec-45e3-073f
   2020-10-15T15:44:42.63+0000 [PROXY/0] OUT Exit status 137

@joe-penske Please accept my apologies for letting the demo app get out of date w.r.t. the latest release of the project. I've fixed some problems in this commit. The application starts cleanly for me with these changes.

@scottfrederick Please don't apologize. You are doing a great service by providing these resources for the open source community.
With the new changes, it is deploying successfully. thank you very much for your help.

I have a question on the contents of demo.json. Which URI is it expecting here? : "uri": "https://example.com"

I have a question on the contents of demo.json.

The contents of demo.json doesn't really matter. It's just an example of storing some set of value/value pairs in CredHub as a JSON credential. You can replace those key/values pairs with anything else you'd like to experiment with.