2016-09-27 48 views
4

我加入的Arquillian到我的項目,我開始與HelloWorld示例:的Arquillian:啓動服務器,但不會部署

@RunWith(Arquillian.class) 
public class AccountTest { 
    @Deployment 
    public static JavaArchive createTestArchive() { 
     return ShrinkWrap.create(JavaArchive.class).addClasses(CustomerLookupLocal.class, CustomerLookup.class); 
    } 

    @Test 
    public void shouldBeAbleToReadSysPropAtStartup() { 
     Assert.assertTrue(1 == 1); 
    } 

我加入到我的POM這種依賴:

<dependencyManagement> 
     <dependencies> 
      <dependency> 
       <groupId>org.jboss.arquillian</groupId> 
       <artifactId>arquillian-bom</artifactId> 
       <version>${version.arquillian}</version> 
       <scope>import</scope> 
       <type>pom</type> 
      </dependency> 
     </dependencies> 
    </dependencyManagement> 

    <dependencies> 
     <dependency> 
      <groupId>org.jboss.as</groupId> 
      <artifactId>jboss-as-arquillian-container-managed</artifactId> 
      <version>7.1.1.Final</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.jboss.arquillian.protocol</groupId> 
      <artifactId>arquillian-protocol-servlet</artifactId> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.jboss.arquillian.junit</groupId> 
      <artifactId>arquillian-junit-container</artifactId> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.jboss.shrinkwrap.resolver</groupId> 
      <artifactId>shrinkwrap-resolver-bom</artifactId> 
      <version>3.0.0-alpha-1</version> 
      <type>pom</type> 
      <scope>import</scope> 
     </dependency> 

當我運行mvn clean install它編譯並運行單元測試,直到面對Arquillian註釋,之後我看到Jboss已啓動:

20:01:45,917 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss EAP 6.1.1.GA (AS 7.2.1.Final-redhat-10) started in 3205ms - Started 150 of 220 services (69 services are passive or on-demand) 

似乎這個過程睡着了。在server.log我看到沒有部署任何東西。 50分鐘後等待我得到這樣的例外:

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2,993.683 sec <<< FAILURE! - in my_package.AccountTest 
my_package.AccountTest Time elapsed: 2,993.683 sec <<< ERROR! 
org.jboss.arquillian.container.spi.client.container.LifecycleException: Could not start container 
     at org.jboss.as.arquillian.container.managed.ManagedDeployableContainer.startInternal(ManagedDeployableContainer.java:167) 
     at org.jboss.as.arquillian.container.CommonDeployableContainer.start(CommonDeployableContainer.java:113) 
     at org.jboss.arquillian.container.impl.ContainerImpl.start(ContainerImpl.java:199) 
     at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$8.perform(ContainerLifecycleController.java:163) 
     at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$8.perform(ContainerLifecycleController.java:157) 
     at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forContainer(ContainerLifecycleController.java:255) 
     at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.startContainer(ContainerLifecycleController.java:156) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:606) 
     at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) 
     at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) 
     at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) 
     at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:57) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:606) 
     at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) 
     at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) 
     at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135) 
     at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115) 
     at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67) 
     at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:77) 
     at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:70) 
     at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forEachSuiteContainer(ContainerLifecycleController.java:221) 
     at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.startSuiteContainers(ContainerLifecycleController.java:69) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:606) 
     at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) 
     at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) 
     at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) 
     at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135) 
     at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115) 
     at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67) 
     at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:86) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:606) 
     at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) 
     at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) 
     at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) 
     at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:606) 
     at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) 
     at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) 
     at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135) 
     at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115) 
     at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:68) 
     at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:97) 
     at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264) 
     at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) 
     at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124) 
     at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) 
     at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) 
     at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) 
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:163) 
     at org.jboss.as.arquillian.container.CommonDeployableContainer.start(CommonDeployableContainer.java:113) 
     at org.jboss.arquillian.container.impl.ContainerImpl.start(ContainerImpl.java:199) 
     at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$8.perform(ContainerLifecycleController.java:163) 
     at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$8.perform(ContainerLifecycleController.java:157) 
     at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forContainer(ContainerLifecycleController.java:255) 
     at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.startContainer(ContainerLifecycleController.java:156) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:606) 
     at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) 
     at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) 
     at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) 
     at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:57) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:606) 
     at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) 
     at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) 
     at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135) 
     at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115) 
     at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67) 
     at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:77) 
     at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:70) 
     at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forEachSuiteContainer(ContainerLifecycleController.java:221) 
     at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.startSuiteContainers(ContainerLifecycleController.java:69) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:606) 
     at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) 
     at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) 
     at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) 
     at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135) 
     at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115) 
     at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67) 
     at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:86) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:606) 
     at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) 
     at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) 
     at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) 
     at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:606) 
     at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) 
     at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) 
     at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135) 
     at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115) 
     at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:68) 
     at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:97) 
     at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264) 
     at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) 
     at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124) 
     at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) 
     at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) 
     at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) 

我是新來Arquillian我能忘記基本的東西,所以任何幫助將是合適的!

+0

最有可能你運行JBoss的(即使它是由的Arquillian啓動)與Java 8. [這不起作用](http://stackoverflow.com/questions/22899497/jboss-seems-to-hang-on-startup-at-the-command-line),所以你應該使用Java 7. – Seelenvirtuose

+0

@Seelenvirtuose,謝謝,會知道。我檢查了,我使用1.7:'INFO:啓動容器:[/ usr/lib/jvm/jdk1.7.0_79/bin/java' –

+0

呃......想想看,它並不完全是描述的行爲。你的JBoss開始了。使用Java 8運行時的行爲在「開始」時掛起。所以,你真的有另一個問題。不幸的是,我不知道... – Seelenvirtuose

回答

3

的問題是,我有non default management端口standalone.xml

所以加入這一行arquillian.xml解決的問題:

<property name="managementAddress">127.0.0.1</property> 
<property name="managementPort">56999</property> 
相關問題