Arquillian 变色龙容器 Java 11
Arquillian Chameleon Container with Java 11
我们在 Java 11.0.2 (OpenJDK 11) 环境中使用 Chameleon-Container 和 Wildfly 14 启动 Arquillian-Test 时遇到以下问题。我们使用 maven 作为构建工具。
开始测试后,它因以下错误而停止:
[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)
在 Java 8 环境中,该设置有效。
我们已经将 surefire 插件版本从 3.0.0M3 改回 2.22.0,因为这个插件版本导致了同样的错误。
用于测试此行为的最小 pom:
<?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>
与变色龙容器一起使用的 arquillian xml:
<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>
我们尝试在 arquillian.xml 文件中使用 wildfly 16,但这会导致同样的错误。我们也尝试使用 "new" junit 4.13-beta-2,同样的错误。
我们尝试使用 java 11.0.1(OpenJDK) 和候选版本 java 12 (OpenJDK)。
在 arquillian.xml 文件中,我们尝试添加带有
的 sql 模块
<property name="javaVmArguments">--add-modules java.se,java.sql</property>
仍然没有改善。
遇到同样的问题。据我所知,Arquillian Chameleon 仍然
无法在 Java 11 上 运行(仅 Java 8)。
我们在 Java 11.0.2 (OpenJDK 11) 环境中使用 Chameleon-Container 和 Wildfly 14 启动 Arquillian-Test 时遇到以下问题。我们使用 maven 作为构建工具。
开始测试后,它因以下错误而停止:
[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)
在 Java 8 环境中,该设置有效。 我们已经将 surefire 插件版本从 3.0.0M3 改回 2.22.0,因为这个插件版本导致了同样的错误。
用于测试此行为的最小 pom:
<?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>
与变色龙容器一起使用的 arquillian xml:
<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>
我们尝试在 arquillian.xml 文件中使用 wildfly 16,但这会导致同样的错误。我们也尝试使用 "new" junit 4.13-beta-2,同样的错误。 我们尝试使用 java 11.0.1(OpenJDK) 和候选版本 java 12 (OpenJDK)。 在 arquillian.xml 文件中,我们尝试添加带有
的 sql 模块<property name="javaVmArguments">--add-modules java.se,java.sql</property>
仍然没有改善。
遇到同样的问题。据我所知,Arquillian Chameleon 仍然 无法在 Java 11 上 运行(仅 Java 8)。