错误集锦
2019-10-22 16:41:28.738 ERROR 41220 --- [nio-8010-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: port out of range:80001] with root cause
解决:服务消费者在调用服务提供者时,IP端口后少了一个路径分隔符。如下图
错误示例:
正确示例:@GetMapping("/user/{id}") public User findById(@PathVariable Long id) { return this.restTemplate.getForObject("http://localhost:8000" + id, User.class); }
@GetMapping("/user/{id}") public User findById(@PathVariable Long id) { return this.restTemplate.getForObject("http://localhost:8000/" + id, User.class); }