Arquillian org.jboss.arquillian.container.spi.client.deployment.Validate.isArchiveOfType(Ljava / lan
作者:互联网
我无法进行简单的Arquillian测试.当我尝试使用GlassFish远程容器运行Arquillian时,出现以下错误:
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
这是测试:
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() {
}
}
我也使用WebArchive而不是JavaArchive进行了尝试,但是错误仍然相同.我还尝试了“ tommsdk”提供的解决方案:Cannot run Arquillian test case on Glassfish
但它不会解决依赖项“ import org.jboss.shrinkwrap.resolver.api.maven.Maven;”.
这是glassfish远程设置的pom.xml:
https://gist.github.com/JeannedArk/55769ada7a632ff03f8db1b82823a0ce
不幸的是,这是一个很大的项目,因此pom也很大.当我尝试使用wildfly托管配置运行测试时,这是错误消息:
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
这是对应的pom.xml:
https://gist.github.com/JeannedArk/032fc600d1abddd9c7f8cf8fcd15a7ed
此外,如果有帮助,这是mvn依赖关系树的输出:
https://gist.github.com/JeannedArk/5709d130ac0fcb65e8976b85bc5280f2
我确实尝试了很多配置,并做了很多研究,但没有用.同时,我不在乎测试在哪个容器中运行.我更喜欢GlassFish,因为我们使用GlassFish作为应用程序服务器,但是我也遇到了嵌入式GlassFish容器的很多问题.因此,如果它与远程GlassFish oder管理的Wildfly容器一起工作,也可以.正文文本限制为30.000个字符,因此某些来源链接到Gist,因为尤其是pom文件很大.
更新:
这是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>
解决方法:
确实花了一些时间,但是多亏了这个线程Configure Manuel container IntelliJ Arquillian Wildfly,我才能解决该错误.它仅适用于当前最新版本“ 1.1.11.Final”而非“ 1.0.3.Final”.显然,Arquillian团队必须解决了这个问题,因为我可以在较旧的版本中重现它,并且可以在较新的版本中使用!
工作版本的pom.xml如下所示:
<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>
标签:jboss,integration-testing,glassfish,jboss-arquillian,java 来源: https://codeday.me/bug/20191118/2028521.html