Closed dtydeman closed 4 years ago
I haven't tried to run any of this on any JRE newer than Java 9. I'm also way back on Maven 3.5.3
and Surefire 2.22.0
The version of Byte Buddy I'm currently depending on is 1.9.5
, but the currently release is 1.10.1
. I don't know if there's anything in the newer releases that would resolve this issue, but it's probably worth a quick spin to see how it goes.
Also, please check for dependency conflicts. These can wreak havoc. Finally, are you really running JUnit 4 on Java 12?
Hi Dan / Scott,
Were you able to find any solution of the reported issue. I'm stuck with the exact issue and looking for your help. I'm also trying to integrate ReportPortal.io with JUnit and referred the steps mentioned in below URL: https://github.com/reportportal/agent-java-junit
Regards, Sandeep
@sandy170889 A dependency tree would be very helpful here. I suspect some sort of conflict.
Hi Scott,
Thanks for your response. Below is pom.xml file details:
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>com.CAP</groupId>
<artifactId>RPDashboard_Project</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>bintray</id>
<url>http://dl.bintray.com/epam/reportportal</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.11.0</version>
</dependency>
<dependency>
<groupId>com.epam.reportportal</groupId>
<artifactId>agent-java-junit</artifactId>
<version>4.1.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.epam.reportportal</groupId>
<artifactId>logger-java-logback</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>com.epam.reportportal</groupId>
<artifactId>logger-java-log4j</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.10.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.10.0</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<!-- This part is only needed for Eclipse IDE users-->
</plugins>
</pluginManagement>
<plugins>
<!-- This plugin provides the path to the Java agent (used in surefire argLine part) -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>getClasspathFilenames</id>
<goals>
<goal>properties</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<!--suppress UnresolvedMavenProperty -->
<argLine>-javaagent:${com.nordstrom.tools:junit-foundation:jar}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
Regards, Sandeep
The POM file is interesting, but not terribly useful for diagnosing dependency conflicts. Run this command and post the output:
mvn dependency:tree -Dverbose
My suspicion is that an older version of the Byte Buddy code generation library is being pulled in by the other agent you're specifying.
Please find the cmd output :
D:\ReportPortalDashboardPOCs\RP_Demo_JUnit>mvn dependency:tree -Dverbose [INFO] Scanning for projects... [INFO] [INFO] --------------------< com.CAP:RPDashboard_Project >--------------------- [INFO] Building RPDashboard_Project 1.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-dependency-plugin:3.1.0:tree (default-cli) @ RPDashboard_Projec t --- [INFO] Verbose not supported since maven-dependency-plugin 3.0 [INFO] com.CAP:RPDashboard_Project:jar:1.0-SNAPSHOT [INFO] +- org.seleniumhq.selenium:selenium-java:jar:3.11.0:compile [INFO] | +- org.seleniumhq.selenium:selenium-api:jar:3.11.0:compile [INFO] | +- org.seleniumhq.selenium:selenium-chrome-driver:jar:3.11.0:compile [INFO] | +- org.seleniumhq.selenium:selenium-edge-driver:jar:3.11.0:compile [INFO] | +- org.seleniumhq.selenium:selenium-firefox-driver:jar:3.11.0:compile [INFO] | +- org.seleniumhq.selenium:selenium-ie-driver:jar:3.11.0:compile [INFO] | +- org.seleniumhq.selenium:selenium-opera-driver:jar:3.11.0:compile [INFO] | +- org.seleniumhq.selenium:selenium-remote-driver:jar:3.11.0:compile [INFO] | +- org.seleniumhq.selenium:selenium-safari-driver:jar:3.11.0:compile [INFO] | +- org.seleniumhq.selenium:selenium-support:jar:3.11.0:compile [INFO] | +- net.bytebuddy:byte-buddy:jar:1.7.9:compile [INFO] | +- org.apache.commons:commons-exec:jar:1.3:compile [INFO] | +- commons-codec:commons-codec:jar:1.10:compile [INFO] | +- commons-logging:commons-logging:jar:1.2:compile [INFO] | +- com.google.code.gson:gson:jar:2.8.2:compile [INFO] | +- com.google.guava:guava:jar:23.6-jre:compile [INFO] | | +- com.google.code.findbugs:jsr305:jar:1.3.9:compile [INFO] | | +- org.checkerframework:checker-compat-qual:jar:2.0.0:compile [INFO] | | +- com.google.errorprone:error_prone_annotations:jar:2.1.3:compile [INFO] | | +- com.google.j2objc:j2objc-annotations:jar:1.1:compile [INFO] | | - org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile [INFO] | +- org.apache.httpcomponents:httpclient:jar:4.5.3:compile [INFO] | +- org.apache.httpcomponents:httpcore:jar:4.4.6:compile [INFO] | +- com.squareup.okhttp3:okhttp:jar:3.9.1:compile [INFO] | - com.squareup.okio:okio:jar:1.13.0:compile [INFO] +- com.epam.reportportal:agent-java-junit:jar:4.1.8:test [INFO] | +- com.epam.reportportal:client-java:jar:4.0.12:runtime [INFO] | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:runtime [INFO] | | | - com.fasterxml.jackson.core:jackson-core:jar:2.9.8:runtime [INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.8:runtime
[INFO] | | +- io.reactivex.rxjava2:rxjava:jar:2.1.16:runtime [INFO] | | | - org.reactivestreams:reactive-streams:jar:1.0.2:runtime [INFO] | | - org.apache.tika:tika-core:jar:1.20:runtime [INFO] | +- com.epam.reportportal:commons-model:jar:4.2.0:runtime [INFO] | | +- io.swagger:swagger-annotations:jar:1.5.13:runtime [INFO] | | - javax.validation:validation-api:jar:1.1.0.Final:runtime [INFO] | +- com.nordstrom.tools:junit-foundation:jar:9.2.0:test [INFO] | | +- com.nordstrom.tools:java-utils:jar:1.8.0:test [INFO] | | +- com.nordstrom.tools:settings:jar:2.2.2:test [INFO] | | | +- org.apache.commons:commons-lang3:jar:3.5:test [INFO] | | | +- org.apache.commons:commons-configuration2:jar:2.2:test [INFO] | | | - commons-beanutils:commons-beanutils:jar:1.9.3:test [INFO] | | | - commons-collections:commons-collections:jar:3.2.2:test [INFO] | | - junit:junit:jar:4.12:test [INFO] | | - org.hamcrest:hamcrest-core:jar:1.3:test [INFO] | - com.google.inject:guice:jar:4.1.0:test [INFO] | +- javax.inject:javax.inject:jar:1:test [INFO] | - aopalliance:aopalliance:jar:1.0:test [INFO] +- com.epam.reportportal:logger-java-logback:jar:4.0.0:compile [INFO] +- ch.qos.logback:logback-classic:jar:1.2.3:compile [INFO] | +- ch.qos.logback:logback-core:jar:1.2.3:compile [INFO] | - org.slf4j:slf4j-api:jar:1.7.25:compile [INFO] +- com.epam.reportportal:logger-java-log4j:jar:4.0.1:compile [INFO] +- org.apache.logging.log4j:log4j-api:jar:2.10.0:compile [INFO] - org.apache.logging.log4j:log4j-core:jar:2.10.0:compile [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.553 s [INFO] Finished at: 2019-12-09T03:46:45-06:00 [INFO] ------------------------------------------------------------------------
It wasn't the other agent that was bringing in the old version of Byte Buddy... it was Selenium 3.11.0 - specifically selenium-java
Try adding a dependency management section to your POM to see if that helps:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>1.10.3</version>
</dependency>
</dependencies>
</dependencyManagement>
This will ensure that the expected release of Byte Buddy is being used.
Depending on the complexity of your Selenium automation, you may also want to take a look at the Selenium Foundation library.
By the way... depending on the selenium-java
library brings in transitive dependencies that you probably don't need that can lead to these sorts of dependency conflicts. In Selenium Foundation
, the only direct dependency is selenium-server
, and I exclude almost all of its transitive dependency.
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
</exclusion>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-edge-driver</artifactId>
</exclusion>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
</exclusion>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-ie-driver</artifactId>
</exclusion>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-opera-driver</artifactId>
</exclusion>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
</exclusion>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-safari-driver</artifactId>
</exclusion>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
</exclusion>
<exclusion>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
</exclusion>
</exclusions>
</dependency>
For my unit tests, I use the HtmlUnit browser. Depending on the complexity of the web application you're interacting with and the specifics of your test cases, this may be an option for you. The advantages are speed and portability. The downside is that this browser uses a different JavaScript engine than every other "real" browser, which means that some things behave differently and other things don't work at all.
No response from OP for more than a month. If you're still having trouble, you can contact me through the email in my GitHub profile.
Hey, not sure if there is a planned change already but I've encountered an issue with the LifecycleHooks class in the installTransformer method. If I try and run my JUnit tests passing the junit-foundation-11.0.1.jar as a javaagent i'm getting the following error:
Caused by: java.lang.NoSuchMethodError: net.bytebuddy.pool.TypePool$Default.ofSystemLoader()Lnet/bytebuddy/pool/TypePool; at com.nordstrom.automation.junit.LifecycleHooks.installTransformer(LifecycleHooks.java:72) at com.nordstrom.automation.junit.LifecycleHooks.premain(LifecycleHooks.java:62)
Looks like that
ofSystemLoader()
currently can't be found.I've come across this while trying to get an instance of ReportPortal working and my delving lead me to find this. Whenever I tried running via Maven Surefire I was getting the following error in the 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)
So i tried tracing down to see if it was surefire or an issue in the code. Based on the description provided in ReportPortal documentation "using IDE Run configurations" I supplied the Javaagent in the VM options and identified an issue in this method call.
Here's a snippet of what happens when I try running a basic test in IntelliJ with the javaagent set in the IDE run configuration (don't mind the extra colours, red's still the bad guy here):
For reference I'm using Maven v5.3.4, JDK 12.0.2, junit-foundation-11.0.1.jar (and when running via maven, surefire v3.0.0-M3). Not sure if this could have had an impact but if it does please let me know.