reportportal / agent-java-junit

Report Portal agent for JUnit 4
Apache License 2.0
11 stars 17 forks source link

FATAL ERROR when processing javaagent #46

Closed dtydeman closed 4 years ago

dtydeman commented 5 years ago

Hey guys,

I've been trying to integrate this into an existing project of mine for a little while but am hitting a nasty roadblock on the running of the javaagent introduced through the nordstrom dependency and access through the maven surefire plugin. Every time that I try and trigger a test execution through surefire i get the following error in my dumpstream:

Corrupted STDOUT by directly writing to native stream in forked JVM 1. Stream 'FATAL ERROR in native method: processing of -javaagent failed'.
java.lang.IllegalArgumentException: Stream stdin corrupted. Expected comma after third character in command 'FATAL ERROR in native method: processing of -javaagent failed'.
    at org.apache.maven.plugin.surefire.booterclient.output.ForkClient$OperationalData.<init>(ForkClient.java:507)
    at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.processLine(ForkClient.java:210)
    at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.consumeLine(ForkClient.java:177)
    at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer$Pumper.run(ThreadedStreamConsumer.java:88)
    at java.base/java.lang.Thread.run(Thread.java:835)

I'm attempting to utilise the ReportPortal log4j logger dependency as I already have log4j setup in my project, and I'm running with JUnit 4.12 (though I have removed this dependency in attempt to utilise this dependency instead).

I'm currently running on Windows10, with JDK12.0.2 and Maven 3.5.2. I have also tried downgrading to JDK8 (ncluding changing the maven compiler reference to bring this in line with the expected JDK), but this has no impact on the error produced.

The error produced is triggered when I attempt to run my maven tests with the following cli command via IntelliJ IDEA terminal: mvn -pl :<project name> -am clean test -Dtest="<test name>"

Attached are the dumpstream logs generated on my latest run attempt. For reference I'm using the suggested plugins for maven-dependency-plugin (v3.1.1) and maven-surefire-plugin (v3.0.0-M3). Thanks in advance for any help with this.

2019-08-01T11-07-33_775.txt 2019-08-01T11-07-33_775-jvmRun1.txt

dtydeman commented 4 years ago

Any help with this? Still encountering the issue and quite frustrating I can't find anything related to it (probably means I've done something incredibly simple & stupid)

ivy-cst commented 4 years ago

I think the reportportal properties can not be loaded by your forked test jvm. Be sure that the reportportal.properties can be loaded or that you set the java system properties on your forked jvm as well.

dassio commented 4 years ago

I think the reportportal properties can not be loaded by your forked test jvm. Be sure that the reportportal.properties can be loaded or that you set the java system properties on your forked jvm as well.

i am facing the same problem, how can i make sure the JVM can read the reportportal properties file ?

dassio commented 4 years ago

i think this problem comes from using agent-java-junit with java8, after switching to agent-java-junit5, i can use this integration

sbabcoc commented 4 years ago

Are folks still stuck on this issue? If you're running a Selenium project, you may be hitting this compatibility problem: https://github.com/Nordstrom/JUnit-Foundation/issues/55

HardNorth commented 4 years ago

@dtydeman Any updates? Did you manage to solve the issue?

sbabcoc commented 4 years ago

@HardNorth As indicated by the issue that I linked to previously, you're hitting a mixed version problem. In Maven and Gradle, you can lock in the required version of Byte Buddy (1.9.5 for the release of JUnit Foundation currently used by agent-java-junit).

There's a newer release of JUnit Foundation (11.2.0) that depends on Byte Buddy 1.10.3. Depending on the nature of your version compatibility conflict, agent-java-junit may need to be upgraded to this new JUnit Foundation release.

HardNorth commented 4 years ago

@sbabcoc OK, thanks for the explanation, I'm going to fix issues with JUnit 4 soon, so most likely update it with the latest Foundation version.

HardNorth commented 4 years ago

I think we fixed this in agent-java-junit:5.0.0-BETA-9, so I'm closing it for now, feel free to reopen in case if the problem is not resolved.