1 Reply Latest reply on Feb 12, 2009 2:46 PM by pedrosena

    Embedded JBoss / Maven / SeamTest

    claumond.bd.mu

      Hello,

      In case it can help someone, I put below the pom.xml which permits us to run SeamTest.
      we have successfully run SeamTest implying JMS and JPA with a persistence.xml.

      The SeamTest have been be run in Eclipse using TestNG and specifying
      -Dsun.lang.ClassLoader.allowArraySyntax=true
      as VM arguments
      or using the command
      mvn test -Dtest=
      or
      mvn test -DsuiteXmlFiles=

      A simple mvn eclipse:eclipse will create the correct eclipse project files.
      Your project needs to follow the usual maven structure ( src/main/java, src/main/resources, src/test/java, src/test/resources)
      Then you need to copy/paste the 'bootstrap' folder found in the Seam download package into src/test/ so it leads to have 'src/test/bootstrap'

      Environment:
      Java "1.6.0_06" ( 1.5 or 1.6 equals or above _04 required)
      Maven 2.0.9 ( required )
      JBoss Embedded Beta3 ( beta3.SP3 may work too)
      Seam 2.0.3.CR1
      Eclipse for J2EE developer with JBoss IDE ( Version: 3.3.2 - Build id: M20080221-1800)

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      
       <modelVersion>4.0.0</modelVersion>
      
       <groupId>testEmbeddedJBoss</groupId>
       <artifactId>testEmbeddedJBoss</artifactId>
       <version>1.0</version>
       <name>testEmbeddedJBoss</name>
       <description>testEmbeddedJBoss</description>
      
       <!-- repositories related to Seam Test dependencies -->
       <repositories>
       <repository>
       <id>jboss</id>
       <url>http://repository.jboss.com/maven2</url>
       <releases>
       <enabled>true</enabled>
       </releases>
       <snapshots>
       <enabled>false</enabled>
       </snapshots>
       </repository>
       <repository>
       <id>ibiblio</id>
       <name>ibiblio repository</name>
       <url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url>
       </repository>
       </repositories>
      
       <dependencies>
      
       <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>3.8.2</version>
       </dependency>
      
       <!-- dependencies related to JBoss Embedded for Seam 2.X.X -->
       <dependency>
       <groupId>org.jboss.embedded</groupId>
       <artifactId>jboss-embedded-all</artifactId>
       <version>beta3</version>
       <exclusions>
       <exclusion>
       <groupId>org.jboss.microcontainer</groupId>
       <artifactId>jboss-deployers-client-spi</artifactId>
       </exclusion>
       <exclusion>
       <groupId>org.jboss.microcontainer</groupId>
       <artifactId>jboss-deployers-core-spi</artifactId>
       </exclusion>
       </exclusions>
       </dependency>
       <dependency>
       <groupId>org.jboss.embedded</groupId>
       <artifactId>hibernate-all</artifactId>
       <version>beta3</version>
       </dependency>
       <dependency>
       <groupId>org.jboss.embedded</groupId>
       <artifactId>thirdparty-all</artifactId>
       <version>beta3</version>
       </dependency>
      
       <!-- dependencies related to JBoss MicroContainer -->
      
       <!-- java.lang.NoClassDefFoundError: javax/faces/application/Application -->
       <dependency>
       <groupId>javax.faces</groupId>
       <artifactId>jsf-api</artifactId>
       <version>1.2_09</version>
       </dependency>
      
       <!-- java.lang.NoClassDefFoundError: [Ljavax/el/ELResolver -->
       <dependency>
       <groupId>javax.el</groupId>
       <artifactId>el-api</artifactId>
       <version>1.2</version>
       </dependency>
      
       <!-- java.lang.NoClassDefFoundError: org/jboss/el/ExpressionFactoryImpl -->
       <dependency>
       <groupId>org.jboss.el</groupId>
       <artifactId>jboss-el</artifactId>
       <version>2.0.1.GA</version>
       </dependency>
      
       <!-- dependencies related to TestNG -->
       <dependency>
       <groupId>org.testng</groupId>
       <artifactId>testng</artifactId>
       <version>5.8</version>
       <classifier>jdk15</classifier>
       </dependency>
      
       <dependency>
       <groupId>org.jboss.seam</groupId>
       <artifactId>jboss-seam</artifactId>
       <version>2.0.3.CR1</version>
       <exclusions>
       <exclusion>
       <groupId>javassist</groupId>
       <artifactId>javassist</artifactId>
       </exclusion>
       </exclusions>
       </dependency>
      
       </dependencies>
       <build>
       <testResources>
       <testResource>
       <directory>src/test/resources</directory>
       <filtering>true</filtering>
       </testResource>
       <!--
       encoding issue due to filtering on rar files.
      
       eclipse:eclipse takes in account only the first testResource when there is two with the same directory.
       Below, the first testResources include everything without filtering ( and so in maven, there is no encoding conversion)
       Then, the second testResources filters only the XML files.
      
       from documentation:
       Warning: Do not filter files with binary content like images! This will most likely result in corrupt output. If you have both text files and binary files as resources, you need to declare two mutually exclusive resource sets. The first resource set defines the files to be filtered and the other resource set defines the files to copy unaltered as illustrated below:
       -->
       <testResource>
       <directory>src/test/bootstrap</directory>
       <filtering>false</filtering>
       </testResource>
       <testResource>
       <directory>src/test/bootstrap</directory>
       <filtering>true</filtering>
       <includes>
       <include>**/*.xml</include>
       </includes>
       </testResource>
       </testResources>
      
       <plugins>
       <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-surefire-plugin</artifactId>
       <version>2.4.3</version>
       <configuration>
       <argLine>-Dsun.lang.ClassLoader.allowArraySyntax=true</argLine>
       <useManifestOnlyJar>false</useManifestOnlyJar>
       </configuration>
       </plugin>
       </plugins>
       </build>
      </project>
      


      In a "real" project, all those dependencies should be in scope 'test' but the aim here was to have a sample project with minimal configuration for Seam test to work on Embedded JBoss.

      We met a LOT of issues before getting it work, so don't hesitate to ask questions here if you got any issues.

      If you have any comments / improvments about the above configuration, Thanks in advance to post them here.

      Best regards,
      Christophe

      Tags: Embedded JBoss / Jboss Embedded / Maven / Seam / SeamTest

        • 1. Re: Embedded JBoss / Maven / SeamTest
          pedrosena

          Hi Cristophe,

          I have the same scenario with: Jboss Embedded + Maven + Seam + TestNG

          I'm having problems with JMS.

          It appears that the default Connection Factory "DefaultJMSProvider" is not being bound to JNDI.

          Can you share the files that are under src/test/resources/deploy ?

          Thanks a lot,

          Pedro Sena