在tomcat remote 7上使用Arquillian运行JUnit尝试加载... remote_6.TomcatRemoteExtension

时间:2013-09-30 18:55:05

标签: tomcat7 jboss-arquillian

我想在tomcat remote 7上使用Arquillian运行我的测试。这是一个非常简单的例子来重现我的问题。

pom依赖

<dependencies>
    <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <version>1.1.1.Final</version>
        <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.container</groupId>
      <artifactId>arquillian-tomcat-remote-7</artifactId>
      <version>1.0.0.CR5</version>
      <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>${servlet.version}</version>
        <scope>test</scope>
    </dependency>

</dependencies>

arqullian.xml

http://jboss.org/schema/arquillian/arquillian_1_0.xsd“&GT;

<container qualifier="tomcat-remote-7">
    <configuration>
        <property name="host">localhost</property>
        <property name="jmxPort">8089</property>
        <property name="bindHttpPort">8080</property>
        <property name="user">arquillian</property>
        <property name="pass">arquillian</property>
    </configuration>
</container>

SimpleTest.java

@RunWith(Arquillian.class)
public class SimpleTest {
@Deployment
@OverProtocol("Servlet 3.0")
public static Archive<WebArchive> createDeployment()    {
    File warFile = new File("../myproject/target/mywar.war");
    WebArchive webArchive = ShrinkWrap.createFromZipFile(WebArchive.class, warFile);
    return webArchive;
}

@Test
public void testSimple() {
    assertTrue(true);
}

}

运行SimpleTest后,我得到了很长的堆栈跟踪,最后我看到了:

Caused by: java.lang.ClassNotFoundException: 
org.jboss.arquillian.container.tomcat.remote_6.TomcatRemoteExtension

我想知道为什么它在依赖版本7中尝试加载版本6的TomcatRemoteExtension

1 个答案:

答案 0 :(得分:0)

看起来扩展程序未正确注册。

在arquillian-tomcat-remote-7.jar中查找文件META-INF / services / org.jboss.arquillian.core.spi.LoadableExtension并进行编辑。

您应该看到对remote_6的错误引用。将它更改为remote_7,一切都应该按预期工作。

似乎已在主人:https://github.com/arquillian/arquillian-container-tomcat/commit/3084c7f1be4320cc4e795385e4513f25f6d5a0e0

中修复