Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to run junit tests in Eclipse

I and my colleagues have an intermittent problem running junit tests or tomcat from within Eclipse.

Sometimes the tests will run. Sometimes they will not. There appears to be no pattern and we are not in sync. IE mine might run and others will fail.

Stopping/starting Eclipse can resolve the issue (sometimes). Pulling out the network cable ALWAYS resolves the problem (while it is out).

When it fails the following happens. On trying to run the class the Console screen appears with the red box. The console screen stays blank for about 30 seconds and then the following appears:

Could not connect to: : 2083
java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:520) at java.net.Socket.connect(Socket.java:470) at java.net.Socket.(Socket.java:367) at java.net.Socket.(Socket.java:180) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.connect(RemoteTestRunner.java:560) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:377) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

The port number varies. I found a forum post that told me follow this http://support.microsoft.com/kb/135982 But this did not work.

We are all on Microsoft XP based machines connecting to the internet via an ISA server/proxy. I am running Eclipse 3.3.3 and MyEclipse 6.0.1

Any ideas please ?

like image 572
Bill Comer Avatar asked Nov 14 '22 16:11

Bill Comer


1 Answers

I have concentrated on junit instead of tomcat as it is much quicker & easier to reproduce. Yep I had seen the McQueeney link with no luck.

We have done some more digging and interestingly when you run junit from Eclipse, Eclipse decides to go & check for updates, Yes that's right - everytime you run a junit (& I guess tomcat and others).

We removed a colleague's access restrictions to the WWW through the ISA server and low & behold the problem disappeared.

We are still monitoring this to see if it is the solution. Watch this space.

I have tried looking through the Eclipse set up to see if I can stop it trundling off everytime to the WWW but have not seen a suitable option yet.

like image 135
Bill Comer Avatar answered Dec 17 '22 18:12

Bill Comer