Wednesday, June 15, 2011

Arquillian Getting Started difficulties with JBoss AS

If you're looking forward to use Arquillian following "Getting Started" section at:
 http://docs.jboss.org/arquillian/reference/latest/en-US/html_single/#containers.configuration

One thing I would tell you, It's not that easy! It doesn't mean you've better ways to learn about the APIs, the link above is single best source for exploring Arquillian. No offense to community/authors, but Getting started section need to be either updated/framed for a single container.

I got the example working after investing 2-3 days, 3-4 hours/day.. reading from the blogs at communities.

Hope this blog can save some of your time. I'll mainly list out the differences from Getting Started section:


1. You need to place a file "arquillian.xml" at "src/test/resources". This is what it reads for me:

<?xml version="1.0"?>
<arquillian xmlns="http://jboss.com/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="jbossas" default="true">
     <configuration>
        <property name="providerUrl">jnp://localhost:1099</property>
     </configuration>
     <protocol type="Servlet 3.0">
        <configuration>
            <property name="host">localhost</property>
            <property name="port">8080</property>
        </configuration>
     </protocol>
 </container>
</arquillian>

2. Below is important sections from my Project's POM.

I'm using jboss-as-client 6.0 M1, because I got some errors (If i remember correctly there were some problem with POMs while downloading woodstox jar, saaj-apis etc..) while maven tried to download dependencies for jboss-as-client 6.0.Final.

    <profiles>
        <profile>
            <id>jbossas-remote-6</id>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.jbossas</groupId>
                    <artifactId>jboss-as-profileservice-client</artifactId>
                    <version>6.0.0.Final</version>
                    <type>pom</type>
                </dependency>
                <dependency>
                    <groupId>org.jboss.arquillian.container</groupId>
                    <artifactId>arquillian-jbossas-remote-6</artifactId>
                    <version>${arquillian.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.jboss.jbossas</groupId>
                    <artifactId>jboss-as-client</artifactId>
                    <version>6.0.0.M1</version>
                    <type>pom</type>
                </dependency>
            </dependencies>
        </profile>
    </profiles>

2. You need to use Shrinkwrap alpha-12.

        <dependency>
            <groupId>org.jboss.shrinkwrap</groupId>
            <artifactId>shrinkwrap-api</artifactId>
            <version>1.0.0-alpha-12</version>
        </dependency>

3. You need to use one more repository:

        <repository>
            <id>jboss-deprecated-public-repository-group</id>
            <name>JBoss Deprecated Public Maven Repository Group</name>
            <url>https://repository.jboss.org/nexus/content/repositories/deprecated/</url>
            <layout>default</layout>

Now I think you should be set.

Start JBoss, execute your test cases and you should see below messages at JBoss console:


Hope this helps. Drop a comment, If you've any question.


1 comment:

  1. have you tried this with jboss 7 ? i cannot get it to work. Any help would be greatly appreciated

    ReplyDelete