简体   繁体   中英

Arquilian does not work with Wildfly 16 to run test

The POM. XML has within it the dependence of JUnit 4.12. But after several modifications of Pom and Arquilian. XML does not work yet Arquilian-bom 1.4.1

XML Arquilian

<?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">
    <defaultProtocol type="Servlet 3.0" />
    <container qualifier="wildfly-managed" default="true">
        <configuration>
            <property name="jbossHome">C:/wildfly-16.0.0.Final</property>
            <property name="modulePath">C:/wildfly-16.0.0.Final/modules</property>
            <property name="serverConfig">standalone.xml</property>
        </configuration>
    </container>
</arquillian>

Test class

@RunWith(Arquillian.class)
public class EventTest {


//  @Inject
//  EventDao eventDao;

    @Deployment
    public static Archive<?> createDeployment() {
        System.out.println("<<<< CREATE DEPLOYMENT >>>>");
        JavaArchive jar= ShrinkWrap.create(JavaArchive.class,"test.jar")
//                .addPackages(true, EventDao.class.getPackage())
//                .addPackages(true, IEventDao.class.getPackage())
//                .addPackages(true, Event.class.getPackage())
//                .addPackages(true, IEvent.class.getPackage())
//                .addAsResource("META-INF/test-persistence.xml","persistence.xml")
                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

        WebArchive war=null;
        war=ShrinkWrap.create(WebArchive.class,"test.war");
//              .addAsLibraries(jar);
//      EnterpriseArchive ear= ShrinkWrap.create(EnterpriseArchive.class);
//      ear.setApplicationXML("META-INF/test-application.xml");
//      ear.addAsModule(jar);
//      ear.addAsModule(war);
        return jar;
    }

    @Test
    public void test() throws Exception {
        System.out.println("<<< START TEST >>>");
//      Event event=new Event("name", "surname", "company", "emai", Date.valueOf(LocalDate.now()), "eventCode");
//      eventDao.save(event);
//      assertNotEquals(event.getId(), null);
    }

ArquillianServletRunner not found. Could not determine ContextRoot from ProtocolMetadata
The problem is when I go to do mvn clean install-Pwildifly-managed

<<<< CREATE DEPLOYMENT >>>>
10:34:05,385 INFO  [org.jboss.as.repository] (management-handler-thread - 1) WFLYDR0001: Content added at location C:\wildfly-16.0.0.Final\standalone\data\content\18\d23c3d17787e29ad61b85dcbee31f55b62ee89\content
10:34:05,417 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0027: Starting deployment of "test.war" (runtime-name: "test.war")
10:34:06,188 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) WFLYWELD0003: Processing weld deployment test.war
10:34:06,373 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-1) HV000001: Hibernate Validator 6.0.15.Final
10:34:06,813 INFO  [org.jboss.weld.Version] (MSC service thread 1-7) WELD-000900: 3.1.0 (Final)
10:34:06,915 INFO  [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-6) ISPN000128: Infinispan version: Infinispan 'Infinity Minus ONE +2' 9.4.8.Final
10:34:07,345 INFO  [io.smallrye.metrics] (MSC service thread 1-5) MicroProfile: Metrics activated
10:34:07,383 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 22) WFLYCLINF0002: Started client-mappings cache from ejb container
10:34:08,049 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 22) WFLYUT0021: Registered web context: '/test' for server 'default-server'
10:34:08,147 INFO  [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0010: Deployed "test.war" (runtime-name : "test.war")
2019-04-09 10:34:08,594 DEBUG org.xnio.nio WorkerThread.java:429 [Remoting "endpoint" I/O-1] - Started channel thread 'Remoting "endpoint" I/O-1', selector sun.nio.ch.WindowsSelectorImpl@69a890a7
2019-04-09 10:34:08,646 DEBUG org.jboss.remotingjmx.VersionedConectionFactory VersionedConectionFactory.java:173 [Remoting "endpoint" task-4] - Available version (Versions  0x00 0x01)
2019-04-09 10:34:08,654 DEBUG org.jboss.remotingjmx.VersionedConectionFactory VersionedConectionFactory.java:179 [Remoting "endpoint" task-4] - Calling a stable server
2019-04-09 10:34:08,654 DEBUG org.jboss.remotingjmx.VersionedConectionFactory VersionedConectionFactory.java:131 [Remoting "endpoint" task-4] - Selecting version 0x00 to receive full version list.
2019-04-09 10:34:08,666 DEBUG org.jboss.remotingjmx.VersionedConectionFactory VersionedConectionFactory.java:173 [Remoting "endpoint" task-5] - Available version (Versions  0x01 0x02)
2019-04-09 10:34:08,666 DEBUG org.jboss.remotingjmx.VersionedConectionFactory VersionedConectionFactory.java:179 [Remoting "endpoint" task-5] - Calling a stable server
2019-04-09 10:34:08,666 DEBUG org.jboss.remotingjmx.VersionedConectionFactory VersionedConectionFactory.java:194 [Remoting "endpoint" task-5] - Server version 3.0.1.Final
10:34:08,957 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 22) WFLYUT0022: Unregistered web context: '/test' from server 'default-server'
10:34:09,120 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0028: Stopped deployment test.war (runtime-name: test.war) in 163ms
10:34:09,180 INFO  [org.jboss.as.repository] (management-handler-thread - 1) WFLYDR0002: Content removed from location C:\wildfly-16.0.0.Final\standalone\data\content\18\d23c3d17787e29ad61b85dcbee31f55b62ee89\content
10:34:09,180 INFO  [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0009: Undeployed "test.war" (runtime-name: "test.war")
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 14.458 sec <<< FAILURE!
test(relational.EventTest)  Time elapsed: 0.1 sec  <<< ERROR!

Stack error

java.lang.IllegalArgumentException: ArquillianServletRunner not found. Could not determine ContextRoot from ProtocolMetadata, please contact DeployableContainer developer.
        at org.jboss.arquillian.protocol.servlet.ServletUtil.determineBaseURI(ServletUtil.java:61)
        at org.jboss.arquillian.protocol.servlet.ServletURIHandler.locateTestServlet(ServletURIHandler.java:54)
        at org.jboss.arquillian.protocol.servlet.ServletMethodExecutor.invoke(ServletMethodExecutor.java:75)
        at org.jboss.arquillian.container.test.impl.execution.RemoteTestExecuter.execute(RemoteTestExecuter.java:103)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
        at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:90)
        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:133)
        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:105)
        at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:62)
        at org.jboss.arquillian.container.test.impl.execution.ClientTestExecuter.execute(ClientTestExecuter.java:52)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
        at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:90)
        at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:128)
        at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createTestContext(ContainerEventController.java:118)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:95)
        at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:69)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:95)
        at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:83)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:95)
        at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:116)
        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:498)
        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:95)
        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:133)
        at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:122)
        at org.jboss.arquillian.junit.MethodInvoker.invoke(MethodInvoker.java:15)
        at org.jboss.arquillian.junit.Arquillian$8.evaluate(Arquillian.java:332)
        at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:204)
        at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:350)
        at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:54)
        at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:215)
        at org.jboss.arquillian.junit.Arquillian$7.evaluate(Arquillian.java:285)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:166)
        at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:350)
        at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:54)
        at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:177)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:115)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
        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:498)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

We solved, it was enough to add in addiction

<dependency>
    <groupId>org.wildfly.arquillian</groupId>
    <artifactId>wildfly-arquillian-container-managed</artifactId>
    <version>2.2.0.Final</version>
    <scope>test</scope>
</dependency>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM