应用程序无法在Eureka中注册并引发404空错误

时间:2018-10-30 07:56:28

标签: spring-boot netflix-zuul netflix-eureka

我有两个应用程序UI和后端服务。

在后端服务中添加了依赖项netflix-eureka客户端

在将后端服务注册为抛出错误时

2018-10-30 13:18:36.292 DEBUG 13572 --- [gistrationTask1] o.s.web.client.RestTemplate              : Created POST request for "http://<<eureka_host:port>>/admin/instances"
2018-10-30 13:18:36.293 DEBUG 13572 --- [gistrationTask1] o.s.web.client.RestTemplate              : Setting request Accept header to [application/json, application/*+json]
2018-10-30 13:18:36.294 DEBUG 13572 --- [gistrationTask1] o.s.web.client.RestTemplate              : Writing [Application(name=App1, managementUrl=http://IN5CG52538Z0.CSCMWS.CSCMWS.COM:8282/actuator, healthUrl=http://IN5CG52538Z0.CSCMWS.CSCMWS.COM:8282/actuator/health, serviceUrl=http://IN5CG52538Z0.CSCMWS.CSCMWS.COM:8282/)] as "application/json" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@4cffd3fd]
2018-10-30 13:18:36.303 DEBUG 13572 --- [gistrationTask1] o.s.web.client.RestTemplate              : POST request for "http://<<eureka_host:port>>/admin/instances" resulted in 404 (null); invoking error handler

和Zuul的配置如下

zuul:
  sensitive-headers:
  ignore-security-headers: false
  routes:
cr:
 path: /api/app1/**
 serviceId: APP1
 strip-prefix: true
当用户界面应用程序发出请求时,

/ api / app1 / users ->后端服务中的POST方法导致404错误。

@EnableEurekaServer已添加,并且eureka服务器已启动并正在运行。

我的UI是6角弹簧启动应用程序。我注册的应用程序在Eureka服务器(浏览器)中已启动

Application.yml zuul: sensitive-headers: ignore-security-headers: false routes: cr: path: /api/app1/** serviceId: APP1 strip-prefix: true application.properties: eureka.instance.preferIpAddress=false eureka.client.registerWithEureka=true eureka.client.fetchRegistry=true eureka.instance.hostName=APP1 eureka.client.serviceUrl.defaultZone=http://${EUREKA_SERVER_HOSTNAME}/eureka/

0 个答案:

没有答案