Skip to main content

Seam 1.1.0.GA On GlassFish

Posted by rogerk on January 4, 2007 at 10:12 AM PST

To get prior releases of Seam running on GlassFish, you had to patch some Seam application modules. With this release, there is no patchwork necessary - the folks at JBoss (RedHat) have done a great job of streamlining the process. In fact, after you download and unpack the Seam 1.1.0.GA release from here,
you will see a GlassFish sample application (which is essentially the booking application) under the "jboss-seam-1.1.0.GA\examples\glassfish" directory. In this entry, we will outline the steps to get this release of Seam running on GlassFish with Java Persistence.



Prerequisites:

  1. A working build environment with ant,
    at least JDK 5,
    and GlassFish. I've run this version of Seam successfully on the GlassFish v1 FCS (v1_ur1-p01-b02) and GlassFish v2 (Build 30) builds.

Seam Setup:

  1. Download and install the Seam 1.1.0GA release from here
    You should see a jboss-seam-1.1.0.GA directory.
  2. Go to the jboss-seam-1.1.0.GA/examples/glassfish directory.
  3. Build the sample application using the "toplink" build target:
    • ant clean; ant toplink

    The "toplink" target builds the EAR file using toplink as the JPA provider.

Deploy the application:

  1. Start up GlassFish:   <glassfish
    install dir>
    /bin/asadmin start-domain domain1
  2. Start the database:  <glassfish
    install dir>
    /bin/asadmin
    start-database
  3. Deploy jboss-seam-1.1.0.GA/examples/glassfish/build/jboss-seam-glassfish.ear
    • Note that deploying the application will create the necessary application database tables, and undeploying the application will remove the application database tables.

Load the database:

  1. Get the sql script that will be used to load the database from
    here and unpack it to some directory. You should see the script: import.sql
  2. Go to the directory that contains the import.sql script.
  3. Set your CLASSPATH to include:
    • <glassfish install dir>/javadb/lib/derbyclient.jar
    • <glassfish install dir>/javadb/lib/derbytools.jar
    • <glassfish install dir>/javadb/lib/derby.jar
  4. Get into the "ij" utility: java org.apache.derby.tools.ij
  5. At the "ij>" prompt:
    • ij> DRIVER 'org.apache.derby.jdbc.ClientDriver';
    • ij> CONNECT 'jdbc:derby://localhost:1527/sun-appserv-samples';
    • ij> run 'import.sql';
  • Now the Seam application tables should be loaded.

Run the application:

  • visit localhost:8080/jboss-seam-glassfish
Related Topics >>