到目前为止,我一直在使用JBOSS 7和Arquillian测试框架运行我的集成测试。我一直将偏移量设置为100,这很好,但现在我想将集成测试作为托管转移到Wildfly,但是相同的测试失败,但会出现以下错误:
arquillianBeforeSuite(com.aeroflex.teravm.selfinstall.core.ejb.SampleServiceIT)时间过去了: 130.749秒<<<失败!org.jboss.arquillian.container.spi.client.container.LifecycleException:无法启动容器
这是我的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">
<!-- <defaultProtocol type="Servlet 3.1"/> -->
<container qualifier="wildfly-managed" default="true">
<configuration>
<property name="jbossHome">target/wildfly-8.0.0.Final</property>
<property name="serverConfig">standalone.xml</property>
<property name="outputToConsole">true</property>
<property name="javaVmArguments">-Djboss.socket.binding.port-offset=100</property>
</configuration>
</container>
</arquillian>以及其中一个集成测试的示例:
public class SampleServiceIT extends BaseServiceIT
{
@Inject
private SampleService sampleService;
@Parameters(ARQUILLIAN_DATA_PROVIDER)
@Test(groups = {"integration"})
public void testGetNotExisting() throws ServiceException
{
Long id = new Long(5);
SampleBean result = sampleService.getSampleObjectById(id);
Assert.assertNull(result);
}
}如果我不更改端口偏移量,只保留缺省值,就可以正常工作。
谢谢你提前提供帮助。
发布于 2014-06-17 13:30:18
我解决了问题。我错过了需要设置的managementPort属性。
<property name="managementPort">10090</property>完整的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">
<!-- <defaultProtocol type="Servlet 3.1"/> -->
<container qualifier="wildfly-managed" default="true">
<configuration>
<property name="jbossHome">target/wildfly-8.0.0.Final</property>
<property name="serverConfig">standalone.xml</property>
<property name="outputToConsole">true</property>
<property name="javaVmArguments">-Djboss.socket.binding.port-offset=100</property>
<property name="managementPort">10090</property>
</configuration>
</container>
</arquillian>发布于 2015-01-30 19:29:57
如果您中的一些人正在通过maven运行类似于Arquillian的测试,并且使用的是嵌入式容器,则arquillian.xml中的arquillian.xml将被忽略。
您需要在pom.xml中设置JVM参数:
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>-Djboss.socket.binding.port-offset=300</argLine>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
</systemPropertyVariables>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
</configuration>
</plugin>注意:这是maven-故障安全插件的配置(也就是说,如果您的测试是*IT.java)。如果您的Arquillian测试是*Test.java,那么您需要配置maven-surefireplugin。
https://stackoverflow.com/questions/24259564
复制相似问题