我有一个标准的Arquillian测试:
@RunWith(Arquillian.class)
public class MyTest {
@Deployment
public static JavaArchive createDeployment() {
return ShrinkWrap.create(JavaArchive.class)
.addAsManifestResource("META-INF/beans.xml", "beans.xml")
.addAsManifestResource("META-INF/persistence.xml", "persistence.xml");
}
@Test
public void test() throws Exception {
System.out.println("MyTest.test()");
}
}
使用以下 arquillian.xml 连接到WildFly 16:
<?xml version="1.0" encoding="UTF-8"?>
<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="jboss" default="true">
<configuration>
<property name="jbossHome">wildfly-16.0.0.Final/</property>
<property name="serverConfig">standalone.xml</property>
<property name="javaVmArguments">--add-modules java.se</property>
</configuration>
</container>
</arquillian>
开始测试会带来以下异常:
org.jboss.arquillian.container.spi.client.container.LifecycleException: Could not start container
at org.jboss.as.arquillian.container.managed.ManagedDeployableContainer.startInternal(ManagedDeployableContainer.java:168)
at org.jboss.as.arquillian.container.CommonDeployableContainer.start(CommonDeployableContainer.java:123)
at org.jboss.arquillian.container.impl.ContainerImpl.start(ContainerImpl.java:179)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$8.perform(ContainerLifecycleController.java:137)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$8.perform(ContainerLifecycleController.java:133)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forContainer(ContainerLifecycleController.java:208)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.startContainer(ContainerLifecycleController.java:133)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Caused by: java.util.concurrent.TimeoutException: Managed server was not started within [60] s
at org.jboss.as.arquillian.container.managed.ManagedDeployableContainer.startInternal(ManagedDeployableContainer.java:161)
... 64 more
This question看起来很相似,但是它是用于完全不同的JBoss版本,并且managementPort
用于我的项目。
如何让Arquillian连接到服务器?