Closed epomatti closed 4 years ago
@famod I was trying it right now, it didn't work:
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-jacoco-with-asm</artifactId>
<version>1.1.0</version>
<scope>test</scope>
</dependency>
appendAsmLibrary
set to true
<extension qualifier="jacoco">
<property name="excludes">org.**;com.**</property>
<property name="includes">solid.**</property>
<property name="appendAsmLibrary">true</property>
</extension>
Hm, seems the javassist version used by Hibernate 5.3.17.Final is too old: https://github.com/jboss-javassist/javassist/issues/270 (3.23.2-GA according to https://mvnrepository.com/artifact/org.hibernate/hibernate-core/5.3.17.Final)
I tried this but it didn't work. Should it?
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.3.17.Final</version>
<exclusions>
<exclusion>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.27.0-GA</version>
</dependency>
This is not so easy for WildFly. You'll have to (try to) update the javassist module in the server. Since even Hibernate 5.4 is still on javassist 3.24.0 (and 3.26.0 is required), the question arises whether Hibernate 5.3 is compatible with javassist 3.26.0+ at all...
Yeah I came to the same conclusion here, too much time away from WildFly... I'll have to change the module.
Even Hibernate 6 is not yet using javassist 3.26.0, so not even that is an option.
Reported it to them: https://hibernate.atlassian.net/browse/HHH-14158
Can you think of any other alternative to get coverage with Arquillian and WildFly? I could run JaCoCo in another server like Glassfish, OpenLiberty, etc.
Thanks a lot @famod for stepping up and helping @epomatti!
I have the same kind of error when my build runs on our jenkins server (running maven 3.5.3 and openjdk 11.0.2) but it works without any problem on my local computer (debian 10 running maven 3.6 and openjdk 11.0.8). How is it possible?? I'm using wildfly 20.0.1, arquillian 1.7.0.Alpha4 and arquillian-jacoco 1.1.0.
@Zlika Hm, maybe related to the minor JDK version difference, but I doubt it. The Maven version is even less likely. You could try using 11.0.2 locally or vice versa (11.0.8 on jenkins).
@famod I tried to reproduce the bug on my computer with openjdk 11.0.2 and maven 3.5.3 (to have a similar configuration than my jenkins server) and I cannot reproduce the bug! So it must be linked to the jenkins server itself in a way or another.
I'm having the same issue. I also tried to exclude the Wildfly Javassit module with jboss-deployment-structure.xml but with no luck. If you find a solution please let me know!
Thank you.
Hi @fabrii . Based on @famod analysis I made a workaround. Here is my test setup (including the workaround):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>integration-test</id>
<goals><goal>integration-test</goal></goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<!-- Download and unzip Wildfly in target folder for integration tests -->
<execution>
<id>unpack</id>
<phase>pre-integration-test</phase>
<goals><goal>unpack</goal></goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-dist</artifactId>
<version>${wildfly.version}</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<!-- We have to configure the maven-dependency-plugin to copy the necessary dependencies to the target folder.
These libraries will be assembled into the war-archive by ShrinkWrap once we run the test. -->
<execution>
<id>copy-test-libs</id>
<phase>pre-integration-test</phase>
<goals><goal>copy-dependencies</goal></goals>
<configuration>
<stripVersion>true</stripVersion>
<outputDirectory>${project.build.directory}/test-libs</outputDirectory>
<includeScope>runtime</includeScope>
<useSubDirectoryPerScope>true</useSubDirectoryPerScope>
</configuration>
</execution>
<!--
Workaround for bug https://github.com/arquillian/arquillian-extension-jacoco/issues/84.
This bug only occurs during the build on the Jenkins server, not on my computer (?!?).
The workaround is to upgrade the javassist-3.23.2-GA.jar Wildfly module used by Hibernate
to version 3.26.0-GA which fixes https://github.com/jboss-javassist/javassist/issues/270.
This workaround only applies to (and is only needed with) the Wildfly instance used for integration tests.
-->
<!-- Step 1: add new javassist-3.26.0-GA.jar file in the Wildfly distribution used for integration tests -->
<execution>
<id>copy-javassist</id>
<phase>pre-integration-test</phase>
<goals><goal>copy</goal></goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.26.0-GA</version>
<type>jar</type>
<outputDirectory>${project.build.directory}/wildfly-${wildfly.version}/modules/system/layers/base/org/javassist/main</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>pre-integration-test</phase>
<goals><goal>run</goal></goals>
<configuration>
<target>
<!-- Step 2: remove Wildfly built-in javassist module -->
<delete>
<fileset dir="${project.build.directory}/wildfly-${wildfly.version}/modules/system/layers/base/org/javassist/main" includes="javassist-3.23.2-GA.jar"/>
</delete>
<!-- Step 3: patch Wildfly javassist's module.xml file to use the new version of the artifact -->
<replace token="javassist-3.23.2-GA.jar" value="javassist-3.26.0-GA.jar" dir="${project.build.directory}/wildfly-${wildfly.version}/modules/system/layers/base/org/javassist/main">
<include name="module.xml"/>
</replace>
</target>
</configuration>
</execution>
</executions>
</plugin>
<!-- End of workaround -->
@Zlika I'm actually using a remote wildfly instance for IT, so I only had to replace the library in the modules folder without changing my pom.xml. I prefer this approach so the IT server can be always up. I thought that replacing that library was going to mess things up with hibernate but it actually worked! I did some tests with search and save operations without problems.
Thank you!
@Zlika if possible to exclude javassist
module in the jboss-deployment descriptor, and include a copy of javassist
in the project deps.
Java: openjdk 11.0.8 2020-07-14 WildFly: 20.0.1.Final OS: Ubuntu 20.04
I'm getting this error when adding the Jacoco extension and running my tests with
mvn test
:My
arquillian.xml
I tried removing the Hibernate lib but it didn't do any effect:
My
pom.xml
profile:This is the complete stacktrace: