Jwt JHipster注册表拒绝网关和微服务

Jwt JHipster注册表拒绝网关和微服务,jwt,jhipster,microservices,spring-cloud-config,Jwt,Jhipster,Microservices,Spring Cloud Config,我试图将JHipster用于使用微服务的项目,但最新的JHipster注册表不允许我的网关或微服务访问配置服务器并拒绝它们 我安装了JHipster流浪者DevBox,然后使用docker run-p 8761:8761 JHipster/JHipster注册表运行JHipster注册表。 然后,我生成了一个网关和两个微服务,它工作了 但是后来我想使用GitHub中的JHipster注册表,所以我克隆了它并运行了它(很明显,它同时被更新为2.0.0)。遗憾的是,网关和微服务无法访问此注册表。他们

我试图将JHipster用于使用微服务的项目,但最新的JHipster注册表不允许我的网关或微服务访问配置服务器并拒绝它们

我安装了JHipster流浪者DevBox,然后使用
docker run-p 8761:8761 JHipster/JHipster注册表运行JHipster注册表。
然后,我生成了一个网关和两个微服务,它工作了

但是后来我想使用GitHub中的JHipster注册表,所以我克隆了它并运行了它(很明显,它同时被更新为2.0.0)。遗憾的是,网关和微服务无法访问此注册表。他们仍然能够访问Docker图像注册表(我想Docker没有更新它)。但由于它更为奇特,而且可能更为最新,我想使用最新版本的注册表,与GitHub的版本相同。所以我尝试用
Docker pull
更新Docker image Jhipster注册表。现在它既不能用于注册表Docker映像,也不能用于GitHub克隆

当注册表运行时,我运行网关或微服务时,我会得到6倍:

