在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,但这会导致相同的错误。我们还尝试使用“新” 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>
仍然没有改善。
答案 0 :(得分:1)
遇到同样的问题。据我所知Arquillian Chameleon仍然 不能在Java 11(仅Java 8)上运行。