Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running the docker image: Keystore not found #1187

Closed
fahadash opened this issue Jan 18, 2022 · 4 comments
Closed

Error running the docker image: Keystore not found #1187

fahadash opened this issue Jan 18, 2022 · 4 comments

Comments

@fahadash
Copy link

We are trying to build and run the docker container on Windows with Hyper-V and Linux containers enabled. The container builds fine, but when we run the final JAR we get the following error

exec java $JAVA_OPTS -javaagent:./newrelic/newrelic.jar -jar ./rest-api.jar [root@6a06071e28b8 run]# exec java $JAVA_OPTS -javaagent:./newrelic/newrelic.jar -jar ./rest-api.jar Jan 18, 2022 19:45:53 +0000 [20 1] com.newrelic INFO: New Relic Agent: Loading configuration file "/usr/src/run/newrelic/./newrelic.yml" Jan 18, 2022 19:45:53 +0000 [20 1] com.newrelic INFO: Using configured collector host: gov-collector.newrelic.com Jan 18, 2022 19:45:54 +0000 [20 1] com.newrelic INFO: New Relic Agent: Writing to log file: /usr/src/run/newrelic/logs/newrelic_agent.log {"timestamp":"2022-01-18 19:45:58.718","thread":"main","attachment":"","level":"INFO ","logger":"g.c.q.c.api.RestApiApplication","message":"Starting RestApiApplication v16.2.0-RELEASE on 6a06071e28b8 with PID 20 (/usr/src/run/rest-api.jar started by root in /usr/src/run)"} {"timestamp":"2022-01-18 19:45:58.726","thread":"main","attachment":"","level":"INFO ","logger":"g.c.q.c.api.RestApiApplication","message":"No active profile set, falling back to default profiles: default"} {"timestamp":"2022-01-18 19:46:01.917","thread":"main","attachment":"","level":"WARN ","logger":"o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext","message":"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: Could not load key store 'null'"} {"timestamp":"2022-01-18 19:46:01.933","thread":"main","attachment":"","level":"INFO ","logger":"o.s.b.a.l.ConditionEvaluationReportLoggingListener","message":"\n\nError starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled."} {"timestamp":"2022-01-18 19:46:01.942","thread":"main","attachment":"","level":"ERROR","logger":"o.s.boot.SpringApplication","message":"Application run failed","stack_trace":"org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Could not load key store 'null'\n\tat org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:156)\n\tat org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544)\n\tat org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)\n\tat org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)\n\tat org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:315)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)\n\tat gov.cms.qpp.conversion.api.RestApiApplication.main(RestApiApplication.java:23)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:566)\n\tat org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)\n\tat org.springframework.boot.loader.Launcher.launch(Launcher.java:87)\n\tat org.springframework.boot.loader.Launcher.launch(Launcher.java:51)\n\tat org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)\nCaused by: org.springframework.boot.web.server.WebServerException: Could not load key store 'null'\n\tat org.springframework.boot.web.embedded.tomcat.SslConnectorCustomizer.configureSslKeyStore(SslConnectorCustomizer.java:128)\n\tat org.springframework.boot.web.embedded.tomcat.SslConnectorCustomizer.configureSsl(SslConnectorCustomizer.java:88)\n\tat org.springframework.boot.web.embedded.tomcat.SslConnectorCustomizer.customize(SslConnectorCustomizer.java:57)\n\tat org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.customizeSsl(TomcatServletWebServerFactory.java:339)\n\tat org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.customizeConnector(TomcatServletWebServerFactory.java:317)\n\tat org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:183)\n\tat org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:180)\n\tat org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153)\n\t... 16 common frames omitted\nCaused by: java.lang.IllegalArgumentException: Resource location must not be null\n\tat org.springframework.util.Assert.notNull(Assert.java:198)\n\tat org.springframework.util.ResourceUtils.getURL(ResourceUtils.java:130)\n\tat org.springframework.boot.web.embedded.tomcat.SslConnectorCustomizer.configureSslKeyStore(SslConnectorCustomizer.java:125)\n\t... 23 common frames omitted\n"}

We believe this might be due to non-existent configuration in our dev environment to have HTTPS binding. How can we disable HTTPS and use the unsecured version?

@saquino0827
Copy link
Contributor

Hi @fahadash,
You should be able to change the settings here
If you remove or comment out the server.port and server.ssl.key-store-type that will re-configure the application to back to http.

An additional step for using docker would be to update this file here to EXPOSE 8080.

