4.3.2. Migrate the Seam 2.2 JPA Example to JBoss EAP 6
Summary
The following task list summarizes the changes needed to successfully migrate the Seam 2.2 JPA example application to JBoss EAP 6. This example application can be found in the latest JBoss EAP 5 distribution under EAP5.x_HOME/jboss-eap-5.x/seam/examples/jpa/
Important
Applications that use Hibernate directly with Seam 2.2 may use a version of Hibernate 3 packaged inside the application. Hibernate 4, which is provided through the org.hibernate module of JBoss EAP 6, is not supported by Seam 2.2. This example is intended to help you get your application running on JBoss EAP 6 as a first step. Please be aware that packaging Hibernate 3 with a Seam 2.2 application is not a supported configuration.
Procedure 4.6. Migrate the Seam 2.2 JPA Example
Remove the jboss-web.xml file
Remove thejboss-web.xml
file from thejboss-seam-jpa.war/WEB-INF/
directory. The class loading defined in thejboss-web.xml
is now the default behavior.Modify the
jboss-seam-jpa.jar/META-INF/persistence.xml
file as follows.- Remove or comment out the
hibernate.cache.provider_class
property in thejboss-seam-jpa.war/WEB-INF/classes/META-INF/persistence.xml
file:<!-- <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/> -->
- Add the provider module property to the
jboss-seam-booking.jar/META-INF/persistence.xml
file:<property name="jboss.as.jpa.providerModule" value="hibernate3-bundled" />
- Change the
jta-data-source
property to use the default JDBC datasource JNDI name:<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
Add Seam 2.2 dependencies
Copy the following JARs from the Seam 2.2 distribution library,SEAM_HOME/lib/
, into thejboss-seam-jpa.war/WEB-INF/lib/
directory:- antlr.jar
- slf4j-api.jar
- slf4j-log4j12.jar
- hibernate-entitymanager.jar
- hibernate-core.jar
- hibernate-annotations.jar
- hibernate-commons-annotations.jar
- hibernate-validator.jar
Create a jboss-deployment-structure file to add remaining dependencies
Create ajboss-deployment-structure.xml
file in thejboss-seam-jpa.war/WEB-INF/
folder containing the following data:<jboss-deployment-structure> <deployment> <exclusions> <module name="javax.faces.api" slot="main"/> <module name="com.sun.jsf-impl" slot="main"/> <module name="org.hibernate" slot="main"/> </exclusions> <dependencies> <module name="org.apache.log4j" /> <module name="org.dom4j" /> <module name="org.apache.commons.logging" /> <module name="org.apache.commons.collections" /> <module name="javax.faces.api" slot="1.2"/> <module name="com.sun.jsf-impl" slot="1.2"/> </dependencies> </deployment> </jboss-deployment-structure>
Result:
The Seam 2.2 JPA example application deploys and runs successfully on JBoss EAP 6.