15

Until now I had my integration tests running with Arquillian and an embedded Glassfish 4.x. As I suffer from bug ARQ-1458, I tried migrating to Wildfly 8.0.0.Beta1.

My deps in Maven are:

<dependency>
    <groupId>org.jboss.arquillian</groupId>
    <artifactId>arquillian-bom</artifactId>
    <version>1.1.2.Final</version>
    <scope>import</scope>
    <type>pom</type>
</dependency>
<dependency>
    <groupId>org.jboss.arquillian.junit</groupId>
    <artifactId>arquillian-junit-container</artifactId>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.wildfly</groupId>
    <artifactId>wildfly-arquillian-container-embedded</artifactId>
    <version>8.0.0.Beta1</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.wildfly</groupId>
    <artifactId>wildfly-embedded</artifactId>
    <version>8.0.0.Beta1</version>
    <scope>test</scope>
</dependency>

When running my test, I get the error that jbossHome is null. I have NO arquillian.xml. When checking Github sources for wildfly-arquillian-container-embedded (POM), I wonder WHY an embedded container requires JBOSS_HOME? I understand to have it for the managed and remote variants, but why do I need it for an embedded one? The Arquillian pages also only have examples for JBoss AS as managed servers, so I wonder it it is possible at all (but why is there wildfly-arquillian-container-embedded then?)?

Or should I stick to a managed container with using the maven-dependency-plugin to download the container (see http://arquillian.org/guides/getting_started/#add_more_containers - bottom)?

Thanks and best regards!

Exact error is:


org.jboss.arquillian.container.spi.ConfigurationException: jbossHome 'null' must exist
    at org.jboss.arquillian.container.spi.client.deployment.Validate.configurationDirectoryExists(Validate.java:139)
    at org.jboss.as.arquillian.container.embedded.EmbeddedContainerConfiguration.validate(EmbeddedContainerConfiguration.java:102)
    at org.jboss.arquillian.container.impl.ContainerImpl.createDeployableConfiguration(ContainerImpl.java:115)
    at org.jboss.arquillian.container.impl.ContainerImpl.setup(ContainerImpl.java:181)
    at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$7.perform(ContainerLifecycleController.java:149)
    at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$7.perform(ContainerLifecycleController.java:145)
    at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forContainer(ContainerLifecycleController.java:255)
    at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.setupContainer(ContainerLifecycleController.java:144)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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.core.impl.EventImpl.fire(EventImpl.java:67)
    at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$1.perform(ContainerLifecycleController.java:62)
    at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$1.perform(ContainerLifecycleController.java:55)
    at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forEachContainer(ContainerLifecycleController.java:209)
    at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.setupContainers(ContainerLifecycleController.java:54)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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)
