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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

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

What are you trying to run?
What platform are you on?
Where is your JDeveloper installed?
488269
OK, sorry, should have been more specific.

I'm running on Windows XP Professional SP1.
My JDeveloper is installed in C:\Program Files\JDev
I started getting this error when running projects that worked in JDev 9.0.5
I then created a new Web Project with one simple JSP (no taglibs and no code, just some text in the body) and still get the error on that.

The entire text of the error I get is:

[Starting OC4J using the following ports: HTTP=8988, RMI=23791, JMS=9227.]

**** Unable to obtain password from principals.xml. Using default.

C:\Program Files\JDev\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\config>

"C:\Program Files\JDev\jdk\bin\javaw.exe" -ojvm "-Doracle.home=C:\Program Files\JDev" -classpath "C:\Program Files\JDev\j2ee\home\oc4j.jar;C:\Program Files\JDev\jdev\lib\jdev-oc4j-embedded.jar" -Xverify:none -DcheckForUpdates=adminClientOnly -Doracle.application.environment=development -Doracle.j2ee.dont.use.memory.archive=true -Doracle.j2ee.http.socket.timeout=500 -Doc4j.jms.usePersistenceLockFiles=false oracle.oc4j.loader.boot.BootStrap -config "C:\Program Files\JDev\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\config\server.xml"

[waiting for the server to complete its initialization...]

06/02/05 11:30:47 java.net.ConnectException: Connection timed out: connect

06/02/05 11:30:47 at java.net.PlainSocketImpl.socketConnect(Native Method)

06/02/05 11:30:47 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)

06/02/05 11:30:47 at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)

06/02/05 11:30:47 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)

06/02/05 11:30:47 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)

06/02/05 11:30:47 at java.net.Socket.connect(Socket.java:507)

06/02/05 11:30:47 at java.net.Socket.connect(Socket.java:457)

06/02/05 11:30:47 at java.net.Socket.<init>(Socket.java:365)

06/02/05 11:30:47 at java.net.Socket.<init>(Socket.java:207)

06/02/05 11:30:47 at oracle.jdevimpl.runner.oc4j.Oc4jNotifier.sendMessage(Oc4jNotifier.java:98)

06/02/05 11:30:47 at oracle.jdevimpl.runner.oc4j.Oc4jNotifier.postInitApplicationServer(Oc4jNotifier.java:55)

06/02/05 11:30:47 at com.evermind.server.ApplicationServer.serverExtensionPostInit(ApplicationServer.java:1091)

06/02/05 11:30:47 at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:951)

06/02/05 11:30:47 at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:113)

06/02/05 11:30:47 at java.lang.Thread.run(Thread.java:595)

06/02/05 11:30:47 Oracle Containers for J2EE 10g (10.1.3.0.0) initialized

Any help is appreciated.
Reinstall JDeveloper in a directory that doesn't have a space in it's path. (e.g not in program files, but rather in c:\jdev1013). Then create a new project and let us know if the problem is still there.
488269
Yes, that was the problem. I moved it to c:\Jdev and worked fine.

Thanks a ton! I was about ready to give up on it.
448717
Hello Every One,
I'm facing the same problem using older version of Jdeveloper (Jdev10.1.2)
I tried ur solution but it didn't work
My OS is Windows Server 2003
My Jdeveloper Home is D:\jdev1012

and the exception I get is here:

[waiting for the server to complete its initialization...]

06/02/22 13:34:09 Auto-deploying file:/D:/jdev1012/jdev/mywork/Application3/ViewController/public_html/ (New server version detected)...

06/02/22 13:34:31 java.net.ConnectException: Connection timed out: connect

06/02/22 13:34:31 at java.net.PlainSocketImpl.socketConnect(Native Method)

06/02/22 13:34:31 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)

06/02/22 13:34:31 at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)

06/02/22 13:34:31 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)

06/02/22 13:34:31 at java.net.Socket.connect(Socket.java:452)

06/02/22 13:34:31 at java.net.Socket.connect(Socket.java:402)

06/02/22 13:34:31 at java.net.Socket.<init>(Socket.java:309)

06/02/22 13:34:31 at java.net.Socket.<init>(Socket.java:153)

06/02/22 13:34:31 at oracle.jdevimpl.runner.oc4j.Oc4jNotifier.sendMessage(Oc4jNotifier.java:98)

06/02/22 13:34:31 at oracle.jdevimpl.runner.oc4j.Oc4jNotifier.postInitApplicationServer(Oc4jNotifier.java:55)

06/02/22 13:34:31 at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1629)

06/02/22 13:34:31 at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:92)

06/02/22 13:34:31 at java.lang.Thread.run(Thread.java:534)

06/02/22 13:34:31 Oracle Application Server Containers for J2EE 10g (10.1.2.0.0) initialized
488269
I found that I got this error when I didn't have enough available memory to run the application. By removing a bunch of my startup options and closing all other programs (including internet connection) I was able to use JDev with 512K memory. Since then I've upgraded with more memory and no problems.
4172
Hello,
I getting the some error in my JDev 10.1.3 with Service Update 2. I already check all suggestions from previous forum threads, but without any luck. It's very strange, because i only have problems when work from home (connection to internet via wireless router). At the company (Ethernet connection to internet), it works OK. Please help.

My computer: IBM ThinkPad R52 ; Window XP SP2 (Firewall is ON) ; JDev 10.1.3 + SU2

Regards,
Matic

06/04/17 09:40:32 java.net.ConnectException: Connection timed out: connect
06/04/17 09:40:32 at java.net.PlainSocketImpl.socketConnect(Native Method)
06/04/17 09:40:32 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
06/04/17 09:40:32 at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
06/04/17 09:40:32 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
06/04/17 09:40:32 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
06/04/17 09:40:32 at java.net.Socket.connect(Socket.java:507)
06/04/17 09:40:32 at java.net.Socket.connect(Socket.java:457)
06/04/17 09:40:32 at java.net.Socket.<init>(Socket.java:365)
06/04/17 09:40:32 at java.net.Socket.<init>(Socket.java:207)
06/04/17 09:40:32 at oracle.jdevimpl.runner.oc4j.Oc4jNotifier.sendMessage(Oc4jNotifier.java:98)
06/04/17 09:40:32 at oracle.jdevimpl.runner.oc4j.Oc4jNotifier.postInitApplicationServer(Oc4jNotifier.java:55)
06/04/17 09:40:32 at com.evermind.server.ApplicationServer.serverExtensionPostInit(ApplicationServer.java:1091)
06/04/17 09:40:32 at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:951)
06/04/17 09:40:32 at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:113)
06/04/17 09:40:32 at java.lang.Thread.run(Thread.java:595)
antonio.gagliardi
Hello, i've got the same problem of connection time out.

This is my solution/workaround: disable the second network card!

I don't know why but, in a pc with 2 network card (generally a wifi card and an ethernet) embedded OC4J running inside JD choose the wrong host ip ( you can see the mistake Tool->Embedded OC4J Server Preferences->StartUp LocalHostFullName ) even if you set it manually .

If you run the server form command with ....\jdevstudiobase\jdev\bin\start_oc4j.bat all works fine but not inside JD.

So the workaround is to leave only one network card.

Regards
Antonio.
1 - 8
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,471 views