Looks like a DNS resolution problem at some point in the stack. java.net.UnknownHostException
is "Thrown to indicate that the IP address of a host could not be determined".
Problem with Java
The problem may be with Java itself. There is a known issue with Java and IPv6. You can try setting the java.net.preferIPv4Stack
system property to true
to see if that fixes the issue.
As a parameter to the java
command when launching your JVM:
java -Djava.net.preferIPv4Stack=true YourMainClass
Or programmatically:
System.setProperty("java.net.preferIPv4Stack" , "true");
You can also try upgrading to the latest version of Java to get all the bug fixes that come with it.
Problem with your DNS server or configuration
The issue may also be with the DNS configuration on your laptop/machine. You can use dig
to see what that DNS lookup returns. Below is the output of what I get from my laptop. You can also use this web version of dig to see what you should be getting.
% dig ds047037.mongolab.com
; <<>> DiG 9.8.3-P1 <<>> ds047037.mongolab.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20375
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;ds047037.mongolab.com. IN A
;; ANSWER SECTION:
ds047037.mongolab.com. 120 IN CNAME ds047037-a.mongolab.com.
ds047037-a.mongolab.com. 120 IN CNAME h000432.mongolab.com.
h000432.mongolab.com. 120 IN CNAME ec2-46-51-159-130.eu-west-1.compute.amazonaws.com.
ec2-46-51-159-130.eu-west-1.compute.amazonaws.com. 300 IN A 46.51.159.130
;; Query time: 23 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Sat Jan 12 13:22:24 2013
;; MSG SIZE rcvd: 162
If you confirm that your DNS configuration / server is the issue, you will need to determine which DNS servers you're using and then contact the owner / administrator or contact your ISP to make sure they're configured as they should be.