Michael Yuan

“Science is a wonderful thing if one does not have to earn one’s living at it” — Albert Einstein

December 20th, 2006

Two Sample Chapters from the Seam Book

Finally, infoq published the first two chapters from the Seam book. The first chapter gives a brief introduction of Seam and the second walks you through a hello world application in Seam.

The book targets developers who already have the basic understanding of server-side Java application development (servlet, JSP, MVC, IoC etc.), and JSF experience would be very helpful.

Enjoy!

December 13th, 2006

JBoss Seam: Coming to an App Server Near You

With the GA release of Seam 1.1 today, Seam application developers now have a variety of deployment options available on JBoss AS, Glassfish, WebLogic, and Tomcat servers :

EJB3-based Seam Applications

If you would like to take advantage the full power of the EJB3 container and develop Seam applications using EJB3 session and entit beans (POJO-like components), your Seam application will be able to deploy in the following application servers.

  • JBoss AS 4.0.5 with EJB3: You must install the EJB3 profile of JBoss from the JEMS installer. All examples in the distribution deploys in JBoss AS with EJB3 support.
  • Sun Glassfish v1 UR1: The "examples/glassfish" project in the distrbution shows the Glassfish configuration for the Seam Hotel Booking example app. You can read more about it here.
  • Tomcat 5.5.17+: In this scenario, the application itself bundles and bootstraps a embedded JBoss EJB3 container. The “ant tomcat” build target in other examples (e.g. in "examples/booking" project) shows how to build Seam applications with JBoss Embeddedable EJB3 container for deployment on Tomcat.

We will test Seam on the Java EE 5.0 certified versions of WebLogic and Oracle when they come out.

POJO-based Seam Applications

If you just want to develop database-driven web applications, without needing EJB3 container services such as messaging, JMX etc., you can write your application in Seam and Hibernate POJOs. You can choose to use the Hibernate session API or the JPA EntityManager for data access. The Seam POJO example apps in the distribution re-implement the Seam Hotel Booking demo. They are in the "examples/hibernate2" (Hibernate Session) and "examples/jpa" (JPA EntityManager) projects respectively. For those applications, you can deploy on:

  • JBoss AS 4.0.5 with default J2EE profile: The Seam POJO applications deploy on JBoss AS with or without EJB3 support. Just run "ant jboss" to build the JBoss AS deployable WAR files.
  • Sun Glassfish v1 UR1: Glassfish has an TM bug with its embedded Derby database. So, we have to provide a workaround in a special Hibernate dialect in this scenario. See the readme.txt file in hibernate2 and jpa examples for more details. Run "ant glassfish" to build Glassfish deployable WAR files.
  • WebLogic 9.2: Run "ant weblogic" to build WebLogic deployable WAR files. You can deploy the example Seam POJO applications in the WebLogic “examples” server.
  • Tomcat 5.5.17+: For the Seam POJO apps, the app no longer needs to bootstrap the embedded EJB3 conatiner. But it does need to bootstrap a JTA datasource from the embedded HSQL database. Run "ant tomcat" to build the Tomcat deployable WAR files.
December 13th, 2006

Upgrade from Seam 1.0 to 1.1

This is a pretty import tip to almost all Seam users: In order to upgrade your Seam/Facelets application from Seam 1.0 to 1.1, you need to move the JSF EL library JARs from the WAR classpath to the EAR classpath. That is because in Seam 1.1, we have expanded the use of JSF EL in many non-web components.

To do that, you need to first move the el-ri.jar and el-api.jar files from your WAR file's WEB-INF/lib directory to the EAR file. Then, edit the EAR file's META-INF/application.xml file to include the following elements.

XML:
  1. <application>
  2.   ... ...
  3.  
  4.   <module>
  5.     <java>el-ri.jar</java>
  6.   </module>
  7.  
  8.   <module>
  9.     <java>el-api.jar</java>
  10.   </module>
  11.    
  12. </application>

Please refer to the official examples in the distribution for more details.

Of course, with Seam 1.1, you can also package your POJO-based (i.e., no EJB3) Seam applications in WAR files instead of in EAR files. In that case, the EL JARs stay in the WEB-INF/lib.