Zuul 抛出 404 No message Available 错误

Zuul throwing 404 No meesage Available error

我的以下应用程序(微服务)已成功注册到 Eureka server.I t 具有以下 Rest 端点

@Controller
@RequestMapping("v1/base/")
public class PersonController {

    @PostMapping
    @RequestMapping(value="/personid")
    public ResponseEntity< ?> getPersonList(){
        return ResponseEntity.ok("All person list");
    }

个人应用程序的属性文件

eureka:
  instance:
    appname: person-application
  client:
    enabled: true
    register-with-eureka: true
    fetch-registry: true
    service-url:
      defaultZone: http://localhost:8761/eureka/

我的 zuul 服务器 yml 文件配置是 .

  server:
        port:9000
        servlet:
         contextPath: /zuulapp
    
   zuul:
      routes:
         person:
            path: /v1/base/**
            serviceId: person-application

当我调用 hit the rest point localhost:9000/zuulapp/person/personid 我得到下面的 error.How 我要解决这个错误吗

{
   "timestamp":"2019-10-08T12:42:09.479+0000",
   "status":404,
   "error":"Internal Server Error",
   "message":"No Message available"
   "path" : "/zuulapp/person/personid"
}

由于应用的zuul中注册的路径是“/v1/base/**”

试试这个:删除上下文路径属性,然后用 zuul.prefix 属性替换它。

  server:
        port:9000
      
    
   zuul:
      prefix: /zuulapp
      routes:
         person:
            path: /person/**
            serviceId: person-application

现在尝试检查这个端点:

localhost:9000/zuulapp/person/v1/base/personid

在控制器中试试这个 class:

@RestController
@RequestMapping("/v1/base/")
public class PersonController {

    @GetMapping(value="/personid")
    public ResponseEntity< ?> getPersonList(){
        return ResponseEntity.ok("All person list");
    }