Java UnknownHostException When and Why?
Posted
by
interstar
on Stack Overflow
See other posts from Stack Overflow
or by interstar
Published on 2011-11-01T16:29:46Z
Indexed on
2011/11/14
9:50 UTC
Read the original article
Hit count: 291
I'm trying to post to a website from a Processing Sketch. (Processing is basically Java running in a fancy environment). I'm using this library : http://libraries.seltar.org/postToWeb/ but I don't know if that makes a difference. You can see from the stack trace below that this is just a wrapper for the Java standard library.
Anyway, the important point is that the host "mysite.com" is up and running. I am seeing it from the browser. But when I try to post to it from Java I just get the UnknownHostException appearing.
Given that the site is up. What else might this mean?
The program is currently running inside the Processing environment. Presumably as an Applet.
java.net.UnknownHostException: mysite.com
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:195)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
at sun.net.www.http.HttpClient.New(HttpClient.java:306)
at sun.net.www.http.HttpClient.New(HttpClient.java:323)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:970)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:911)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:836)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1014)
at org.seltar.Bytes2Web.PostToWeb._post(PostToWeb.java:90)
at org.seltar.Bytes2Web.ByteToWeb.post(ByteToWeb.java:66)
at experimentPostToWeb.keyPressed(experimentPostToWeb.java:35)
at processing.core.PApplet.handleKeyEvent(Unknown Source)
at processing.core.PApplet.dequeueKeyEvents(Unknown Source)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)
© Stack Overflow or respective owner