1
我試圖建立的Arquillian已經定義,我總是得到一個堆棧跟蹤:的Arquillian - 組件模塊
13:37:29,432 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."6bf136f5-6ea1-43e0-a521-76250a489921.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."6bf136f5-6ea1-43e0-a521-76250a489921.war".PARSE: Failed to process phase PARSE of deployment "6bf136f5-6ea1-43e0-a521-76250a489921.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_71]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_71]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]
Caused by: java.lang.IllegalArgumentException: JBAS011046: A component named 'ValidationServiceImpl' is already defined in this module
at org.jboss.as.ee.component.EEModuleDescription.addComponent(EEModuleDescription.java:137)
at org.jboss.as.ejb3.deployment.processors.EJBComponentDescriptionFactory.addComponent(EJBComponentDescriptionFactory.java:60)
at org.jboss.as.ejb3.deployment.processors.SessionBeanComponentDescriptionFactory.processSessionBeans(SessionBeanComponentDescriptionFactory.java:157)
at org.jboss.as.ejb3.deployment.processors.SessionBeanComponentDescriptionFactory.processAnnotations(SessionBeanComponentDescriptionFactory.java:86)
at org.jboss.as.ejb3.deployment.processors.AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.processAnnotations(AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.java:58)
at org.jboss.as.ejb3.deployment.processors.AbstractDeploymentUnitProcessor.deploy(AbstractDeploymentUnitProcessor.java:81)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
我的Arquillian測試設置以下列方式:
@RunWith(Arquillian.class)
public class ECadDocumentServiceImplTestIT {
private static final boolean RECURSIVE = true;
static Logger logger = Logger.getLogger(ECadDocumentServiceImplTestIT.class);
@Inject
private ECadDocumentService eCadDocumentService;
@Deployment
public static WebArchive getServiceDeployment() {
File settingsFile = new File(System.getProperty("maven.execution.global-settings"));
File pomFile = new File(System.getProperty("maven.execution.pom-file"));
File[] libs = Maven.configureResolver()
.fromFile(settingsFile)
.loadPomFromFile(pomFile)
.importRuntimeAndTestDependencies().resolve().withTransitivity().asFile();
WebArchive war = ShrinkWrap.create(WebArchive.class)
.addAsLibraries(libs)
.addPackages(true, ECadDocumentService.class.getPackage())
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("test-persistence.xml", "META-INF/persistence.xml");
return war;
}
@Test
public void test() throws EcadError {
ApplicationIdentification applicationIdent = ApplicationIdentificationMother.valid(0);
DocumentTreatmentResponse dtr = eCadDocumentService.addDocument(ApplicantIdentityMother.valid(), applicationIdent, DocumentIdentificationMother.valid(), DocumentFingerprintMother.valid());
assertEquals(applicationIdent.getApplicationId(), dtr.getApplicationID());
}
}
我正在添加libs,因爲我使用的是apache.commons.net依賴項。否則,我會得到一個「classNotFoundException」。
有沒有人有任何想法?我沒有兩次獲得名爲'ValidationServiceImpl'的類。