0

我想在 jhipster-registry 上添加一个 node.js 服务器作为微服务应用程序。我使用 eureka-js-client npm 包

可以在github上找到一个节点测试项目“zhudan/node-eureka”

// ------------------ 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 上我获得了一个空指针异常。

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的完整日志 问候,

4

0 回答 0