Timo Böwing
  • 313
  • 1
  • 2
  • 8
  • 4
    I have the feeling, that wildfly-embedded is not really an embedded container or not yet finished. Because I did some digging and had a look at the "EmbeddedContainerConfiguration" java class. There they explicity check for jbossHome, moduleHome and bundleHome. Therefore you have to download a "real" wildfly, which in my opinion is not an embedded-container ;) I am currently using the managed/remote adapter instead and everything works just fine. For the embedded tests I will use glassfish-embedded :) – zip Jan 22 '14 at 09:04
  • 1
    Yepp, saw the same code :( So I am afraid I have to go for the same option and wait for the fox of ARQ-1458. I am not giving up, cos using an embedded Wildfly would by my first option, so that one can checkout the project and do a Maven Build w/o having to install manyally or use other help of plugins or ANT tasks. – Timo Böwing Jan 22 '14 at 12:30
  • 1
    I know this thread is pretty old but I would appreciate if anyone could let me know what did you people finally conclude about this error? – Siddharth Mar 19 '15 at 05:09

4 Answers4

8

One should set environment variable JBOSS_HOME to path to jBoss installation. Otherwise, a tag property should be added to arquillian.xml inside a container tag.

<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">


<container qualifier="jboss" default="true">
    <configuration>
        <property name="jbossHome">/path/to/jboss/as</property>
    </configuration>
</container>

from example application jboss-javaee6-webapp

javaeeeee
  • 681
  • 8
  • 13
5

use systemPropertyVariables

<profile>
<id>INTEGRATION_TESTS</id>
<dependencies>
    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-arquillian-container-embedded</artifactId>
        <version>8.2.0.Final</version>
    </dependency>
    <!-- this is the wildfly emb.container - BUT eventually it is not a fully blown emb.container-->
    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-embedded</artifactId>
        <version>8.2.0.Final</version>
    </dependency>

    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc6</artifactId>
        <version>11.2.0.3</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>unpack</id>
                    <phase>process-test-classes</phase>
                    <goals>
                        <goal>unpack</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>org.wildfly</groupId>
                                <artifactId>wildfly-dist</artifactId>
                                <version>8.2.0.Final</version>
                                <type>zip</type>
                                <overWrite>false</overWrite>
                                <outputDirectory>target</outputDirectory>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-maven-plugin</artifactId>
            <version>1.0.2.Final</version>
            <executions>
                <execution>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>start</goal>
                    </goals>
                </execution>
                <execution>
                    <id>jdbc</id>
                    <phase>package</phase>
                    <goals>
                        <goal>deploy-artifact</goal>
                    </goals>
                    <configuration>
                        <groupId>com.oracle</groupId>
                        <artifactId>ojdbc6</artifactId>
                        <name>ojdbc6.jar</name>
                    </configuration>
                </execution>
                <execution>
                    <id>datasource</id>
                    <phase>package</phase>
                    <goals>
                        <goal>add-resource</goal>
                    </goals>
                    <configuration>
                        <address>subsystem=datasources,data-source=tests</address>
                        <resources>
                            <resource>
                                <properties>
                                    <connection-url>jdbc:oracle:thin:@***:1521:xe</connection-url>
                                    <jndi-name>java:jboss/datasources/tests</jndi-name>
                                    <enabled>true</enabled>
                                    <enable>true</enable>
                                    <user-name>***</user-name>
                                    <password>***</password>
                                    <driver-name>ojdbc6.jar</driver-name>
                                    <use-ccm>false</use-ccm>
                                </properties>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.17</version>
            <configuration>
                <systemPropertyVariables>
                    <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                    <jboss.home>${project.basedir}/target/wildfly-8.2.0.Final</jboss.home>
                    <module.path>${project.basedir}/target/wildfly-8.2.0.Final/modules</module.path>
                </systemPropertyVariables>
            </configuration>
            <executions>
                <execution>
                    <id>integration-test</id>
                    <goals>
                        <goal>integration-test</goal>
                    </goals>
                </execution>
                <execution>
                    <id>verify</id>
                    <goals>
                        <goal>verify</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>


    </plugins>

</build>

eriskooo
  • 189
  • 2
  • 5
2

Look at this nice article written by Dan Allen.

To be short: generally do not use an embedded container (glassfish with EclipseLink particularly). Standalone server gives us more accurate test results.

Also I prefer remote adapters due to speed of development (none server startup with every test launch, just start it manually once). If you want the container to start automatically like with embedded, then switch to a managed container.

Hope it helps.

G. Demecki
  • 10,145
  • 3
  • 58
  • 58
  • 2
    Hello Grzesiek, thank you very much for that informative and important link. I think I will change to remote container thus, especially because weaving is an important thing for me. The original (and still valid, to some point) idea was that someone can just download a Maven project and just run the unit/integration tests w/o installing a container. Again, thank you very much! – Timo Böwing Sep 19 '14 at 11:50
  • 1
    @TimoBoewing You are welcome:] I understand you well, because once I've also been trapped by this tempting idea. – G. Demecki Sep 19 '14 at 12:14
1

Well, I guess that it works differently w/ Wildfly than with Glassfish:

https://community.jboss.org/thread/236562

:(

Edit: Docker adds another perspective on this issue. I could easily manage the external container using Docker and Maven while still using Arquillian. Did not test it yet, but if someone stumbles upon this...

Timo Böwing
  • 313
  • 1
  • 2
  • 8
  • Thats true, but personally I would prefer remote (or managed) adapter, as it gives us more accurate test results (and less problems also). – G. Demecki Sep 18 '14 at 11:20