1

I'm writing an application in Scala that is using the java HttpClient to try to connect to a url, however I keep on getting the error ERROR Catching java.net.UnknownHostException: my.address.com. The tests are being run using sbt in the terminal on Ubuntu, and when I ping the host from the same location it is able to resolve the ip.

Does anyone have a suggestion of why pinging the host works but my application can't find it?

annedroiid
  • 6,267
  • 11
  • 31
  • 54
  • One possibility - confirm that your url does not have any trailing spaces – racraman Sep 06 '16 at 01:09
  • Can you post some code? Otherwise we're just guessing – The Archetypal Paul Sep 06 '16 at 06:08
  • I ran into this today too. There's nothing wrong with the domain (there are no unnecessary spaces), the symptoms are exactly the same as it's described: the Java process cannot resolve the domain, but ping can. It only happens after the service was running for a while, for me it's not reproducible consistently. – Zsolt Katona Oct 27 '18 at 08:11
  • I also meet the same problem at https://stackoverflow.com/questions/59483550/unknowhostexception-cannot-recover-when-network-is-back-but-restart-jvm-solved-i. My case is, when network has some problem the error started, but when the network is back, the error continues; But when I restart JVM, error is gone; – wuchang Dec 26 '19 at 03:33

0 Answers0