SeamFramework.orgCommunity Documentation

Chapter 4. Migration from 2.2 to 2.3

4.1. Migration of XML Schemas
4.1.1. Seam schema migration
4.1.2. Java EE 6 schema changes
4.2. Java EE 6 upgrade
4.2.1. Using Bean Validation standard instead of Hibernate Validator
4.2.2. Migration of JSF 1 to JSF 2 Facelets templates
4.2.3. Migration to JPA 2.0
4.2.4. Using compatible JNDI for resources
4.3. JBoss AS 7.1 deployment
4.3.1. Deployment changes
4.3.2. Datasource migration
4.4. Changes in testing framework
4.5. Dependency changes with using Maven
4.5.1. Seam Bill of Materials

Before you get started with Seam 2.3, there are a few things you should be aware of. This process should not be too painful - if you get stuck, just refer back to the updated Seam examples in Seam distribution.

This migration guide assumes you are using Seam 2.2, if you are migrating from Seam 1.2 or 2.0, see the jboss-seam-x.y.z.Final/seam2migration.txt and jboss-seam-x.y.z.Final/seam21migration.txt guide as well.

XML schemas for validation Files that use the Seam 2.2 XSDs should be updated to refer to the 2.3 XSDs, notice the version change. Current namespace pattern is* and schemaLocation URL was changed to*_-2.3.xsd, where * is Seam module.

Following snippet is an example of component declaration for 2.2 version:

Example 4.1. Before migration of Seam components.xml

<?xml version="1.0" encoding="UTF-8"?>
   <components xmlns=""

And finally migrated declaration of components.xml for 2.3 version:

Example 4.2. Migrated components.xml

<?xml version="1.0" encoding="UTF-8"?>
      <components xmlns=""

Next remainning migration step is pages.xml file(s) as well as other files only requires that the schemas be upgraded.

Seam 2.3 technology upgrade includes also Java EE 6 upgrade so you need to update the following descriptors

Examples of changed headers with correct versions are the following:

Seam 2.3 can integrate with the major upgrades in Java EE (from 5 to 6). You can use persistence with JPA 2, EJB 3.1 and Bean Validation. Almost all EE 6 technology upgrade requires to change XML schema declaration. See Section 4.1.2, “Java EE 6 schema changes”

Configuration file faces-config.xml is not required to be in your application, so for simple using of JSF 2 you need to migrate only web.xml. If you anyway would like to have it, change the XML schema declaration as is described in Example 4.8, “faces-config.xml”.

All your application JSF templates should use only facelets technology as JSP is deprecated.

In facelet templates there are required to convert <head>/<body> tags to ><h:head>/<h:body>respectively.

Depending on what JSF components that you use like Richfaces or Icefaces, there has to be some differences when upgrading from JSF 1.x to JSF 2.x. You may need to upgrade libraries entirely. Consult any component framework documentation on those changes. This migration doesn't cover these migration steps.

Using JPA 2 requires to change version to 2.0 in persistence.xml, see Example 4.5, “persistence.xml” file and version in application.xml should be 6 if you are using EAR - see Example 4.6, “application.xml” or version in web.xml file change to 3.0 if you use only WAR - look at Example 4.7, “web.xml”.

What is important for developers, most application can use just WAR with EJB 3.1 and doesn't have to package application as EAR.

JPA 2.0 is backward compatible with JPA 1.0, so you don't have to migrate any JPA annotation or classes. JPA 2.0 is more like enhancement to JPA 1.0.

Next level is migration of your target runtime. Seam 2.3 uses JBoss AS 7 as default target runtime.

If you are using for development or testing default datasource in JBoss AS 7.1, you need to change datasource JNDI in your persistence.xml from java:/DefaultDS to java:jboss/datasources/ExampleDS.

JBoss AS 7 has got refactored classloading model. Classloading of bundled or provided libraries can be managed in jboss-deployment-structure.xml or in META-INF/MANIFEST.MF file in section Dependencies. This migration documentation prefers using of jboss-deployment-structure.xml file, which should be placed in META-INF directory of your WAR or EAR application according to your application type.

For full EAR projects, the jboss-deployment-structure.xml will be located in the _your_ear_/META-INF directory.

For Web (non-ear) projects, the jboss-deployment-structure.xml will be located in the _your_war_/WEB-INF directory.

Minimal content for Seam 2.3 based application is:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
            <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 -->

More details are described in JBoss AS 7 documentation.

You can also include now any database descriptor (*-ds.xml) files into your project in the META-INF directory, and the data source will be deployed automatically when deployed to a JBoss AS 7.1 Application Server. The structure of the file though has changed. Before the datasource file was a simple xml based file, but now is an IronJacamar based file. Iron-Jacamar is the JBoss' JCA (Java Connector Architecture) project. Below on Example 4.9, “Sample Seam 2.2 Datasource Descriptor File” is the former datasource for JBoss AS 4/5, and Example 4.10, “Ironjacamar Datasource Descriptor File” shows the conversion to IronJacamar using the same driver, url, and credentials.

SeamTest and JBoss Embedded are legacy components and have many limitations and we doesn't support it like we did in Seam 2.2.

We now bring Arquillian as the replacement of JBoss Embedded and you should extend org.jboss.seam.mock.JUnitSeamTest instead of org.jboss.seam.mock.SeamTest, DBUnit testing is provided by org.jboss.seam.mock.DBJUnitSeamTest instead of org.jboss.seam.mock.DBUnitSeamTest. Due assertion issues with TestNG framework and Arquillian, we use JUnit as preferred test framework. Migration to Junit and Arquillian goes in the following steps:

  1. Add
    annotation to your test class.
  2. Your test class should extend org.jboss.seam.mock.JUnitSeamTest instead of org.jboss.seam.mock.SeamTest.
  3. Add a method like
    @OverProtocol("Servlet 3.0")
    public static org.jboss.shrinkwrap.api.Archive<?> createDeployment(){}
    for creating test deployment archive. The following example is taken from Registration example testsuite. It imports the .ear archive buit with "mvn package", adds the test class to the deployment and replaces the WEB-INF/web.xml file with a SeamTest-specific version.
    @OverProtocol("Servlet 3.0")
    public static Archive<?> createDeployment()
       EnterpriseArchive er = ShrinkWrap.create(ZipImporter.class, "seam-registration.ear").importFrom(new File("../registration-ear/target/seam-registration.ear"))
       WebArchive web = er.getAsType(WebArchive.class, "registration-web.war");
       // Install org.jboss.seam.mock.MockSeamListener
       return er;
  4. Create a SeamTest-specific web.xml contaning the org.jboss.seam.mock.MockSeamListener, instead of the usual org.jboss.seam.servlet.SeamListener.
    <?xml version="1.0" ?>
    <web-app version="3.0"

  5. Add arquillian.xml file into root of your classpath for running Arquillian test(s). The file content should specify path to remote or managed container and some specific options for JVM or Arquillian. The example of arquillian file is at jboss-seam-x.y.z.Final/examples/booking/booking-tests/src/test/resources-integration/arquillian.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <arquillian xmlns:xsi=""
            <property name="deploymentExportPath">target/</property>
        <container qualifier="jboss" default="true">
                <property name="javaVmArguments">-Xmx1024m -XX:MaxPermSize=512m</property>
                <property name="jbossHome">target/jboss-as-${version.jbossas7}</property>

More details in Seam reference documentation guide in Section 38.2, “Integration testing Seam components”.

The "provided" platform is now JBoss AS 7.1.x as is written above, therefore all Java EE dependencies included in AS 7 are now marked as provided.