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:
- 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:
- Download and install the Seam 1.1.0GA release from here.
You should see a jboss-seam-1.1.0.GA directory.
- Go to the jboss-seam-1.1.0.GA/examples/glassfish directory.
- Build the sample application using the "toplink" build target:
The "toplink" target builds the EAR file using toplink as the JPA provider.
Deploy the application:
- Start up GlassFish: <glassfish
install dir>/bin/asadmin start-domain domain1
-
Start the database: <glassfish
install dir>/bin/asadmin
start-database
- 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:
- 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
- Go to the directory that contains the import.sql script.
- 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
- Get into the "ij" utility: java org.apache.derby.tools.ij
- 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