Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Arquillian Chameleon Container with Java 11

we have following problem with starting a Arquillian-Test with Chameleon-Container and Wildfly 14 in a Java 11.0.2 (OpenJDK 11) environment. We use maven as the build tool.

After starting the test, it stopped with following error:

[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ arquillian-tutorial ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running de.evodion.arquillian.example.GreeterTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.581 s <<< FAILURE! - in de.evodion.arquillian.example.GreeterTest
[ERROR] de.evodion.arquillian.example.GreeterTest  Time elapsed: 1.579 s  <<< ERROR!
java.lang.NoClassDefFoundError: java/sql/Date
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
Caused by: java.lang.ClassNotFoundException: java.sql.Date
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)

In a Java 8 environment, the setting works. We already changed the surefire plugin version from 3.0.0M3 back to 2.22.0, because this plugin version lead to the same error.

A minimal pom to test this behaviour:

<?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">
<modelVersion>4.0.0</modelVersion>

<groupId>de.evodion.arquillian.example</groupId>
<artifactId>arquillian-tutorial</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>arquillian-tutorial</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <version.org.wildfly>14.0.1.Final</version.org.wildfly>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
                <source>11</source>
                <target>11</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.0</version>
            <configuration>
                <reuseForks>false</reuseForks>
                <systemPropertyVariables>
                    <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                    <jboss.home>${project.build.directory}\wildfly-${version.org.wildfly}</jboss.home>
                    <module.path>${project.build.directory}\wildfly-${version.org.wildfly}\modules</module.path>
                </systemPropertyVariables>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>org.jboss.arquillian</groupId>
        <artifactId>arquillian-bom</artifactId>
        <version>1.4.1.Final</version>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>org.jboss.spec</groupId>
        <artifactId>jboss-javaee-7.0</artifactId>
        <version>1.1.1.Final</version>
        <type>pom</type>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <version>1.4.1.Final</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.arquillian.container</groupId>
        <artifactId>arquillian-chameleon-junit-container-starter</artifactId>
        <version>1.0.0.CR5</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.logmanager</groupId>
        <artifactId>jboss-logmanager</artifactId>
        <version>2.1.8.Final</version>
        <scope>test</scope>
    </dependency>
</dependencies>

The arquillian xml to use with the chameleon container:

<arquillian xmlns="http://jboss.org/schema/arquillian"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
        http://jboss.org/schema/arquillian
        http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

    <container qualifier="chameleon" default="true">
        <configuration>
            <property name="javaVmArguments">--add-modules java.se</property>
            <property name="chameleonTarget">wildfly:14.0.1.Final:managed</property>
            <property name="serverConfig">standalone-full.xml</property>
        </configuration>
    </container>

</arquillian>

We tried using wildfly 16 in the arquillian.xml file, but that leads to the same error. We also tried using the "new" junit 4.13-beta-2, same error. We tried using java 11.0.1(OpenJDK) and the release canditate java 12 (OpenJDK). In the arquillian.xml file we tried adding the sql module with

<property name="javaVmArguments">--add-modules java.se,java.sql</property>

still no improvement.

like image 563
Bam Kenobi Avatar asked Mar 17 '26 18:03

Bam Kenobi


1 Answers

Stuck with same problem. To my knowlede Arquillian Chameleon still not capable to run on Java 11 (only Java 8).

like image 86
Bernd Müller Avatar answered Mar 20 '26 09:03

Bernd Müller