The Source for Java Technology Collaboration
User: Password:
Register | Login help    

Search

Online Books:
java.net on MarkMail:


Java EE SDK Runs Seam

Posted by rogerk on April 28, 2006 at 11:30 AM PDT
Seam-GlassFish I am happy to report that Seam (the JBoss application framework that unifies JSF and EJB 3.0) runs on GlassFish, the Open Source Application Server from which the Java EE SDK is built.  This required some modifications and rebuilding of Seam source code, mainly because of the repackaging of EJB classes in accordance to the latest EJB specification implementation.  JBoss is making the required changes, but for those of you who can't wait, I'll describe those changes and setup necessary to get a Seam application up and running on GlassFish.  Also, I'd like to point out, that these instructions are for the Seam 1.0beta2 release.  Recently JBoss has released a later version, but the interceptor related packaging changes are not there.   First, let's install the patches and get the Seam Booking application up and running.

Prerequisites:
  1. A working build environment with ant, at least JDK 5, and GlassFish (build 43 or later).
  2. For this application, you will also need to make sure you have the compatable Hibernate libraries with GlassFish:
    • Download and install Hibernate3 3.2cr1 or later.
    • Download and install Hibernate EntityManager 3.1 beta7 or later.
    • Copy the required hibernate jars into Glassfish lib dir. The script here contains the list of jars.
    • Edit the script to make sure it references your Glassfish and Hibernate install directories.
    • Execute the script.
Seam Setup:
  1. Download and install the Seam 1.0beta2 release from here.  You should see a jboss-seam-1.0beta2 directory.
  2. Get the zip files: seam-core-patch.zip and seam-booking-patch.zip .
  3. Go to the jboss-seam-1.0beta2 directory and unzip seam-core-patch.zip and seam-booking-patch.zip.
Compilation Procedure:
  1. Copy <glassfish install dir>/lib/javaee.jar to jboss-seam-1.0beta2/lib directory.
  2. Copy jboss-seam-1.0beta2/lib/jboss-common.jar <glassfish install dir>/lib  (needed for JBoss Logger)
  3. Compile Seam core classes:
    • Create an empty jboss-seam-1.0beta2/src/test directory (the build file is looking for this directory that is not there from the seam zip file).
    • Go to jboss-seam-1.0beta2 directory;  ant;
  4. Compile Seam Booking Application:
    • Copy jboss-seam-1.0beta2/jboss-seam-ui.jar to jboss-seam-1.0beta2/examples/booking/resources/WEB-INF/lib
    • Go to jboss-seam-1.0beta2/examples/booking
    • ant
Deploy and run the application:
  1. Start up Glassfish.
  2. Start the database:  <glassfish install dir>/bin/asadmin start-database
  3. Deploy jboss-seam-1.0beta2/examples/booking/build/jboss-seam-booking.ear
  4. Visit localhost:8080/seam-booking
Now, here is an explanation of changed modules.  The current JBoss Seam codebase is not up to date with the latest EJB specification (and implementation - as in GlassFish).  Seam classes still reference EJB interceptor related classes in the javax.ejb package, but these now exist in the javax.interceptor package.  JBoss will be updating their source, but I am not clear on when that will happen.

Core classes:
    src/main/org/jboss/seam/Component.java
    src/main/org/jboss/seam/ejb/SeamInterceptor.java
    src/main/org/jboss/seam/interceptors/BijectionInterceptor.java  
    src/main/org/jboss/seam/interceptors/BusinessProcessInterceptor.java  
    src/main/org/jboss/seam/interceptors/ConversationInterceptor.java  
    src/main/org/jboss/seam/interceptors/Interceptor.java  
    src/main/org/jboss/seam/interceptors/JavaBeanInterceptor.java  
    src/main/org/jboss/seam/interceptors/OutcomeInterceptor.java  
    src/main/org/jboss/seam/interceptors/RemoveInterceptor.java  
    src/main/org/jboss/seam/interceptors/RollbackInterceptor.java  
    src/main/org/jboss/seam/interceptors/SeamInvocationContext.java  
    src/main/org/jboss/seam/interceptors/ValidationInterceptor.java  
           ----> interceptor package changes described above
    src/main/org/jboss/seam/jsf/SeamPhaseListener.java  
           ----> moved initilialization of SeamVariableResolver, SeamNavigationHandler, SeamStateManager to
                   faces-config.xml, so they get created at startup.

    src/main/org/jboss/seam/jsf/SeamStateManager.java  
           ----> new class taken from StateManagerInterceptor class in SeamPhaseListener
    src/main/META-INF/faces-config.xml  
           ----> defines SeamVariableResolver, SeamNavigationHandler, SeamStateManager
           ----> modified component definition for HtmlQueryTable
    src/main/org/jboss/seam/mock/MockServletContext.java  
           ----> stubbed in  public String getContextPath() method

Booking Application Modules:
    examples/booking/resources/import.sql
    examples/booking/resources/META-INF/persistence.xml
            ----> updated for application with GlassFish
    examples/booking/resources/WEB-INF/web.xml
            ----> reference 2.5 schema, etc..
            ----> modified JNDI name pattern for EJB lookups
            ----> disabled MyFaces StartupServletContextListener (not compatable with JSF 1.2)
            ----> added <ejb-local-ref> elements for EJB modules
    examples/booking/src/org/jboss/seam/example/booking/BookingListAction.java
    examples/booking/src/org/jboss/seam/example/booking/ChangePasswordAction.java
    examples/booking/src/org/jboss/seam/example/booking/HotelBookingAction.java
    examples/booking/src/org/jboss/seam/example/booking/LoggedInInterceptor.java
    examples/booking/src/org/jboss/seam/example/booking/LoggedIn.java
    examples/booking/src/org/jboss/seam/example/booking/LoginAction.java
    examples/booking/src/org/jboss/seam/example/booking/LogoutAction.java
    examples/booking/src/org/jboss/seam/example/booking/RegisterAction.java
           ----> interceptor package changes described above
    examples/booking/src/org/jboss/seam/example/booking/User.java
           ----> create "Users" table and reference it as "user" (User is reserved in javaee5)
    examples/booking/view/main.xhtml
    examples/booking/view/template.xhtml
           ----> added missing JSF "form" tags


Comments
Comments are listed in date ascending order (oldest first)