Arquillian-> org.jboss.arquillian.container.spi.client.container.DeploymentException:无法部署test.war

时间:2018-08-15 11:24:27

标签: java unit-testing jboss-arquillian

我的测试电话有问题。我总是得到这个异常,我没有找到解决方案。谁能帮我这个例外? 我想在Arquillian容器中测试一个春季项目 这是我的部署课程

public final class Deployments {
private Deployments() {
}

@Deployment

public static JavaArchive createDeployment() {



    return ShrinkWrap.create(JavaArchive.class)
            .addClass(AutoTest.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

}

这是我的测试班

@RunWith(Arquillian.class)
@ContextConfiguration(classes = {WebAppConfigTest.class})

@WebAppConfiguration("src/test/webapp")

@FixMethodOrder(MethodSorters.NAME_ASCENDING)

public class AutoTest {

@Autowired
 WebApplicationContext context;
@Deployment
public static Archive createTestArchive() {

    return Deployments.createDeployment();

}
 @Test
public void FindTest() throws Exception {
    mockMvc = MockMvcBuilders.webAppContextSetup(context).build();
    request = MockMvcRequestBuilders.get("/question/find/" + s).accept(MediaType.APPLICATION_JSON);
    res = mockMvc.perform(request).andReturn();
    System.out.println("****************************AfterFind: " + res.getResponse().getContentAsString());
}

我遇到了例外

org.jboss.arquillian.container.spi.client.container.DeploymentException: Cannot deploy test.war: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"test.war\".WeldStartService" => "Failed to start service
Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy"},"WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"test.war\".component.\"org.jboss.weld.module.web.servlet.WeldTerminalListener\".WeldInstantiator","jboss.deployment.unit.\"test.war\".component.\"com.sun.faces.config.ConfigureListener\".WeldInstantiator","jboss.deployment.unit.\"test.war\".component.\"org.jboss.weld.module.web.servlet.WeldTerminalListener\".START","jboss.deployment.unit.\"test.war\".component.\"javax.faces.webapp.FacetTag\".START","jboss.undertow.deployment.default-server.default-host./test","jboss.deployment.unit.\"test.war\".component.\"com.sun.faces.config.ConfigureListener\".START","jboss.deployment.unit.\"test.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".WeldInstantiator","jboss.deployment.unit.\"test.war\".weld.weldClassIntrospector","jboss.deployment.unit.\"test.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".WeldInstantiator","jboss.deployment.unit.\"test.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".START","jboss.deployment.unit.\"test.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".START","jboss.undertow.deployment.default-server.default-host./test.UndertowDeploymentInfoService","jboss.deployment.unit.\"test.war\".component.\"javax.faces.webapp.FacetTag\".WeldInstantiator","jboss.deployment.unit.\"test.war\".component.\"org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner\".START","jboss.deployment.unit.\"test.war\".ee.ComponentRegistry","jboss.deployment.unit.\"test.war\".component.\"org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner\".WeldInstantiator","jboss.deployment.unit.\"test.war\".component.\"org.jboss.weld.module.web.servlet.WeldInitialListener\".WeldInstantiator","jboss.deployment.unit.\"test.war\".component.\"org.jboss.weld.module.web.servlet.WeldInitialListener\".START"],"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"test.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".START is missing [jboss.deployment.unit.\"test.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".WeldInstantiator]","jboss.deployment.unit.\"test.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".START is missing [jboss.deployment.unit.\"test.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".WeldInstantiator]","jboss.deployment.unit.\"test.war\".component.\"org.jboss.weld.module.web.servlet.WeldTerminalListener\".START is missing [jboss.deployment.unit.\"test.war\".component.\"org.jboss.weld.module.web.servlet.WeldTerminalListener\".WeldInstantiator]","jboss.deployment.unit.\"test.war\".component.\"org.jboss.weld.module.web.servlet.WeldInitialListener\".START is missing [jboss.deployment.unit.\"test.war\".component.\"org.jboss.weld.module.web.servlet.WeldInitialListener\".WeldInstantiator]","jboss.undertow.deployment.default-server.default-host./test.UndertowDeploymentInfoService is missing [jboss.deployment.unit.\"test.war\".ee.ComponentRegistry]","jboss.deployment.unit.\"test.war\".component.\"javax.faces.webapp.FacetTag\".START is missing [jboss.deployment.unit.\"test.war\".component.\"javax.faces.webapp.FacetTag\".WeldInstantiator]","jboss.deployment.unit.\"test.war\".component.\"com.sun.faces.config.ConfigureListener\".START is missing [jboss.deployment.unit.\"test.war\".component.\"com.sun.faces.config.ConfigureListener\".WeldInstantiator]","jboss.deployment.unit.\"test.war\".ee.ComponentRegistry is missing [jboss.deployment.unit.\"test.war\".weld.weldClassIntrospector]","jboss.undertow.deployment.default-server.default-host./test is missing [jboss.deployment.unit.\"test.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".START, jboss.deployment.unit.\"test.war\".component.\"org.jboss.weld.module.web.servlet.WeldInitialListener\".START, jboss.deployment.unit.\"test.war\".component.\"org.jboss.weld.module.web.servlet.WeldTerminalListener\".START, jboss.undertow.deployment.default-server.default-host./test.UndertowDeploymentInfoService, jboss.deployment.unit.\"test.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".START, jboss.deployment.unit.\"test.war\".component.\"javax.faces.webapp.FacetTag\".START, jboss.deployment.unit.\"test.war\".component.\"org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner\".START, jboss.deployment.unit.\"test.war\".component.\"com.sun.faces.config.ConfigureListener\".START]","jboss.deployment.unit.\"test.war\".component.\"org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner\".START is missing [jboss.deployment.unit.\"test.war\".component.\"org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner\".WeldInstantiator]","jboss.deployment.unit.\"test.war\".WeldEndInitService is missing [jboss.deployment.unit.\"test.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".START, jboss.deployment.unit.\"test.war\".component.\"org.jboss.weld.module.web.servlet.WeldInitialListener\".START, jboss.deployment.unit.\"test.war\".component.\"org.jboss.weld.module.web.servlet.WeldTerminalListener\".START, jboss.deployment.unit.\"test.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".START, jboss.deployment.unit.\"test.war\".component.\"javax.faces.webapp.FacetTag\".START, jboss.deployment.unit.\"test.war\".component.\"org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner\".START, jboss.deployment.unit.\"test.war\".component.\"com.sun.faces.config.ConfigureListener\".START]","jboss.deployment.unit.\"test.war\".deploymentCompleteService is missing [jboss.undertow.deployment.default-server.default-host./test, jboss.deployment.unit.\"test.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".START, jboss.deployment.unit.\"test.war\".component.\"org.jboss.weld.module.web.servlet.WeldInitialListener\".START, jboss.deployment.unit.\"test.war\".component.\"org.jboss.weld.module.web.servlet.WeldTerminalListener\".START, jboss.deployment.unit.\"test.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".START, jboss.deployment.unit.\"test.war\".component.\"javax.faces.webapp.FacetTag\".START, jboss.deployment.unit.\"test.war\".component.\"org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner\".START, jboss.deployment.unit.\"test.war\".component.\"com.sun.faces.config.ConfigureListener\".START]"]}}}

我希望有人能帮助我

1 个答案:

答案 0 :(得分:0)

尝试将breackpoint添加到sun.reflect.annotation.TypeNotPresentExceptionProxy构造函数以检查根本原因。可能您缺少一些应该导入的类依赖项。