2016-05-10 15:39:07.511 DEBUG 20706 --- [           main] s.n.www.protocol.http.HttpURLConnection  : sun.net.www.MessageHeader@86ba8f5 pairs: {GET /config/gateway/dev/master HTTP/1.1: null}{Accept: application/json, application/*+json}{User-Agent: Java/1.8.0_91}{Host: localhost:8761}{Connection: keep-alive}
2016-05-10 15:39:07.522 DEBUG 20706 --- [           main] s.n.www.protocol.http.HttpURLConnection  : sun.net.www.MessageHeader@43c7802510 pairs: {null: HTTP/1.1 401 Unauthorized}{Server: Apache-Coyote/1.1}{X-Content-Type-Options: nosniff}{X-XSS-Protection: 1; mode=block}{Cache-Control: no-cache, no-store, max-age=0, must-revalidate}{Pragma: no-cache}{Expires: 0}{Content-Type: application/json;charset=UTF-8}{Transfer-Encoding: chunked}{Date: Tue, 10 May 2016 15:39:07 GMT}
然后我得到一个错误:

2016-05-10 15:39:13.781 ERROR 20706 --- [           main] o.s.boot.SpringApplication               : Application startup failed
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/generator-jhipster
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
└── generator-jhipster@3.2.1 

npm ERR! Linux 3.13.0-85-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "generator-jhipster"
npm ERR! node v4.4.4
npm ERR! npm  v3.8.9
npm ERR! path /usr/local/lib/node_modules/generator-jhipster
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/generator-jhipster'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/generator-jhipster']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules/generator-jhipster' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/vagrant/npm-debug.log

I've just updated your generators. Remember, you can update
a specific generator with npm by running:

    npm install -g generator-_______
然后我得到Java异常:

java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:110)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator$$FastClassBySpringCGLIB$$fa44b2a.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.retry.interceptor.RetryOperationsInterceptor$1.doWithRetry(RetryOperationsInterceptor.java:74)
at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:263)
at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:154)
at org.springframework.retry.interceptor.RetryOperationsInterceptor.invoke(RetryOperationsInterceptor.java:101)
at org.springframework.retry.annotation.AnnotationAwareRetryOperationsInterceptor.invoke(AnnotationAwareRetryOperationsInterceptor.java:118)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator$$EnhancerBySpringCGLIB$$a0abff82.locate(<generated>)
at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:89)
at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:640)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:343)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at com.soprasteria.example.GatewayApp.main(GatewayApp.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:478)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.web.client.HttpClientErrorException: 401 Unauthorized
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:641)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:597)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:557)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:475)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment(ConfigServicePropertySourceLocator.java:130)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:81)
... 23 common frames omitted

[WARNING] 
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:478)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:110)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator$$FastClassBySpringCGLIB$$fa44b2a.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.retry.interceptor.RetryOperationsInterceptor$1.doWithRetry(RetryOperationsInterceptor.java:74)
at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:263)
at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:154)
at org.springframework.retry.interceptor.RetryOperationsInterceptor.invoke(RetryOperationsInterceptor.java:101)
at org.springframework.retry.annotation.AnnotationAwareRetryOperationsInterceptor.invoke(AnnotationAwareRetryOperationsInterceptor.java:118)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator$$EnhancerBySpringCGLIB$$a0abff82.locate(<generated>)
at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:89)
at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:640)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:343)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at com.soprasteria.example.GatewayApp.main(GatewayApp.java:73)
... 6 more
Caused by: org.springframework.web.client.HttpClientErrorException: 401 Unauthorized
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:641)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:597)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:557)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:475)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment(ConfigServicePropertySourceLocator.java:130)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:81)
... 23 more
在注册表的shell中,我也得到了这一行6次:

2016-05-10 15:39:07.519 DEBUG 17958 --- [io-8761-exec-10] i.g.j.r.s.Http401UnauthorizedEntryPoint  : Pre-authenticated entry point called. Rejecting access
我尝试过更新所有内容,目前我正在尝试降级(因为文档上说“我们建议您使用与JHipster生成器相同的版本标签”,但我认为这不起作用,因为JHipster注册表的最新版本是2.0.0,JHipster生成器引入了带有3.0版本的微服务),我还尝试直接将秘密从中央服务器配置复制到应用程序的配置中,但显然没有效果

你能帮我做这个吗

事先非常感谢

编辑:

我尝试使用
npm install-g generator JHipster
将JHipster更新到3.2.1,这显然是可行的,但当我运行
yo JHipster
时,耶曼仍然使用JHipster 3.1.0。实际上,即使我用npm uninstall-g generator JHipster卸载JHipster,Yeoman仍然可以使用JHipster 3.1.0

编辑:

如果我在本地重新安装所有东西(在我使用的目录中),它就可以正常工作。 然而,我仍然无法在约曼全球更新JHipster。当我尝试使用npm安装-g generator jhipster时,它将jhipster全局更新为3.2.1,但Yeoman仍然使用3.1.0。如果我尝试使用
yo
/“更新您的生成器”/“生成器JHipster”更新JHipster,我会得到一个错误:

2016-05-10 15:39:13.781 ERROR 20706 --- [           main] o.s.boot.SpringApplication               : Application startup failed
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/generator-jhipster
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
└── generator-jhipster@3.2.1 

npm ERR! Linux 3.13.0-85-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "generator-jhipster"
npm ERR! node v4.4.4
npm ERR! npm  v3.8.9
npm ERR! path /usr/local/lib/node_modules/generator-jhipster
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/generator-jhipster'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/generator-jhipster']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules/generator-jhipster' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/vagrant/npm-debug.log

I've just updated your generators. Remember, you can update
a specific generator with npm by running:

    npm install -g generator-_______
使用
sudo
也会这样做,并且
sudo-su
在我尝试运行
yo
时给我这个:

/usr/local/lib/node_modules/yo/node_modules/configstore/index.js:53
                throw err;
                ^

Error: EACCES: permission denied, open '/root/.config/configstore/insight-yo.json'
You don't have access to this file.

    at Error (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.readFileSync (fs.js:397:15)
    at Object.create.all.get (/usr/local/lib/node_modules/yo/node_modules/configstore/index.js:34:26)
    at Object.Configstore (/usr/local/lib/node_modules/yo/node_modules/configstore/index.js:27:44)
    at new Insight (/usr/local/lib/node_modules/yo/node_modules/insight/lib/index.js:37:34)
    at Object.<anonymous> (/usr/local/lib/node_modules/yo/lib/cli.js:163:11)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
/usr/local/lib/node_modules/yo/node_modules/configstore/index.js:53
犯错误;
^
错误:EACCES:权限被拒绝,打开“/root/.config/configstore/insight yo.json”
您没有访问此文件的权限。
错误(本机)
在Object.fs.openSync(fs.js:549:18)
在Object.fs.readFileSync(fs.js:397:15)
在Object.create.all.get(/usr/local/lib/node_modules/yo/node_modules/configstore/index.js:34:26)
在Object.Configstore(/usr/local/lib/node_modules/yo/node_modules/Configstore/index.js:27:44)
在new Insight(/usr/local/lib/node_modules/yo/node_modules/Insight/lib/index.js:37:34)
反对。(/usr/local/lib/node_modules/yo/lib/cli.js:163:11)
在模块处编译(Module.js:409:26)
在Object.Module.\u extensions..js(Module.js:416:10)
在Module.load(Module.js:343:32)
编辑:

好的,即使是本地安装,它也不起作用。。。 网关确实可以访问注册表,但当我尝试访问localhost:8080时,它会显示一个调试页面。 实际上,在生成过程中,我再次被拒绝了
权限
,并且缺少依赖项(
gulprev


我刚刚看到了这一点:“使用一个标签来获得一个稳定的版本是明智的:JHipster DevBox标签与JHipster生成器标签相同,因此使用DevBox v3.2.0也意味着在DevBox GitHub页面上使用生成器v3.2.0”,因此,也许我会再次删除并下载DevBox…

这是因为您将JHipster注册表升级到了2.0.0版本。这个新版本是安全的,这就是为什么您有401个“未经验证”的错误,因为您没有提供任何登录/密码来连接

3种解决方案:

  • 请继续使用与您的JHipster版本匹配的较旧JHipster注册表版本
  • 向您的Eureka和Spring云配置URL添加登录名/密码(默认为admin/admin)。关于保护JHipster注册表的详细文档是-在撰写本文时它还不完整,但我将很快更新它
  • 更新至JHipster v3.2.1,该版本将与JHipster Registry v2.0.0一起使用,所有内容都将自动配置

我在使用从本地运行IntelliJ IDEA的github中提取的最新JHipster注册表时发现了相同的行为——服务器将启动,但前端无法提供服务


事实证明,这是运行/调试配置中存在空白工作目录的问题。填充后,可以从IDE中找到有用的东西。

非常感谢您的快速回答。我在写问题时考虑了您的第一个解决方案,它应该有用,因为它以前有用。我不知道如何使用你的第二个解决方案,但我会试试。对于第三个解决方案,我想我已经将JHipster更新到了它的最新版本,但是我注意到,如果我使用
npm安装-g generator JHipster
,它确实安装了3.2.1版本,但是当我运行
yo JHipster
时,yeoman仍然使用3.1.0版本,因此,我不知道如何准确地更新它。不知何故,只需键入
yo
即可进入基于cli的菜单并通过它进行更新,而命令行
npm inst