我想在jhipster-registry上添加一个node.js服务器作为微服务应用程序。 我使用eureka-js-client npm包
你可以找到一个节点测试项目" zhudan / node-eureka"在github上
// ------------------ Eureka Config --------------------------------------------
var Eureka = require("eureka-js-client").Eureka;
var client = new Eureka({
filename: 'eureka-client',
cwd: __dirname
});
client.logger.level('debug');
client.start(function(error){
console.log(error || 'complete');
});
// ------------------ Server Config --------------------------------------------
var server = app.listen(9999, function () {
var host = server.address().address;
var port = server.address().port;
console.log('Listening at http://%s:%s', host, port);
});
我更改了eureka-client.yml以便使用jhipster-registery。
eureka:
heartbeatInterval: 10
maxRetries: 10
requestRetryDelay: 60
registryFetchInterval: 10
host: 'admin:admin@localhost'
port: 8761
servicePath: '/eureka/apps'
instance:
instanceId: "node-euraka"
app: 'node-eureka'
hostName: '127.0.0.1'
#ipAddr: '192.168.10.145'
statusPageUrl: 'http://127.0.0.1:9999'
port:
'$': 9999
'@enabled': 'true'
vipAddress: 'node-eureka'
dataCenterInfo:
'@class': 'com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo'
name: 'MyOwn'
它运作良好我有一个完整的注册和心跳运作
$ node app
Listening at http://:::9999
registered with eureka: node-eureka/node-euraka
retrieved registry successfully
complete
eureka heartbeat success
retrieved registry successfully
eureka heartbeat success
retrieved registry successfully
eureka heartbeat success
retrieved registry successfully
但是在jhipster-registry之后,我获得了一个nullpointerexception。
2017-07-18 10:46:46.452 DEBUG 13124 --- [pool-4-thread-1] i.g.j.r.aop.logging.LoggingAspect : Enter: io.github.jhipster.registry.service.ZuulUpdaterService.updateZuulRoutes() with argument[s] = []
2017-07-18 10:46:46.454 DEBUG 13124 --- [pool-4-thread-1] i.g.j.r.aop.logging.LoggingAspect : Exit: io.github.jhipster.registry.service.ZuulUpdaterService.updateZuulRoutes() with result = null
2017-07-18 10:46:46.597 INFO 13124 --- [ XNIO-2 task-1] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2017-07-18 10:46:46.597 INFO 13124 --- [ XNIO-2 task-1] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2017-07-18 10:46:46.597 INFO 13124 --- [ XNIO-2 task-1] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2017-07-18 10:46:46.597 INFO 13124 --- [ XNIO-2 task-1] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2017-07-18 10:46:51.458 DEBUG 13124 --- [pool-4-thread-1] i.g.j.r.aop.logging.LoggingAspect : Enter: io.github.jhipster.registry.service.ZuulUpdaterService.updateZuulRoutes() with argument[s] = []
2017-07-18 10:46:51.460 DEBUG 13124 --- [pool-4-thread-1] i.g.j.r.service.ZuulUpdaterService : Checking instance node-euraka - null
2017-07-18 10:46:51.467 DEBUG 13124 --- [pool-4-thread-1] i.g.j.r.service.ZuulUpdaterService : Adding instance 'node-euraka' with URL: null
2017-07-18 10:46:51.489 INFO 13124 --- [pool-4-thread-1] i.g.j.r.service.ZuulUpdaterService : Zuul routes have changed - refreshing the configuration
2017-07-18 10:46:51.491 DEBUG 13124 --- [pool-4-thread-1] i.g.j.r.aop.logging.LoggingAspect : Exit: io.github.jhipster.registry.service.ZuulUpdaterService.updateZuulRoutes() with result = null
2017-07-18 10:46:56.492 DEBUG 13124 --- [pool-4-thread-1] i.g.j.r.aop.logging.LoggingAspect : Enter: io.github.jhipster.registry.service.ZuulUpdaterService.updateZuulRoutes() with argument[s] = []
2017-07-18 10:46:56.494 DEBUG 13124 --- [pool-4-thread-1] i.g.j.r.service.ZuulUpdaterService : Checking instance node-euraka - null
2017-07-18 10:46:56.494 DEBUG 13124 --- [pool-4-thread-1] i.g.j.r.service.ZuulUpdaterService : Instance 'node-euraka' already registered
2017-07-18 10:46:56.496 ERROR 13124 --- [pool-4-thread-1] i.g.j.r.aop.logging.LoggingAspect : Exception in io.github.jhipster.registry.service.ZuulUpdaterService.updateZuulRoutes() with cause = 'NULL' and exception = 'null'
java.lang.NullPointerException: null
at io.github.jhipster.registry.service.ZuulUpdaterService.updateZuulRoutes(ZuulUpdaterService.java:65)
每次更新JHipster-registery应用程序视图时,我都会获得nullpointerexception
PS:JHipster-registery以./mvnw命令开头,没有改变你的git repo
我为您提供完整的jhipster-registery日志 regitry-logs.txt 的问候,