3 Replies Latest reply: May 16, 2012 4:15 PM by rajivtmathew RSS

    Arquillian dependency graph when testing on JBoss AS7

    rajivtmathew Newbie

      Anyone here know the Arquillian dependency graph when attempting to run in-container tests using Arquillian on JBoss AS 7 (similar to this post explaining dependencies on AS6)

      I'm using AS 7.1.1.Final, with Gradle build. Here are the dependencies I've listed in my build.gradle script.

       


      arquillian = [group: 'org.jboss.arquillian', name: 'arquillian-parent', version: '1.0.0.CR6']

      arquilliancore = [group: 'org.jboss.arquillian.core', name: 'arquillian-core-api', version: '1.0.0.CR6']

      arquilliantest = [group: 'org.jboss.arquillian.test', name: 'arquillian-test-impl-base', version: '1.0.0.CR6']

      arquilliancontainertest = [group: 'org.jboss.arquillian.container', name: 'arquillian-container-test-impl-base', version: '1.0.0.CR6']

      arquilliancontainerremote = [group: 'org.jboss.as', name: 'jboss-as-arquillian-container-remote', version: '7.1.1.Final'

      arquilliantestapi = [group: 'org.jboss.arquillian.container', name: 'arquillian-container-test-api', version: '1.0.0.CR6']

      arquillianspi = [group: 'org.jboss.arquillian.container', name: 'arquillian-container-spi', version: '1.0.0.CR6']

      arquillianjunit = [group: 'org.jboss.arquillian.junit', name: 'arquillian-junit-core', version: '1.0.0.CR6']

      arquillianservlet = [group: 'org.jboss.arquillian.protocol', name: 'arquillian-protocol-servlet', version: '1.0.0.Alpha3']

      shrinkwrapimpl = [group: 'org.jboss.shrinkwrap', name: 'shrinkwrap-impl-base', version: '1.0.0-beta-1']

      shrinkwrapapi = [group: 'org.jboss.shrinkwrap', name: 'shrinkwrap-api', version: '1.0.0-beta-1']

      shrinkwrapdescriptorapi = [group: 'org.jboss.shrinkwrap', name: 'shrinkwrap-descriptors-api', version: '1.0.0-beta-1']

      shrinkwrapdescriptorimpl = [group: 'org.jboss.shrinkwrap', name: 'shrinkwrap-descriptors-impl', version: '1.0.0-beta-1']

       

       

      When I attempt to compile and run a single unit test using Gradle, I end up seeing the following exception (despite arquillian-container-spi.jar being included in dependency tree):

       

      Caused by: java.lang.RuntimeException: Could not create a new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor see cause.

              at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:170)

              at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)

              at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:93)

              at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:51)

              at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:63)

              at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:49)

              ... 29 more

      Caused by: java.lang.reflect.InvocationTargetException

              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

              at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

              at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:166)

              ... 34 more

      Caused by: java.lang.RuntimeException: Could not create a new instance of class org.jboss.arquillian.core.impl.ManagerImpl see cause.

              at org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:157)

              at org.jboss.arquillian.core.spi.ManagerBuilder.create(ManagerBuilder.java:77)

              at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTestRunnerAdaptor.java:55)

              ... 39 more

      Caused by: java.lang.reflect.InvocationTargetException

              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

              at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

              at org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:153)

              ... 41 more

      Caused by: java.lang.NoClassDefFoundError: org/jboss/arquillian/container/spi/event/StartManagedContainers

              at java.lang.Class.getDeclaredMethods0(Native Method)

              at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)

              at java.lang.Class.privateGetPublicMethods(Class.java:2547)

              at java.lang.Class.getMethods(Class.java:1410)

              at org.jboss.arquillian.core.impl.Reflections.getObserverMethods(Reflections.java:53)

              at org.jboss.arquillian.core.impl.ExtensionImpl.of(ExtensionImpl.java:51)

              at org.jboss.arquillian.core.impl.ManagerImpl.createExtensions(ManagerImpl.java:397)

              at org.jboss.arquillian.core.impl.ManagerImpl.fireProcessing(ManagerImpl.java:332)

              at org.jboss.arquillian.core.impl.ManagerImpl.<init>(ManagerImpl.java:97)

              ... 46 more

      Caused by: java.lang.ClassNotFoundException: org.jboss.arquillian.container.spi.event.StartManagedContainers

              at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

              at java.security.AccessController.doPrivileged(Native Method)

              at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

              at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

              at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

              at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

              ... 55 more

       

       

      Any help would be appreciated.

        • 1. Re: Arquillian dependency graph when testing on JBoss AS7
          Aslak Knutsen Master

          You need to upgrade your version of Arquillian. JBoss AS 7.1.1 use a newer version so you get some conflicts.

           

          Upgrade all in group: org.jboss.arquillian.* to 1.0.0.Final

          • 2. Re: Arquillian dependency graph when testing on JBoss AS7
            rajivtmathew Newbie

            I did start off initially with all arquillian jars at 1.0.0.Final. I still run into this issue when my test class attempts to run. The reason, as seen in stack trace above, is that StartManagedContainers class doesn't exist in arquillian-test-spi.jar version 1.0.0.Final. It was obsoleted in 1.0.0.CR5, which is why I then opted to switch all the dependencies to CR5. I've attempted to change it back to 1.0.0.Final, but I still see the same problem. Somewhere, internally, one of the classes is dependent on StartManagedContainers class.

             

            Here is my test class.

             

             

            @RunWith(Arquillian.class)

            public class TestJNDILookupBinding {

             

                private String jndiName = "java:app/ObjectManager";

             

                @Inject

                InitialContext initialContext;

             

                @Inject

                ObjectManagerAPI objectManagerAPI;

             

                @Inject

                ObjectManager objectManager;

             

                @Inject

                Logger logger;

             

                @Inject

                InitialContextFactory factory;

             

                @Deployment

                public static WebArchive createTestArchive() {

                    return ShrinkWrap.create(WebArchive.class, "archive.war")

                            .addClass(InitialContext.class)

                            .addClass(InitialContextFactory.class)

                            .addClass(Runner.class)

                            .addAsWebResource(EmptyAsset.INSTANCE, "beans.xml");

                }

             

                @Test

                public void testJNDILookup() throws NamingException {

             

                    ObjectManager objM = ObjectManagerAPI.getObjectManager();

                    InitialContext initialContext = InitialContextFactory.getInitialContext();

                    initialContext.bind(jndiName, objM);

                    Assert.assertEquals(initialContext.lookup(jndiName), objM);

                }

             

             

            It is run as part of a test suite. The other tests run from gradle build target, with some passing, some failing, but when it gets to this test class, it throws the exception shown in original post.

            Any thoughts?

            • 3. Re: Arquillian dependency graph when testing on JBoss AS7
              rajivtmathew Newbie

              Hi Aslak,

               

              I found the arquillian-bom 1.0.0.Final pom file here. I switched out my old arquillian dependency references, and replace them with the dependencies defined in the pom file. It's got past the NoClassDefFound exceptions, and it actually does run the test this time.

               

              Unfortunately, it ends up with a similar exception "java.lang.IllegalStateException: Cannot obtain MBeanServerConnection to: service:jmx:rmi:///jndi/rmi://127.0.0.1:1090/jmxrmi" as mentioned in this discussion and this one.

               

              java.lang.IllegalStateException: Cannot obtain MBeanServerConnection to: service:jmx:rmi:///jndi/rmi://127.0.0.1:9999/jmxrmi

                  at org.jboss.as.arquillian.container.MBeanServerConnectionProvider.getConnection(MBeanServerConnectionProvider.java:64)

                  at org.jboss.as.arquillian.container.remote.RemoteDeployableContainer.getMBeanServerConnection(RemoteDeployableContainer.java:66)

                  at org.jboss.as.arquillian.container.remote.RemoteDeployableContainer.startInternal(RemoteDeployableContainer.java:52)

                  at org.jboss.as.arquillian.container.CommonDeployableContainer.start(CommonDeployableContainer.java:88)

                  at org.jboss.arquillian.container.impl.ContainerImpl.start(ContainerImpl.java:198)

                  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:39)

                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                  at java.lang.reflect.Method.invoke(Method.java:597)

                  at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                  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:39)

                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                  at java.lang.reflect.Method.invoke(Method.java:597)

                  at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                  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:39)

                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                  at java.lang.reflect.Method.invoke(Method.java:597)

                  at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                  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:39)

                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                  at java.lang.reflect.Method.invoke(Method.java:597)

                  at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                  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:39)

                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                  at java.lang.reflect.Method.invoke(Method.java:597)

                  at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                  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.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:51)

                  at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:63)

                  at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:49)

                  at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)

                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                  at java.lang.reflect.Method.invoke(Method.java:597)

                  at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)

                  at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)

                  at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)

                  at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:75)

                  at $Proxy2.processTestClass(Unknown Source)

                  at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:91)

                  at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)

                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                  at java.lang.reflect.Method.invoke(Method.java:597)

                  at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)

                  at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)

                  at org.gradle.messaging.remote.internal.TypeCastDispatch.dispatch(TypeCastDispatch.java:30)

                  at org.gradle.messaging.remote.internal.WorkerProtocol.handleIncoming(WorkerProtocol.java:53)

                  at org.gradle.messaging.remote.internal.WorkerProtocol.handleIncoming(WorkerProtocol.java:31)

                  at org.gradle.messaging.remote.internal.ProtocolStack$ProtocolStage.handleIncoming(ProtocolStack.java:167)

                  at org.gradle.messaging.remote.internal.ProtocolStack$BottomStage.handleIncoming(ProtocolStack.java:277)

                  at org.gradle.messaging.remote.internal.ProtocolStack$BottomConnection$1.run(ProtocolStack.java:299)

                  at org.gradle.messaging.remote.internal.ProtocolStack$ExecuteRunnable.dispatch(ProtocolStack.java:120)

                  at org.gradle.messaging.remote.internal.ProtocolStack$ExecuteRunnable.dispatch(ProtocolStack.java:116)

                  at org.gradle.messaging.dispatch.AsyncDispatch.dispatchMessages(AsyncDispatch.java:132)

                  at org.gradle.messaging.dispatch.AsyncDispatch.access$000(AsyncDispatch.java:33)

                  at org.gradle.messaging.dispatch.AsyncDispatch$1.run(AsyncDispatch.java:72)

                  at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)

                  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                  at java.lang.Thread.run(Thread.java:662)

              Caused by: java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: non-JRMP server at remote endpoint]

                  at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:338)

                  at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)

                  at org.jboss.as.arquillian.container.MBeanServerConnectionProvider.getConnection(MBeanServerConnectionProvider.java:60)

                  ... 90 more

              Caused by: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: non-JRMP server at remote endpoint]

                  at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:101)

                  at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:185)

                  at javax.naming.InitialContext.lookup(InitialContext.java:392)

                  at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1886)

                  at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1856)

                  at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:255)

                  ... 92 more

              Caused by: java.rmi.ConnectIOException: non-JRMP server at remote endpoint

                  at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:230)

                  at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)

                  at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)

                  at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)

                  at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:97)

                  ... 97 more

               

              I modified my arquillian.xml as instructed in these two discussions:

               

               

              <?xml version="1.0" encoding="UTF-8"?>

              <arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                          xmlns="http://jboss.org/schema/arquillian"

                          xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

               

               

                  <protocol type="jmx-as7"/>

               

                  <container qualifier="jboss7" default="true">

                      <configuration>

                          <property name="jmxPort">9999</property>

                          <property name="httpPort">8080</property>

                          <property name="startupTimeout">180</property>

                      </configuration>

                  </container>

              </arquillian>

               

              Unfortunately I'm still seeing the problem. Do I need to update some configuration in my standalone.xml file for JBoss 7.1.1.Final, for the connection refused problem to go away? I've already updated the interfaces tag in standalone.xml as below:

               

               

              <interfaces>

                      <interface name="management">

                          <inet-address value="127.0.0.1"/>

                      </interface>

                      <interface name="jmx">

                          <inet-address value="127.0.0.1"/>

                      </interface>

                      <interface name="public">

                          <inet-address value="127.0.0.1"/>

                      </interface>

                      <interface name="unsecure">

                          <inet-address value="127.0.0.1"/>

                      </interface>

                  </interfaces>