feign调服务错误:feign.RetryableException: Connection refused

2021/01/07 13:37:42.214 ERROR [http-nio-0.0.0.0-7200-exec-35] o.a.c.c.C.[.[.[.[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [/api] threw exception [Request processing failed; nested exception is feign.RetryableException: Connection refused (Connection refused) executing POST http://NJ-DEVICECLOUD-SERVER/njdcd/dispatch] with root cause
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_171]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_171]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_171]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_171]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_171]
at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_171]
at sun.net.NetworkClient.doConnect(NetworkClient.java:175) ~[na:1.8.0_171]
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463) ~[na:1.8.0_171]
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558) ~[na:1.8.0_171]

配置的问题,改成IP就可以了

eureka:
  instance:
    appname: ${spring.application.name}
    virtual-host-name: ${spring.application.name}
    secure-virtual-host-name: ${spring.application.name}
    instance-id: ${server.address2}:${spring.application.name}-peer:${server.port}
    hostname: konke.app.eureka
    #    non-secure-port: 6002 #非安全通信端口
    #    non-secure-port-enabled: true #是否启用非安全端口接受请求
    #    secure-port: 6445 #安全通信端口
    #    secure-port-enabled: true #是否启用安全端口接受请求
    prefer-ip-address: true #是否优先使用IP地址作为主机名的标识,默认false
    lease-renewal-interval-in-seconds: 30 #eureka节点定时续约时间,默认30
    lease-expiration-duration-in-seconds: 90 #eureka节点剔除时间,默认90
  #    metadata-map:
  #      zone: shanghai

prefer-ip-address: true #是否优先使用IP地址作为主机名的标识,默认false

Leave a Comment

 
Copyright © 2008-2021 lanxinbase.com Rights Reserved. | 粤ICP备14086738号-3 |