当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Arquillian org.jboss.arquillian.container.spi.client.deployment.Validate.isArchiveOfType(Ljava/lang/Class;Lorg/jboss/shrinkwrap/api/Archive;)Z

问题描述:

I am having trouble to get a simple Arquillian test run. The following error appears when I try to run Arquillian with the GlassFish remote container:

Jun 12, 2016 3:50:05 PM org.jboss.arquillian.container.impl.MapObject populate

WARNUNG: Configuration contain properties not supported by the backing object org.jboss.arquillian.container.glassfish.remote_3_1.GlassFishRestConfiguration

Unused property entries: {jbossHome=target/jboss-as-7.1.1.Final}

Supported property names: [adminHttps, remoteServerHttpPort, libraries, type, remoteServerAddress, target, remoteServerAdminPort, remoteServerAdminHttps, adminUser, authorisation, adminPort, properties, adminHost, adminPassword]

java.lang.NoSuchMethodError: org.jboss.arquillian.container.spi.client.deployment.Validate.isArchiveOfType(Ljava/lang/Class;Lorg/jboss/shrinkwrap/api/Archive;)Z

at org.jboss.arquillian.protocol.servlet.v_3.ServletProtocolDeploymentPackager.generateDeployment(ServletProtocolDeploymentPackager.java:64)

at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.buildTestableDeployments(DeploymentGenerator.java:193)

at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.createTestableDeployments(DeploymentGenerator.java:148)

at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:85)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

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

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

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

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

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

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

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

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

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

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

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

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

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

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

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.beforeClass(EventTestRunnerAdaptor.java:80)

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

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

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

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

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

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

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

at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119)

at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)

at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)

at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

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

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

at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

Test ignored.

Process finished with exit code 255

This is the test:

import org.jboss.shrinkwrap.api.asset.EmptyAsset;

import org.jboss.shrinkwrap.api.spec.JavaArchive;

import org.jboss.shrinkwrap.api.spec.WebArchive;

import org.junit.Test;

import de.unisaarland.discanno.rest.services.v1.UserFacadeREST;

import org.jboss.arquillian.container.test.api.Deployment;

import org.jboss.arquillian.junit.Arquillian;

import org.jboss.arquillian.junit.InSequence;

import org.jboss.shrinkwrap.api.ShrinkWrap;

import org.junit.runner.RunWith;

@RunWith(Arquillian.class)

public class UserFacadeRESTTest {

@Deployment(testable=true)

public static JavaArchive createDeployment() {

JavaArchive jar =

ShrinkWrap.create(JavaArchive.class)

.addClasses(UserFacadeREST.class,

Service.class,

ProjectDAO.class,

UsersDAO.class)

.addAsResource("META-INF/persistence.xml")

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

return jar;

}

@Test

@InSequence(0)

public void should_create_greeting() {

}

}

I also tried it with WebArchive instead of JavaArchive, but the error remains the same. I also tried the solution provided by "tommsdk": Cannot run Arquillian test case on Glassfish

but it won't resolve the dependency "import org.jboss.shrinkwrap.resolver.api.maven.Maven;".

This is the pom.xml for the glassfish remote setting:

https://gist.github.com/JeannedArk/55769ada7a632ff03f8db1b82823a0ce

Unfortunately it is quite a big project therefore the pom is quite big as well. This is the error message when I try to run the test with the wildfly managed configuration:

Test ignored.Jun 12, 2016 4:04:36 PM org.jboss.as.arquillian.container.managed.ManagedDeployableContainer startInternal

INFORMATION: Starting container with: [/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/bin/java, -Xmx512m, -XX:MaxPermSize=256m, -ea, -Djboss.home.dir=target/wildfly-8.1.0.Final, -Dorg.jboss.boot.log.file=/Users/.../discanno/target/wildfly-8.1.0.Final/standalone/log/server.log, -Dlogging.configuration=file:/Users/.../discanno/target/wildfly-8.1.0.Final/standalone/configuration/logging.properties, -Djboss.bundles.dir=target/wildfly-8.1.0.Final/bundles, -jar, /Users/.../discanno/target/wildfly-8.1.0.Final/jboss-modules.jar, -mp, target/wildfly-8.1.0.Final/modules, org.jboss.as.standalone, -server-config, standalone.xml]

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0

Jun 12, 2016 4:04:37 PM org.xnio.Xnio <clinit>

INFO: XNIO version 3.2.2.Final

Jun 12, 2016 4:04:37 PM org.xnio.nio.NioXnio <clinit>

INFO: XNIO NIO Implementation Version 3.2.2.Final

Jun 12, 2016 4:04:37 PM org.jboss.remoting3.EndpointImpl <clinit>

INFO: JBoss Remoting version 4.0.3.Final

16:04:37,529 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.3.Final

16:04:37,768 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.2.Final

16:04:37,866 INFO [org.jboss.as] (MSC service thread 1-6) JBAS015899: WildFly 8.1.0.Final "Kenny" starting

16:04:38,909 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)

16:04:38,931 INFO [org.xnio] (MSC service thread 1-13) XNIO version 3.2.2.Final

16:04:38,941 INFO [org.xnio.nio] (MSC service thread 1-13) XNIO NIO Implementation Version 3.2.2.Final

16:04:38,966 INFO [org.jboss.as.security] (ServerService Thread Pool -- 45) JBAS013171: Activating Security Subsystem

[0;33m16:04:38,967 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 46) JBAS010153: Node identifier property is set to the default value. Please make sure it is unique.

[0;0m16:04:38,968 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 32) JBAS010280: Activating Infinispan subsystem.

16:04:38,978 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main]

16:04:38,979 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 40) JBAS011800: Activating Naming Subsystem

[0;0m16:04:38,978 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 31) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors

