4.3. Red Hat JBoss Enterprise Application Platform 6 deployment

4.3.1. Deployment changes

The next level of migration is the migration of the target runtime. Seam 2.3 uses JBoss Enterprise Application Platform 6 as its default target runtime.
Change the JNDI datasource in the persistence.xml file from java:/DefaultDS to java:jboss/datasources/ExampleDS.
Utilize refactored classloading. Classloading of bundled or provided libraries can be managed in jboss-deployment-structure.xml file or in META-INF/MANIFEST.MF file, in the Dependencies section. We recommend you to use the jboss-deployment-structure.xml file, which should be placed in the META-INF directory of your WAR or EAR application, based on your application type.
For EAR projects, the jboss-deployment-structure.xml file is located in the _your_ear_/META-INF directory.
For Web (non-ear) projects, the jboss-deployment-structure.xml file is located in the _your_war_/WEB-INF directory.
The minimal content for Seam 2.3 based applications is:

<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"/>
      <!-- keep there only if you use JSF as view technology -->
    </dependencies>
  </deployment>  
</jboss-deployment-structure>
For further information, see the JBoss Enterprise Application Server 6 Development Guide on Class Loading and Modules.

4.3.2. Datasource migration

You can include a database descriptor (*-ds.xml) file in your project in the META-INF directory. The data source is deployed automatically when you deploy the application. The structure of the database descriptor (*-ds.xml) file is changed to be based on IronJacamar (IronJacamar). Iron-Jacamar is the JBoss JCA (Java Connector Architecture) project. Example 4.9, “Sample Seam 2.2 Datasource Descriptor File” is the former datasource for JBoss. Example 4.10, “Ironjacamar Datasource Descriptor File” is the conversion of the datasource to IronJacamar using the same driver, url, and credentials.

Example 4.9. Sample Seam 2.2 Datasource Descriptor File


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE datasources PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN""http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
<datasources>
  <local-tx-datasource>
    <jndi-name>seamdiscsDatasource</jndi-name>
    <connection-url>jdbc:hsqldb:.</connection-url>
    <driver-class>org.hsqldb.jdbcDriver</driver-class>
    <user-name>sa</user-name>
    <password></password>
  </local-tx-datasource>
</datasources>

Example 4.10. Ironjacamar Datasource Descriptor File


<?xml version="1.0" encoding="UTF-8"?>
<datasources xmlns="http://www.jboss.org/ironjacamar/schema">
  <datasource jndi-name="java:/jboss/seamdiscsDatasource" enabled="true" use-java-context="true" pool-name="seamdiscs">
    <connection-url>jdbc:hsqldb:.</connection-url>
    <driver>org.hsqldb.jdbcDriver</driver>
    <security>
      <user-name>sa</user-name>
      <password></password>
    </security>
  </datasource>
</datasources>