0

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)
2
  • 1
    Not enough information. UnknownHostException is a failure to locate an IP address for the name (i.e. DNS lookup failure), and has nothing to do with connection attempts or the site being up. What happens if you ping mysite.com at the command line on the system that's running your Java application? Commented Nov 1, 2011 at 17:15
  • Sorry, when I said "the site is up" I meant that it is visible from a browser on the same machine that the Java app is running on. And, yes, I can ping it from the command line. I think this is something inside Java. Commented Nov 9, 2011 at 19:16

3 Answers 3

1

Proxy problems. Your DNS lookup failure occurs because within the LAN there is nothing registered to that website and the ProxySelector is not using a proxy to reach out to the internet.

Sign up to request clarification or add additional context in comments.

Comments

0

You could probably just use the link() method of processing http://processing.org/reference/link_.html That way you can verify that processing is actually seeing your page, and from there on you can try to post to it.

Comments

0

You can add -Djava.rmi.server.hostname= -Dremoting.bind_by_host=false to the run script at the server

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.