Remote debugging error using JDWP from a JUnit test

378 Views Asked by At

I am using Eclipse Juno w/ Maven and have a JUnit test which uses Jemmy to start up another Java application and run automated testing on it via event queue. Because of limitations of the application being tested, and we want to run multiple instances of the application, it has to be run in its own process.

So the main class I run my JUnit test from sets up the environment, then creates a process via ProcessBuilder, and executes that process to spawn a Jemmy worker & target application in the same process/jvm.

My problem is that I want to debug the spawned process and I seem to be unable to do so following all the other Eclipse remote debugging guides. My processbuilder looks like this

ProcessBuilder builder = new ProcessBuilder(
                javaBin,
                "-Xmx512M",
                "-Xdebug",
                "-Xrunjdwp:transport=dt_socket,address=8002,server=y,suspend=y",
                "-cp", classpath, "-Djava.library.path=./native", "-D"
                        + PID_PROP + "=" + newPid, MyJemmyTestHarness.class
                        .getCanonicalName());

No matter what port I specify I get the same error

ERROR: transport error 202: bind failed: Address already in use

I've tried dozens of ports, ones I know that are not in use, and the processbuilder simply refuses to start with a JDWP port open. So I think I have a systematic problem with how I'm trying to do this but I am not very experienced in this area. I have followed the remote debugging guides almost to the letter e.g.:

Remote debugging a Java application http://javarevisited.blogspot.nl/2011/02/how-to-setup-remote-debugging-in.html

Yet the Address Already in Use error persists. Any ideas?

0

There are 0 best solutions below