Help

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Considering the following configuration, this document explains how to deploy a project created using the Seam new project wizard in RAD:

  • Seam : 2.1.1.GA
  • IDE : IBM's RAD 7.5.1 + Jboss Tools 3.0.0.CR2
  • Application server : IBM's Websphere 7.0.0.1
  • Deployment mode : WAR or EAR

The obtained result is a Seam application running, but without a connection to a datasource. The question of persistence is not the main concern here: we just want the default Seam application running withing a minute (more or less).

Jboss Tools 3.0.0.CR2 is installed by unzipping in the directory containing the Eclipse executabl (under Windows: the eclipse.exe file, located e.g. in C:/Win32App/IBM/SDP/). Note that RAD 7.5 is based on Eclipse 3.4, which is a requirement for Jboss Tools 3.x.

Preliminary note: EAR deployment mode will only work smoothly for Seam 2.1.2.CR2 under WAS 7.0.0.3. At the time of writing (early march 2009), these version are/were not available so the EAR walkthrough uses patched version of WAS and Seam.

You may also be interested by other Websphere 7 related setup:

WAR deployment mode

  1. Create a new Seam Web Project
  2. Rename the ${PROJECT_NAME}/src/main/META-INF/persistence.xml file to persistence.xml.old. Recall: ideally, you would configure your persistence here, but please remind that persistence is not the main concern here.
  3. Add missing JAR libraries into ${PROJECT_NAME}/WebContent/WEB-INF/lib/ to avoid NoClassDefFoundExceptions:
    dom4j.jar
    hibernate3.jar (version used: 3.3.1.GA)
    hibernate-annotations.jar
    hibernate-common-annotations.jar
    hibernate-entitymanager.jar
    hibernate-validator.jar
    javassist.jar (version used: 3.4.GA)
    jsf4j-api.jar (required by Hibernate jars; version used 1.5.6)
    jsf4j-jdk14.jar (required by Hibernate jars; version used 1.5.6; use slf4j-log4j12-1.5.6.jar + log4j-1.2.15.jar if you prefer Log4j to JUL) )
  4. Upgrade Richfaces JARs to version 3.3.0.GA. Required to correct a bug in Seam 2.1.1.GA, solved since Seam 2.1.2.GA, see JBSEAM-3570. Replace the JARs ${PROJECT_NAME}/WebContent/WEB-INF/lib/richfaces-*.jar:
    richfaces-api.jar
    richfaces-impl.jar
    richfaces-ui.jar
  5. Export the project as WAR file (menu File \ Export... \ Web\WAR file).
  6. Deploy the WAR file on the WAS 7 in parent last mode. See Seam documentation and knowledge base for details if you are not familiar with that mode.

    Note: if you are using WAS 7.0.0.1, your WAR archive may take very long time to be deployed (about 15 minutes). The symptoms are similar to the ones described in PK74505 but the PK74505 iFix does not correct the problem. IBM suggests to change the web.xml version from 2.5 to 2.4 (try Google to get a web.xml); it solved the problem for us. This suggests that the problem occurs when the machine is not connected to the web.

  7. Test the application: http://localhost:9080/${PROJECT_NAME}

EAR deployment mode

When deploying a Seam 2.1.1.GA an EAR under WAS 7.0.0.1, you way ran into WAS bugs and Seam bugs. The preliminary notes give hints about how to correct them.

Preliminary note about WAS 7.0.0.1 issues

Websphere 7.0.0.1 has a bug about @ApplicationException which is corrected in the WAS 7.0.0.3 version (to be delivered late march 2009). The error message is:

...
 wtp  E org.eclipse.jst.j2ee.commonarchivecore.internal.impl.EJBJarFileImpl processAnnotations Annotations scanning of EJB JAR [ jboss-seam.jar ] completed with errors.
wtp  E org.eclipse.jst.j2ee.commonarchivecore.internal.impl.EJBJarFileImpl processAnnotations Annotations error:
                                 com.ibm.wsspi.amm.validate.ValidationException: @ApplicationException may only be applied to classes that subclass java.lang.Exception or java.lang.Error, class [ org.jboss.seam.security.NotLoggedInException ]
	at com.ibm.ws.amm.validate.ejb.ApplicationExceptionValidator.validate(ApplicationExceptionValidator.java:62)
...

See Denis Forveille's post for details. If you can't wait until end of march 2009, ask IBM the patch related to IBM's PK74419.

Preliminary note about Seam 2.1.1.GA issues

Denis also found and solved another issue, this time with Seam. The error message is :

[18/11/08 16:17:51:537 EST] 0000001a annotations E AnnotativeMetadataManagerImpl merge Caught exception while merging
                                 com.ibm.wsspi.amm.validate.ValidationException: For method, org.jboss.seam.persistence.EntityManagerProxyInterceptor.postActivate(Lorg/jboss/seam/intercept/InvocationContext;)V\[com.ibm.ws.amm.scan.util.info.impl.MethodInfoImpl@1b8e1b8e\], parameters were specified, but null was the expected comparison 

See JIRA issue JBSEAM-3726 for details. The solution is to wait Seam 2.1.2.CR2, or to apply Denis's patch on your own.

Deployment walkthrough

This walkthrough supposes that you have Websphere 7.0.0.1 + PK74419 patch (or even better: WAS 7.0.0.3) and Seam 2.1.1.GA + patch JBSEAM-3726 (or even better: Seam 2.1.2.CR2).

  1. Create a new Seam EAR project using the Jboss Tools wizard. This creates four projects: ${PROJECT_NAME}, ${PROJECT_NAME}-ear, ${PROJECT_NAME}-ejb, and ${PROJECT_NAME}-test.
  2. Create a dummy EJB in the ${PROJECT_NAME}-ejb project (at least one EJB is required otherwise the EJB jar will not de deployed). Note that this dummy EJB will be removed afterwards when you develop a real project.
  3. Remove the ${PROJECT_NAME}-ejb/ejb-module/META-INF/persistence.xml file. This is required to deploy without error if you did not defined the underlying datasources. Recall: here we want to deploy quickly without persistence, but you will have to deal with the persistence.xml in your real project.
  4. Upgrade Richfaces libraries to 3.3.0.GA (corrects an infinite loop in LRUMapCacheFactory, see JBSEAM-3570) by replacing ${PROJECT_NAME}-ear/EarContent/richfaces-api.jar and ${PROJECT_NAME}/WebContent/WEB-INF/lib/richfaces-*.jar by their Richfaces 3.3.0.GA equivalent.
  5. Add missing JAR libraries into ${PROJECT_NAME}-ear/EarContent/ to avoid NoClassDefFoundExceptions:
    dom4j.jar
    hibernate3.jar (version used: 3.3.1.GA)
    hibernate-annotations.jar
    hibernate-common-annotations.jar
    hibernate-entitymanager.jar
    hibernate-validator.jar
    javassist.jar (version used: 3.4.GA)
    jsf4j-api.jar (required by Hibernate jars; version used 1.5.6)
    jsf4j-jdk14.jar (required by Hibernate jars; version used 1.5.6; use slf4j-log4j12-1.5.6.jar + log4j-1.2.15.jar if you prefer Log4j to JUL)
  6. Update the ${PROJECT_NAME}/.../META-INF/MANIFEST.MF to add the EAR libraries listed in the two points above.
  7. Refresh (F5) and clean the ${PROJECT_NAME}* projects (Project\Clean menu).
  8. Deploy the EAR on the server (right click, Add and Remove projects).
  9. Test your application on http://localhost:9080/${PROJECT_NAME}