28.6. Deployment in Red Hat JBoss Enterprise Application Platform 6

JBoss Enterprise Application Platform 6 is the default deployment target for all examples in Seam 2.3 distribution.
Seam 2.3 requires to have setup special deployment metada file jboss-deployment-structure.xml for correct initialization. Minimal content for EAR is:

Example 28.1. jboss-deployment-structure.xml


<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
  <deployment>
    <dependencies>
      <module name="org.dom4j" export="true"/>
      <module name="org.apache.commons.collections" export="true"/>
      <module name="javax.faces.api" export="true"/>
    </dependencies>
  </deployment>  
</jboss-deployment-structure>
For further details about classloading see your application server documentation.

Important

There is a significant enhancement for speed up the application deployment. This unfortunatelly can cause some issues while you have multiple war/ejb modules in your application.
This situation requires to use and set up new Java EE 6 configuration parameter - Module initialization order - in application.xml - initialize-in-order to true. This causes that initialization will happen in defined order like it is in application.xml. Example of application.xml:

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" 
	     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"version="6" 
	     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
	     http://java.sun.com/xml/ns/javaee/application_6.xsd">
  <application-name>test-app</application-name>
  <initialize-in-order>true</initialize-in-order>
  <module>
    <ejb>jboss-seam.jar</ejb>
  </module>
  <module>
    <web>
      <web-uri>test-web1.war</web-uri>
      <context-root>test</context-root>
    </web>
    <web>
      <web-uri>test-web2.war</web-uri>
      <context-root>test2</context-root>
    </web>
  </module>
</application>
If you are using maven-ear-plugin for generation of your application, you can use this plugin configuration:

<plugin>
  <artifactId>maven-ear-plugin</artifactId>
  <!-- from version 2.6 the plugin supports Java EE 6 descriptor -->
  <version>2.7</version>
  <configuration> 
    <version>6</version>
    <generateApplicationXml>true</generateApplicationXml> 
    <defaultLibBundleDir>lib</defaultLibBundleDir>                
    <initializeInOrder>true</initializeInOrder>
    <modules> 
      <jarModule> 
        <groupId>org.jboss.el</groupId> 
        <artifactId>jboss-el</artifactId> 
        <includeInApplicationXml>false</includeInApplicationXml> 
        <bundleDir>lib</bundleDir> 
      </jarModule> 
      <ejbModule> 
        <groupId>org.jboss.seam</groupId> 
        <artifactId>jboss-seam</artifactId> 
        <bundleFileName>jboss-seam.jar</bundleFileName>                         
      </ejbModule> 
      <ejbModule> 
        <groupId>some.user.module</groupId> 
        <artifactId>hello-ejbs</artifactId> 
        <bundleFileName>hello-ejbs.jar</bundleFileName>                         
      </ejbModule> 
      <webModule> 
        <groupId>some.user.module</groupId> 
        <artifactId>hello-web1</artifactId> 
        <contextRoot>/hello1</contextRoot> 
        <bundleFileName>hello-web1.war</bundleFileName> 
      </webModule> 
      <webModule> 
        <groupId>some.user.module</groupId> 
        <artifactId>hello-web2</artifactId> 
        <contextRoot>/hello2</contextRoot> 
        <bundleFileName>hello-web2.war</bundleFileName> 
      </webModule>                                         
    </modules> 
  </configuration> 
</plugin>