Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » java.net.SocketException and RemoteTestRunner(I am trying to run JUnit test cases, but they keep trying to run through a server)
java.net.SocketException and RemoteTestRunner [message #921099] Sun, 23 September 2012 20:47 Go to next message
Ryan Adams is currently offline Ryan AdamsFriend
Messages: 6
Registered: September 2012
Junior Member
Whenever I run a JUnit test case I right click the class, go to Run As..., and click Run As JUnit Test Case. Whenever I do this I get the following stack trace

Could not connect to: : 53665
java.net.SocketException: Invalid argument: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.connect(RemoteTestRunner.java:570)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:381)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


I apologize if that is difficult to read, but from what I see it is trying to run my test case on a server. I don't want that. I don't even have a run on server option. Can anyone help me make my test cases run without a server?

[Updated on: Tue, 02 October 2012 18:36]

Report message to a moderator

Re: java.net.SocketException and RemoteTestRunner [message #922068 is a reply to message #921099] Mon, 24 September 2012 17:56 Go to previous messageGo to next message
Eliseo Ocampos is currently offline Eliseo OcamposFriend
Messages: 15
Registered: September 2012
Junior Member
Hi Ryan, if you send an example of what you are trying to test maybe we can have highest probabilities to help you Wink
Re: java.net.SocketException and RemoteTestRunner [message #922139 is a reply to message #922068] Mon, 24 September 2012 19:29 Go to previous messageGo to next message
Ryan Adams is currently offline Ryan AdamsFriend
Messages: 6
Registered: September 2012
Junior Member
Well it's not any particular case. It refuses to test any JUnit test. For example I made a mock class and test class just to see if it would give me a red bar saying it failed the test:

The class to be tested:

public class thisClass {
String word;
int a;

public String getWord() {
return word;
}

public int getA() {
return a;
}


}

The test class:

import static org.junit.Assert.*;

import org.junit.Test;


public class thisClassTest {

@Test
public void testGetWord() {
fail("Not yet implemented");
}

@Test
public void testGetA() {
fail("Not yet implemented");
}

}

No compiler errors were shown by Eclipse. I ran thisClassTest as a JUnit Test Case and got the following error:

Could not connect to: : 49359
java.net.SocketException: Invalid argument: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.connect(RemoteTestRunner.java:570)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:381)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

This is the case for all test methods I have ever written. I have had to use completely different computers to run tests. I don't know what the difference is between them and my laptop. Is there a setting that I can change or perhaps accidentally got changed? I really appreciate the help and hope this assists anyone with a potential answer.
Re: java.net.SocketException and RemoteTestRunner [message #922374 is a reply to message #922139] Tue, 25 September 2012 00:54 Go to previous messageGo to next message
Eliseo Ocampos is currently offline Eliseo OcamposFriend
Messages: 15
Registered: September 2012
Junior Member
I was reading on the web that this could be an IPv6 configuration issue, can you try to set the config of your pc to use only IPv4 settings?
Add this to your eclipse.ini:
-Djava.net.preferIPv4Stack=true
Re: java.net.SocketException and RemoteTestRunner [message #923327 is a reply to message #922374] Tue, 25 September 2012 20:38 Go to previous messageGo to next message
Ryan Adams is currently offline Ryan AdamsFriend
Messages: 6
Registered: September 2012
Junior Member
I got the same problem:

Could not connect to: : 61151
java.net.SocketException: Invalid argument: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.connect(RemoteTestRunner.java:570)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:381)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

The only difference is the number changed beside "Could not connect to:".

Is there a way to force it to only run locally? I looked at Run Configurations and nothing seems to suggest that clicking run tells it to look for a server. Also thanks for the suggestion.
Re: java.net.SocketException and RemoteTestRunner [message #923668 is a reply to message #923327] Wed, 26 September 2012 05:08 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4430
Registered: July 2009
Senior Member

No, this is how your running process communicates with Eclipse. Have you checked your firewall permissions?

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: java.net.SocketException and RemoteTestRunner [message #924344 is a reply to message #923668] Wed, 26 September 2012 19:19 Go to previous messageGo to next message
Ryan Adams is currently offline Ryan AdamsFriend
Messages: 6
Registered: September 2012
Junior Member
It was blocking eclipse so I changed it and ran the tests again. Still no luck. Same error message and all.
Re: java.net.SocketException and RemoteTestRunner [message #924468 is a reply to message #924344] Wed, 26 September 2012 21:57 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4430
Registered: July 2009
Senior Member

Could it still be blocking the JRE?

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: java.net.SocketException and RemoteTestRunner [message #924701 is a reply to message #924468] Thu, 27 September 2012 04:01 Go to previous messageGo to next message
Ryan Adams is currently offline Ryan AdamsFriend
Messages: 6
Registered: September 2012
Junior Member
It allows Java(TM) Platform SE binary to through the firewall so I don't think that's the problem.
Re: java.net.SocketException and RemoteTestRunner [message #930889 is a reply to message #924701] Tue, 02 October 2012 18:35 Go to previous messageGo to next message
Ryan Adams is currently offline Ryan AdamsFriend
Messages: 6
Registered: September 2012
Junior Member
I figured out the problem. Something happened to my networks card (not exactly sure what though), but I went to my command prompt, typed in "netsh winsock reset", and restarted my computer. After this JUnit ran perfectly.
Re: java.net.SocketException and RemoteTestRunner [message #931658 is a reply to message #930889] Wed, 03 October 2012 12:00 Go to previous messageGo to next message
Eliseo Ocampos is currently offline Eliseo OcamposFriend
Messages: 15
Registered: September 2012
Junior Member
Sounds great, happy coding!
Re: java.net.SocketException and RemoteTestRunner [message #991828 is a reply to message #921099] Thu, 20 December 2012 09:41 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing nameFriend
Messages: 1
Registered: December 2012
Junior Member
Please forgive my resurection of the thread, but I am having exactly the same issue, but none of the "known" workarounds seems to work.

I am running
Juno
Version: 4.2.1
Build id: M20120914-1800

with the Java 7 jre/jdk (7u10)

My eclipse.ini contains the preferIpV4 entry and when I check the plugin configuration, it ist there as well,
I have disabled IPv6 on my system, reset the card and rebooted,
The firewall has been reconfigured to allow all outbound traffic from jre/javaw.exe,

I still get the same error.

I had previously been using 7u7 / 7u9 as well as 6u30. I had the same problem using the 7x jdk's. Switching to the 6u30 cleared the problem. I deinstalled all of them, installed 7u10 deleted eclipse and did a fresh install.

All to no avail.

I realize that this is a known Java 7 Bug, but it seems to only affect me when launching jUnit as the applications themselves have no problems.

Anyone have an idea what else I can try?



Re: java.net.SocketException and RemoteTestRunner [message #1063850 is a reply to message #922374] Fri, 14 June 2013 13:36 Go to previous message
Tam Norris is currently offline Tam NorrisFriend
Messages: 1
Registered: June 2013
Junior Member
Thanks for posting this. I was having this issue and adding that line to my eclipse.ini fixed the issue.

Cheers.
Previous Topic:How to hide package name and project name shown on top of eclipse next to fev icon
Next Topic:Fedora 18 Marketplace client
Goto Forum:
  


Current Time: Fri Mar 29 04:43:16 GMT 2024

Powered by FUDForum. Page generated in 0.04212 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top