1 Reply Latest reply on Oct 31, 2011 5:22 AM by Antony Blakey

    Arquillian + JBoss AS 7 + Groovy - ClassNotFound  groovy/lang/GroovyObject

    Antony Blakey Newbie

      Hi,

       

      I'm using Arquillian 1.0.0.Final-SNAPSHOT with JBoss7.0.2 Managed. My test, which is entirely standalone, is written in Groovy 1.8.3. Everything is deployed into a war which is assembled using gradle - all of the dependent jars are packaged in the war. I'm not sure if this is an Arquillian problem - I suspect it may be a JBoss issue, but I thought I'd ask here first. My test is as follows:

       

      {code}@RunWith(Arquillian)

      class XAResourceTracingTest {

       

          @Inject

          UserTransaction userTransaction

       

          @Resource(mappedName = "java:jboss/TransactionManager")

          TransactionManager transactionManager

       

          @Deployment

          static WebArchive deploy() {

              ShrinkWrap.createFromZipFile(WebArchive, new File("build/libs/arquillian.war"))

          }

       

          @Test

          void traceSimpleTransaction() {

              def xar = new MockFor(XAResource)

              def proxy = xar.proxyDelegateInstance()

              userTransaction.begin()

              transactionManager.getTransaction().enlistResource(proxy)

              userTransaction.commit()

          }

       

      }{code}

       

      If I define a stubbed out XAResource class (in groovy) and pass it to enlist resource, then all is fine. If I use the code as shown then I get the following exception, which I'm guessing is because some dynamic magic is being attempted in a classloader that can't see my classes. Surely my classes should always be visible. The reason I'm asking here is that I know arquillian must be providing my test classes to the system, presumable by injecting them into my war, so there's the tiniest chance someone here knows what the problem is.

       

      {code}

      java.lang.NoClassDefFoundError: groovy/lang/GroovyObject

      at java.lang.ClassLoader.defineClass1(Native Method)

      at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)

      at java.lang.ClassLoader.defineClass(ClassLoader.java:615)

      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)

      at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:55)

      at groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:519)

      at groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:536)

      at groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:540)

      at org.codehaus.groovy.control.CompilationUnit$13.call(CompilationUnit.java:772)

      at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:957)

      at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:542)

      at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:520)

      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:497)

      at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306)

      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:287)

      at groovy.lang.GroovyShell.parseClass(GroovyShell.java:731)

      at groovy.lang.GroovyShell.parse(GroovyShell.java:743)

      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:578)

      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:618)

      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)

      at groovy.util.ProxyGenerator.instantiateAggregate(ProxyGenerator.java:244)

      at groovy.util.ProxyGenerator.instantiateAggregate(ProxyGenerator.java:131)

      at groovy.util.ProxyGenerator.instantiateAggregate(ProxyGenerator.java:127)

      at groovy.util.ProxyGenerator.instantiateAggregateFromInterface(ProxyGenerator.java:119)

      at groovy.util.ProxyGenerator.instantiateAggregateFromInterface(ProxyGenerator.java:113)

      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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)

      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)

      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1054)

      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:884)

      at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:149)

      at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:44)

      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)

      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)

      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)

      at groovy.mock.interceptor.MockFor.getInstance(MockFor.groovy:277)

      at groovy.mock.interceptor.MockFor$getInstance.callStatic(Unknown Source)

      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:50)

      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:157)

      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:169)

      at groovy.mock.interceptor.MockFor.makeProxyInstance(MockFor.groovy:260)

      at groovy.mock.interceptor.MockFor$makeProxyInstance.callCurrent(Unknown Source)

      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)

      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)

      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:145)

      at groovy.mock.interceptor.MockFor.proxyDelegateInstance(MockFor.groovy:256)

      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.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:226)

      at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)

      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)

      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)

      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)

      at groovy.mock.interceptor.MockFor.proxyDelegateInstance(MockFor.groovy)

      at groovy.mock.interceptor.MockFor$proxyDelegateInstance.call(Unknown Source)

      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)

      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)

      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)

      at au.com.moveit.ramp.lockmanager.XAResourceTracingTest.traceSimpleTransaction(XAResourceTracingTest.groovy:81)

      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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)

      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)

      at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:246)

      at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.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.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:134)

      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)

      at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

      at org.jboss.arquillian.container.test.impl.execution.ContainerTestExecuter.execute(ContainerTestExecuter.java:38)

      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.createTestContext(TestContextHandler.java:89)

      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.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)

      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.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:134)

      at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111)

      at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:239)

      at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:202)

      at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:290)

      at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:45)

      at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:216)

      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)

      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)

      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)

      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)

      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)

      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)

      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)

      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)

      at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:161)

      at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:290)

      at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:45)

      at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:175)

      at org.junit.runners.ParentRunner.run(ParentRunner.java:292)

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

      at org.junit.runner.JUnitCore.run(JUnitCore.java:157)

      at org.junit.runner.JUnitCore.run(JUnitCore.java:136)

      at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:65)

      at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethodInternal(JMXTestRunner.java:128)

      at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethod(JMXTestRunner.java:107)

      at org.jboss.as.arquillian.service.ArquillianService$ExtendedJMXTestRunner.runTestMethod(ArquillianService.java:203)

      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 com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:93)

      at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:27)

      at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:208)

      at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:120)

      at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:262)

      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)

      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)

      at org.jboss.as.jmx.tcl.TcclMBeanServer.invoke(TcclMBeanServer.java:214)

      at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1427)

      at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72)

      at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1265)

      at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1360)

      at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:788)

      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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)

      at sun.rmi.transport.Transport$1.run(Transport.java:159)

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

      at sun.rmi.transport.Transport.serviceCall(Transport.java:155)

      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)

      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)

      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)

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

      Caused by: java.lang.ClassNotFoundException: groovy.lang.GroovyObject

      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 groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:696)

      at groovy.lang.GroovyClassLoader$InnerLoader.loadClass(GroovyClassLoader.java:449)

      at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:793)

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

      ... 170 more

       

      {code}

       

      Any clues?