Feel free to reach out again if this doesn't work.

@fahadash
Copy link
Author

The keystore problem went away, it sounds like we now have a missing dependency.

{"timestamp":"2022-01-19 15:51:45.329","thread":"main","attachment":"","level":"INFO ","logger":"o.s.b.a.l.ConditionEvaluationReportLoggingListener","message":"\n\nError starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled."}
{"timestamp":"2022-01-19 15:51:45.331","thread":"main","attachment":"","level":"ERROR","logger":"o.s.boot.SpringApplication","message":"Application run failed","stack_trace":"org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'auditServiceImpl' defined in URL [jar:file:/usr/src/run/rest-api.jar!/BOOT-INF/classes!/gov/cms/qpp/conversion/api/services/internal/AuditServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dbServiceImpl' defined in URL [jar:file:/usr/src/run/rest-api.jar!/BOOT-INF/classes!/gov/cms/qpp/conversion/api/services/internal/DbServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dynamoDbMapper' defined in class path resource [gov/cms/qpp/conversion/api/config/DynamoDbConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper]: Factory method 'dynamoDbMapper' threw exception; nested exception is org.springframework.beans.factory.BeanInitializationException: No KMS key specified!\n\tat org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798)\n\tat org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:228)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1358)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1204)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)\n\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879)\n\tat org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)\n\tat org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)\n\tat org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)\n\tat org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)\n\tat org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:315)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)\n\tat gov.cms.qpp.conversion.api.RestApiApplication.main(RestApiApplication.java:23)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:566)\n\tat org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)\n\tat org.springframework.boot.loader.Launcher.launch(Launcher.java:87)\n\tat org.springframework.boot.loader.Launcher.launch(Launcher.java:51)\n\tat org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)\nCaused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dbServiceImpl' defined in URL [jar:file:/usr/src/run/rest-api.jar!/BOOT-INF/classes!/gov/cms/qpp/conversion/api/services/internal/DbServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dynamoDbMapper' defined in class path resource [gov/cms/qpp/conversion/api/config/DynamoDbConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper]: Factory method 'dynamoDbMapper' threw exception; nested exception is org.springframework.beans.factory.BeanInitializationException: No KMS key specified!\n\tat org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798)\n\tat org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:228)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1358)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1204)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)\n\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)\n\tat org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1287)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207)\n\tat org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885)\n\tat org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789)\n\t... 27 common frames omitted\nCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dynamoDbMapper' defined in class path resource [gov/cms/qpp/conversion/api/config/DynamoDbConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper]: Factory method 'dynamoDbMapper' threw exception; nested exception is org.springframework.beans.factory.BeanInitializationException: No KMS key specified!\n\tat org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656)\n\tat org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)\n\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)\n\tat org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory$2.resolveCandidate(DefaultListableBeanFactory.java:1738)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1287)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.createOptionalDependency(DefaultListableBeanFactory.java:1741)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1194)\n\tat org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885)\n\tat org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789)\n\t... 41 common frames omitted\nCaused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper]: Factory method 'dynamoDbMapper' threw exception; nested exception is org.springframework.beans.factory.BeanInitializationException: No KMS key specified!\n\tat org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)\n\tat org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651)\n\t... 57 common frames omitted\nCaused by: org.springframework.beans.factory.BeanInitializationException: No KMS key specified!\n\tat gov.cms.qpp.conversion.api.config.DynamoDbConfig.dynamoDbMapper(DynamoDbConfig.java:121)\n\tat gov.cms.qpp.conversion.api.config.DynamoDbConfig$$EnhancerBySpringCGLIB$$45dd4712.CGLIB$dynamoDbMapper$2()\n\tat gov.cms.qpp.conversion.api.config.DynamoDbConfig$$EnhancerBySpringCGLIB$$45dd4712$$FastClassBySpringCGLIB$$30082912.invoke()\n\tat org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)\n\tat org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)\n\tat gov.cms.qpp.conversion.api.config.DynamoDbConfig$$EnhancerBySpringCGLIB$$45dd4712.dynamoDbMapper()\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:566)\n\tat org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)\n\t... 58 common frames omitted\n"}

@saquino0827
Copy link
Contributor

Hi @fahadash
The application itself will throw an error for a missing kms key since you are using it locally and should continue to set up. What docker commands are you using?

@saquino0827
Copy link
Contributor

Closing due to inactivity. Feel free to re-open or create a new issue if this is still unresolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants