Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.net.ConnectException: Connection timed out: connect

Big IanFeb 9 2015 — edited Feb 11 2015

Hi All

Am trying to parse an xml file, however, I'm getting a "Connection Timeout" error.  I have double checked and the DTD/Schema etc are all accessible via the machine executing the code on.  I'm pretty certain that the firewall isn't blocking the connection (Because I can get to the files in a browser and because our corporate firewall couldn't stop an asthmatic sparrow).  I have double checked and Maven is (or at least appears to be) properly configured for our proxy server.

My Code (I've edited out some of the Chaffe)

   DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(new File(Filename.toString()));

Partial Trace:

java.net.ConnectException: Connection timed out: connect

        at java.net.DualStackPlainSocketImpl.connect0(Native Method)

        at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)

        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)

        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

        at java.net.Socket.connect(Socket.java:589)

        at java.net.Socket.connect(Socket.java:538)

        at sun.net.NetworkClient.doConnect(NetworkClient.java:180)

        at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)

        at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)

        at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)

        at sun.net.www.http.HttpClient.New(HttpClient.java:308)

        at sun.net.www.http.HttpClient.New(HttpClient.java:326)

        at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1168)

        at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1104)

Any thoughts?

Please be gentle I've only been playing with Java for a week though I do have extensive experience in other platforms.

TIA

This post has been answered by Mohan Basavarajappa on Feb 9 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 11 2015
Added on Feb 9 2015
2 comments
7,697 views