]
Dipak Pawar commented on ARQ-2144:
----------------------------------
We found the root cause of this issue. TestNG has some issue while packaging there jars.
You can find all the details at
.
We have to wait TestNG fixes this in upstream. If you are blocked with this issue then for
the time being as workaround just "org.testng:testng" dependency as library
while creating archive using srinkwrap in it,. Something like
{code:java}
@Deployment
public static WebArchive createDeployment() {
final PomEquippedResolveStage pomEquippedResolveStage =
Maven.resolver().loadPomFromFile("pom.xml");
File[] mavenFiles = pomEquippedResolveStage.importRuntimeDependencies().resolve()
.withTransitivity().asFile();
return
ShrinkWrap.create(WebArchive.class).addPackage("application.rest").addPackage("application")
.addAsLibraries(mavenFiles)
.addAsLibraries(pomEquippedResolveStage.resolve("org.testng:testng").withTransitivity().asFile());
}
{code}
Incomplete arquillian-testng.jar for TestNG 6.10+
-------------------------------------------------
Key: ARQ-2144
URL:
https://issues.jboss.org/browse/ARQ-2144
Project: Arquillian
Issue Type: Bug
Components: Base Implementation, Daemon
Affects Versions: 1.1.13.Final
Environment: jdk1.8.0_141 OSX
Reporter: Scott Stark
Assignee: Andrew Rubinger
Priority: Critical
Attachments: TestNGWorkaround.java
I have created a simple cdi test that illustrates a problem I'm seeing with TestNG
based remote tests running in Wildfly-Swarm. The issue is that the arquillian-testng.jar
that is attached to the test WebArchive is missing the majority of TestNG classes, and so
the test fails to load in the container runtime.
I have created a
https://github.com/starksm64/arq-testnq-tests repository with two tests
that illustrate the problem.
There is a ex.ExceptionTest that illustrates the inability to deploy the test due to
NoClassDefFoundError:
{noformat}
2017-09-20 16:49:37,560 ERROR [stderr] (nioEventLoopGroup-3-1)
java.lang.NoClassDefFoundError: Failed to link ex/ExceptionTest (Module
"deployment.exTest.war:main" from Service Module Loader): Failed to link
org/jboss/arquillian/testng/Arquillian (Module "deployment.exTest.war:main" from
Service Module Loader): Failed to link org/testng/IHookable (Module
"deployment.exTest.war:main" from Service Module Loader):
org/testng/ITestNGListener
2017-09-20 16:49:37,560 ERROR [stderr] (nioEventLoopGroup-3-1) at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
2017-09-20 16:49:37,560 ERROR [stderr] (nioEventLoopGroup-3-1) at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
2017-09-20 16:49:37,560 ERROR [stderr] (nioEventLoopGroup-3-1) at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
2017-09-20 16:49:37,560 ERROR [stderr] (nioEventLoopGroup-3-1) at
java.lang.reflect.Constructor.newInstance(Constructor.java:423)
2017-09-20 16:49:37,561 ERROR [stderr] (nioEventLoopGroup-3-1) at
org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
2017-09-20 16:49:37,561 ERROR [stderr] (nioEventLoopGroup-3-1) at
org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
2017-09-20 16:49:37,561 ERROR [stderr] (nioEventLoopGroup-3-1) at
org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
2017-09-20 16:49:37,561 ERROR [stderr] (nioEventLoopGroup-3-1) at
org.jboss.modules.Module.loadModuleClass(Module.java:606)
2017-09-20 16:49:37,561 ERROR [stderr] (nioEventLoopGroup-3-1) at
org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
2017-09-20 16:49:37,561 ERROR [stderr] (nioEventLoopGroup-3-1) at
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
2017-09-20 16:49:37,561 ERROR [stderr] (nioEventLoopGroup-3-1) at
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
2017-09-20 16:49:37,561 ERROR [stderr] (nioEventLoopGroup-3-1) at
org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at
org.wildfly.swarm.arquillian.daemon.TestRunner.executeTest(TestRunner.java:45)
2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at
org.wildfly.swarm.arquillian.daemon.server.Server.executeTest(Server.java:250)
2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at
org.wildfly.swarm.arquillian.daemon.server.Server$StringCommandHandler.channelRead0(Server.java:361)
2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at
org.wildfly.swarm.arquillian.daemon.server.Server$StringCommandHandler.channelRead0(Server.java:303)
2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304)
2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304)
2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:276)
2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:263)
2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304)
2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846)
2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
2017-09-20 16:49:37,564 ERROR [stderr] (nioEventLoopGroup-3-1) at
io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
2017-09-20 16:49:37,564 ERROR [stderr] (nioEventLoopGroup-3-1) at
java.lang.Thread.run(Thread.java:748)
{noformat}
The test includes a TestNGArchiveProcessor AuxiliaryArchiveProcessor implementation that
dumps out the arquillian-testng.jar seen in the WebArchive. It shows only the following
org.testng package classes when run form within the Intellij IDEA IDE:
{noformat}
*-testng.jar contents: arquillian-testng.jar:
/org/
/org/testng/
/org/testng/IDEARemoteTestNG.class
/org/testng/IDEATestNGConfigurationListener.class
/org/testng/IDEATestNGInvokedMethodListener.class
/org/testng/IDEATestNGListener.class
/org/testng/IDEATestNGRemoteListener$DelegatedResult.class
/org/testng/IDEATestNGRemoteListener$ExposedTestResult.class
/org/testng/IDEATestNGRemoteListener.class
/org/testng/IDEATestNGSuiteListener.class
/org/testng/IDEATestNGTestListener.class
/org/testng/MapSerializerUtil$1.class
/org/testng/MapSerializerUtil$EscapeInfoProvider.class
/org/testng/MapSerializerUtil.class
/org/testng/RemoteTestNGStarter.class
/org/testng/TestNGExpectedPatterns.class
/org/testng/TestNGForkedSplitter.class
/org/testng/TestNGForkedStarter.class
/org/testng/TestNGTestDiscoveryListener.class
/org/testng/TestNGXmlSuiteHelper$Logger$1.class
/org/testng/TestNGXmlSuiteHelper$Logger.class
/org/testng/TestNGXmlSuiteHelper.class
{noformat}
When run from the command line the arquillian-testng.jar contains no org.testng package
classes.
The underlying problem seems to be how the
org.jboss.shrinkwrap.impl.base.URLPackageScanner includes package classes. I have a simple
arq.URLPackageScannerTest in the that illustrates how URLPackageScanner fails to located
org.testng classes.