Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SocketTimeoutException when Ant building in Eclipse

Tags:

java

eclipse

ant

I had been having problems getting Eclipse to build some of my Ant scripts (some built fine, others didn't). Basically, I would get no output in the Eclipse Mars.1 Release (4.5.1) console. My build.xml works fine with ant when I run it on the command line. I was able to find some output in workspace/.metadata/.log where I found the following error message:

!ENTRY org.eclipse.ant.launching 4 120 2016-03-03 09:58:38.197
!MESSAGE Error logged from Ant UI: 
!STACK 0
java.net.SocketTimeoutException: Accept timed out
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
    at java.net.ServerSocket.implAccept(ServerSocket.java:545)
    at java.net.ServerSocket.accept(ServerSocket.java:513)
    at org.eclipse.ant.internal.launching.launchConfigurations.RemoteAntBuildListener$ServerConnection.run(RemoteAntBuildListener.java:89)

which other people have asked about on Stackoverflow.

The other odd thing I noticed was that there's a line of text right above the console showing which java which shows the version of java being used, and working scripts were different than non-working. Working ant build scripts were using jdk1.7.0_79 whereas failed ones were using the /System installed 1.6.

like image 344
amos Avatar asked Feb 08 '23 14:02

amos


1 Answers

I don't know why java 1.6 wasn't working for me, but eventually I found where I could change Java for ant builds. It's in Run/External Tools/External Tools Configuration.../<select failing build>/JRE. Oddly, after getting it to work and then trying to switch back to 1.6, it gives me the following message when running ant:

JRE version less than 1.7 is not supported. 

so who knows why 1.6 was picked in the first place (maybe the project itself is 1.6) or why it didn't give me a warning!

Anyway, there seems to be several causes of the error I posted above, but here's something you can try.

like image 87
amos Avatar answered Feb 11 '23 15:02

amos