NoRouteToHostException on client or server?

后端 未结 6 2248
無奈伤痛
無奈伤痛 2021-02-19 19:24

I am getting

Caused by: java.net.NoRouteToHostException: No route to host
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.do         


        
相关标签:
6条回答
  • 2021-02-19 20:06

    In my case it was solved like this:

    1 - Clear the cache with 'yarn cache clean' or 'npm cache clean --force'

    2 - after that reboot the pc.

    If you clear the cache but do not reboot, the data will still be stored 'somewhere' on the network, so the port will not connect, it is still busy. After restarting it connects smoothly.

    I hope I was helpful!

    0 讨论(0)
  • 2021-02-19 20:14

    It may be possible the ping will provide responses, but the application may still fail to connect. If that is the case, I would suggest using telnet to try and connect to the host using the desired port, telnet host.address port

    If the connection is refused then the port on the host will need to be allowed. It that succeeds, but the application still won't connect:

    1. Verify the address:port being used in your application are the same as those used in the telnet test.
    2. It may be a local port on the client blocking the connection, in which case you would need to allow the port on the client
    0 讨论(0)
  • 2021-02-19 20:16

    Either. It could be a firewall on the client machine blocking outgoing calls or somewhere at the other end.

    0 讨论(0)
  • 2021-02-19 20:26

    Basically it says that your client cannot connect to the server due to the address is inaccessible from the client machine.

    Please check that the address you are connecting to is accessible, either via ping command in your Command Prompt (Windows) or terminal (Unix-based):

    ping <address>
    

    or if it's a web server you can try to check it in your web browser.
    The ping command is helpful for me in most cases, since I would know why exactly I can't connect to the address. It can be a mistyped address or like the javadoc suggests, problem with firewall.

    0 讨论(0)
  • 2021-02-19 20:26

    I had the same issue, I did run iptables flush on host server, this fixed the issue.

    # iptables --flush 
    
    0 讨论(0)
  • 2021-02-19 20:28

    I had the same issue, and resolve it by disabling the firewall on both sides :

    systemctl disable firewalld

    service firewalld stop

    0 讨论(0)
提交回复
热议问题