[0;0m16:04:38,979 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension

16:04:38,984 INFO [org.jboss.as.security] (MSC service thread 1-7) JBAS013170: Current PicketBox version=4.0.21.Beta1

16:04:39,015 INFO [org.wildfly.extension.undertow] (MSC service thread 1-9) JBAS017502: Undertow 1.0.15.Final starting

[0;0m16:04:39,015 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017502: Undertow 1.0.15.Final starting

16:04:39,048 INFO [org.jboss.as.connector.logging] (MSC service thread 1-1) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.5.Final)

16:04:39,065 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)

16:04:39,074 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) JBAS010417: Started Driver service with driver-name = h2

16:04:39,097 INFO [org.jboss.as.naming] (MSC service thread 1-8) JBAS011802: Starting Naming Service

[0;0m16:04:39,098 INFO [org.jboss.as.mail.extension] (MSC service thread 1-2) JBAS015400: Bound mail session [java:jboss/mail/Default]

16:04:39,107 INFO [org.jboss.remoting] (MSC service thread 1-13) JBoss Remoting version 4.0.3.Final

16:04:39,199 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path /Users/.../discanno/target/wildfly-8.1.0.Final/welcome-content

16:04:39,248 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) JBAS017525: Started server default-server.

16:04:39,352 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017531: Host default-host starting

16:04:39,417 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) JBAS017519: Undertow HTTP listener default listening on /127.0.0.1:8080

16:04:39,577 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-3) JBAS015012: Started FileSystemDeploymentService for directory /Users/.../discanno/target/wildfly-8.1.0.Final/standalone/deployments

16:04:39,605 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]

16:04:39,782 INFO [org.jboss.ws.common.management] (MSC service thread 1-2) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.4.Final

16:04:39,820 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management

[0;0m16:04:39,821 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990

[0;0m16:04:39,822 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.1.0.Final "Kenny" started in 2692ms - Started 184 of 233 services (81 services are lazy, passive or on-demand)

java.lang.NoSuchMethodError: org.jboss.arquillian.container.spi.client.deployment.Validate.isArchiveOfType(Ljava/lang/Class;Lorg/jboss/shrinkwrap/api/Archive;)Z

at org.jboss.arquillian.protocol.servlet.v_3.ServletProtocolDeploymentPackager.generateDeployment(ServletProtocolDeploymentPackager.java:64)

at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.buildTestableDeployments(DeploymentGenerator.java:193)

at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.createTestableDeployments(DeploymentGenerator.java:148)

at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:85)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

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

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

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

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

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

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

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

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

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

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

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

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

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

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

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.beforeClass(EventTestRunnerAdaptor.java:80)

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

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

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

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

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

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

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

at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119)

at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)

at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)

at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

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

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

at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

16:04:44,069 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-11) JBAS010409: Unbound data source [java:jboss/datasources/ExampleDS]

[0;0m16:04:44,069 INFO [org.wildfly.extension.undertow] (MSC service thread 1-12) JBAS017532: Host default-host stopping

16:04:44,076 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-5) JBAS010418: Stopped Driver service with driver-name = h2

[0;0m16:04:44,078 INFO [org.wildfly.extension.undertow] (MSC service thread 1-16) JBAS017521: Undertow HTTP listener default suspending

[0;0m16:04:44,079 INFO [org.wildfly.extension.undertow] (MSC service thread 1-16) JBAS017520: Undertow HTTP listener default stopped, was bound to /127.0.0.1:8080

[0;0m16:04:44,081 INFO [org.wildfly.extension.undertow] (MSC service thread 1-12) JBAS017506: Undertow 1.0.15.Final stopping

Jun 12, 2016 4:04:44 PM org.jboss.remoting3.remote.RemoteConnection handleException

ERROR: JBREM000200: Remote connection failed: java.io.IOException: Connection reset by peer

16:04:44,090 INFO [org.jboss.as] (MSC service thread 1-1) JBAS015950: WildFly 8.1.0.Final "Kenny" stopped in 22ms

Process finished with exit code 255

This is the corresponding pom.xml:

https://gist.github.com/JeannedArk/032fc600d1abddd9c7f8cf8fcd15a7ed

Additionally here is the mvn dependency tree output if that helps you:

https://gist.github.com/JeannedArk/5709d130ac0fcb65e8976b85bc5280f2

I really tried a lot of configurations and researched a lot but it didn't work. Meanwhile I do not care in which container the tests run. I would prefer GlassFish, because we use GlassFish as application server, but I ran also into a lot of issues with the embedded GlassFish container. Therefore it would be also okay if it works with the remote GlassFish oder managed Wildfly container. The body text is limited to 30.000 characters therefore some sources are linked to a Gist, because espescially the pom files are pretty big.

Update:

This is the arquillian.xml:

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

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

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

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

<!-- Sets the protocol which is how Arquillian talks and executes the tests inside the container -->

<defaultProtocol type="Servlet 3.0" />

<!-- <defaultProtocol type="jmx-as7" /> --> <!-- error msg stays the same when changing this parameter -->

<container qualifier="widlfly-managed" default="true">

<configuration>

<property name="jbossHome">${jbossHome:target/wildfly-8.1.0.Final}</property>

</configuration>

</container>

</arquillian>

网友答案:

It really took some time, but thanks to this thread Configure Manuel container IntelliJ Arquillian Wildfly I could solve the error. It only works for me with the currently newest version '1.1.11.Final' and not '1.0.3.Final'. Apparently the Arquillian team must have fixed this issue, because I can reproduce it with the older version and it works with the newer one!

The pom.xml of the working version looks like this:

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>1.1.11.Final</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>
分享给朋友:
您可能感兴趣的文章:
随机阅读: