Jhipster Registry: Caused by: java.lang.RuntimeException: No JWT secret key is configured, the application cannot start

时间:2018-12-03 13:21:59

标签: spring-boot docker jhipster jhipster-registry

I have created micro services gateway application from jHipster application create configuration, as per instruction provided at link Jhipster Registry I ran the command : docker-compose -f src/main/docker/jhipster-registry.yml up but failed with below reason and I am not able to understand why it's showing as I have already configured base64-secret.

error at : Caused by: java.lang.RuntimeException: No JWT secret key is configured, the application cannot start.
jhipster-registry_1_c0cb2e502fc4 |      at io.github.jhipster.registry.security.jwt.TokenProvider.init(TokenProvider.java:61)

Steps I have already done.

  1. I have set up base64-secret under jhipster:security:authentication:jwt:base64-secret under /src/main/docker/central-server-config/local-config/application.yml and also applictaion-dev.yml file same parameter, but I don't think even it's reading my local configs.

Error I am seeing when starting from Docker command:

jhipster-registry_1_c0cb2e502fc4 | 2018-12-03 13:02:37.468  INFO 1 --- [           main] i.g.j.r.security.jwt.TokenProvider       : The JWT key used is not Base64-encoded. We recommend using the `jhipster.security.authentication.jwt.base64-secret` key for optimum security.
jhipster-registry_1_c0cb2e502fc4 | 2018-12-03 13:02:37.468 ERROR 1 --- [           main] i.g.j.r.security.jwt.TokenProvider       :
jhipster-registry_1_c0cb2e502fc4 | ----------------------------------------------------------
jhipster-registry_1_c0cb2e502fc4 | Your JWT secret key is not set up, you will not be able to log into the JHipster.
jhipster-registry_1_c0cb2e502fc4 | Please read the documentation at https://www.jhipster.tech/jhipster-registry/
jhipster-registry_1_c0cb2e502fc4 | ----------------------------------------------------------
jhipster-registry_1_c0cb2e502fc4 | 2018-12-03 13:02:37.471  WARN 1 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userJWTController' defined in URL [jar:file:/jhipster-registry.war!/WEB-INF/classes!/io/github/jhipster/registry/web/rest/UserJWTController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tokenProvider': Invocation of init method failed; nested exception is java.lang.RuntimeException: No JWT secret key is configured, the application cannot start.
jhipster-registry_1_c0cb2e502fc4 | 2018-12-03 13:02:37.513 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed
jhipster-registry_1_c0cb2e502fc4 |
jhipster-registry_1_c0cb2e502fc4 | org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userJWTController' defined in URL [jar:file:/jhipster-registry.war!/WEB-INF/classes!/io/github/jhipster/registry/web/rest/UserJWTController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tokenProvider': Invocation of init method failed; nested exception is java.lang.RuntimeException: No JWT secret key is configured, the application cannot start.
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:733)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:198)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1266)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1123)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:548)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
jhipster-registry_1_c0cb2e502fc4 |      at io.github.jhipster.registry.JHipsterRegistryApp.main(JHipsterRegistryApp.java:72)
jhipster-registry_1_c0cb2e502fc4 |      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
jhipster-registry_1_c0cb2e502fc4 |      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
jhipster-registry_1_c0cb2e502fc4 |      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
jhipster-registry_1_c0cb2e502fc4 |      at java.lang.reflect.Method.invoke(Method.java:498)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:58)
jhipster-registry_1_c0cb2e502fc4 | Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tokenProvider': Invocation of init method failed; nested exception is java.lang.RuntimeException: No JWT secret key is configured, the application cannot start.
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:416)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1686)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1135)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1062)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:819)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:725)
jhipster-registry_1_c0cb2e502fc4 |      ... 25 common frames omitted
jhipster-registry_1_c0cb2e502fc4 | Caused by: java.lang.RuntimeException: No JWT secret key is configured, the application cannot start.
jhipster-registry_1_c0cb2e502fc4 |      at io.github.jhipster.registry.security.jwt.TokenProvider.init(TokenProvider.java:61)
jhipster-registry_1_c0cb2e502fc4 |      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
jhipster-registry_1_c0cb2e502fc4 |      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
jhipster-registry_1_c0cb2e502fc4 |      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
jhipster-registry_1_c0cb2e502fc4 |      at java.lang.reflect.Method.invoke(Method.java:498)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:366)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:309)
jhipster-registry_1_c0cb2e502fc4 |      at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)
jhipster-registry_1_c0cb2e502fc4 |      ... 38 common frames omitted
jhipster-registry_1_c0cb2e502fc4 |
docker_jhipster-registry_1_c0cb2e502fc4 exited with code 1

0 个答案:

没有答案