Hi,
I am getting the foll. exception when I try to get the dump on a port connecting to the server where the jacoco agent is running
My goal is to capture the test coverage after evety test is run, henc I am calling the jacoco dumper
I have the jacoco agent running with below params:
set the foll in weblogic appserver
JAVA_OPTIONS="${JAVA_OPTIONS} -
javaagent:/podscratch/jacoco/jacocoagent.jar=output=tcpserver,address=xxxxx,port
=6015,append=false,dumponexit=false,classdumpdir=/podscratch/classdumpdir,destfile=/podscratch/co
verage/coverage.exec"
Exception:
--------------------------------------
I get the below exception while it reads from the dumper:
Exception in thread "main" java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.DataInputStream.readByte(Unknown Source)
at org.jacoco.core.data.ExecutionDataReader.read(ExecutionDataReader.jav
a:82)
at JacocoDumper.main(JacocoDumper.java:58)
My dumper code is something like this:
ublic class JacocoDumper{
private static final String DESTFILE = "jacoco-client.exec";
private static final int PORT = 6015;
public static void main(String args[]) throws Exception{
//command to run the test
String[] out1 = runCommand("java -jar REEATSGenericCLI.jar -action=execute -test_set_path="Test1" );
String jobId = null;
System.out.println((jobId= out1[0].split("job id=\"")[1].split("\"")[0]));
String[] out2 = null;
for(;;){
Thread.sleep(1000);
out2 = runCommand("java -jar ALM\\REEATSGenericCLI.jar -action=status -job_id=\""+jobId+"\"");
if(!out2[1].contains("Given job not found."))
break;
}
}
System.out.println(out2[0]);
final FileOutputStream localFile = new FileOutputStream(DESTFILE);
final ExecutionDataWriter localWriter = new ExecutionDataWriter(
localFile);
// Open a socket to the coverage agent:
final Socket socket = new Socket(InetAddress.getByName(ADDRESS), PORT);
final RemoteControlWriter writer = new RemoteControlWriter(
socket.getOutputStream());
final RemoteControlReader reader = new RemoteControlReader(
socket.getInputStream());
reader.setSessionInfoVisitor(localWriter);
reader.setExecutionDataVisitor(localWriter);
// Send a dump command and read the response:
System.out.println("before dump ");
writer.visitDumpCommand(true, true);
System.out.println("after dump read");
if (!reader.read()) {
throw new IOException("Socket closed unexpectedly.");
}
socket.close();
localFile.close();
}
Any idea on waht the issue?
thanks