This document describes the steps to run JBoss Seam's booking
sample application on Apache Geronimo 2.1. You can read about JBoss Seam at its web site.
This document applied to JBoss Seam 2.0.0.GA. Download it from http://sourceforge.net/project/showfiles.php?group_id=22866&package_id=163777&release_id=551158.
This document applies to Geronimo 2.1 daily build (aka 2.1-SNAPSHOT). Until it's released you can download it from http://people.apache.org/~prasad/binaries/trunk/20071129/geronimo-jetty6-javaee5-2.1-SNAPSHOT-bin.zip.
The plan
The plan configures necessary Geronimo resources to deploy JBoss Seam's booking sample application.
<?xml version="1.0" encoding="UTF-8"?> <application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"> <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2"> <moduleId> <groupId>org.jboss.seam.examples.jee5</groupId> <artifactId>jboss-seam-jee5</artifactId> <version>2.0.0.GA</version> <type>ear</type> </moduleId> <dependencies> <dependency> <groupId>org.apache.geronimo.hibernate.transaction</groupId> <artifactId>geronimo-hibernate-transaction-manager-lookup</artifactId> <type>jar</type> </dependency> </dependencies> </environment> <module> <web>jboss-seam-jee5.war</web> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1"> <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2"> <moduleId> <groupId>org.jboss.seam.examples.jee5</groupId> <artifactId>jboss-seam-jee5</artifactId> <version>2.0.0.GA</version> <type>war</type> </moduleId> </environment> <context-root>/seam-jee5</context-root> </web-app> </module> <module> <ejb>jboss-seam-jee5.jar</ejb> <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1"> <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2"> <moduleId> <groupId>org.jboss.seam.examples.jee5</groupId> <artifactId>jboss-seam-jee5</artifactId> <version>2.0.0.GA</version> <type>jar</type> </moduleId> </environment> <!-- overrides what's in the module's persistence.xml --> <persistence xmlns="http://java.sun.com/xml/ns/persistence"> <persistence-unit name="bookingDatabase"> <jta-data-source>jdbc/__default</jta-data-source> <class>org.jboss.seam.example.booking.Booking</class> <class>org.jboss.seam.example.booking.Hotel</class> <class>org.jboss.seam.example.booking.User</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties> <property name="hibernate.transaction.manager_lookup_class" value="org.apache.geronimo.hibernate.transaction.GeronimoTransactionManagerLookup" /> </properties> </persistence-unit> <!-- change the way the default PU works - make it an alias to bookingDatabase PU --> <persistence-unit name="cmp"> <class>org.jboss.seam.example.booking.Booking</class> <class>org.jboss.seam.example.booking.Hotel</class> <class>org.jboss.seam.example.booking.User</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> </persistence-unit> </persistence> </openejb-jar> </module> <ext-module> <connector>seam-jee5-dbpool</connector> <external-path xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2"> <dep:groupId>org.tranql</dep:groupId> <dep:artifactId>tranql-connector-derby-embed-xa</dep:artifactId> <dep:type>rar</dep:type> </external-path> <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2"> <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2"> <moduleId> <groupId>org.jboss.seam.examples.jee5</groupId> <artifactId>booking-dbpool</artifactId> <version>2.0.0.GA</version> <type>rar</type> </moduleId> <dependencies> <dependency> <groupId>org.apache.geronimo.configs</groupId> <artifactId>system-database</artifactId> <type>car</type> </dependency> </dependencies> </environment> <resourceadapter> <outbound-resourceadapter> <connection-definition> <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface> <connectiondefinition-instance> <name>jdbc/__default</name> <config-property-setting name="DatabaseName">SystemDatabase</config-property-setting> <connectionmanager> <local-transaction /> <single-pool> <max-size>100</max-size> <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds> <select-one-assume-match /> </single-pool> </connectionmanager> </connectiondefinition-instance> </connection-definition> </outbound-resourceadapter> </resourceadapter> </connector> </ext-module> </application>
Starting Geronimo
Type it in on the command line.
$ ./bin/geronimo.sh run -vv
Using GERONIMO_BASE: c:\geronimo-jetty6-jee5-2.0.2
Using GERONIMO_HOME: c:\geronimo-jetty6-jee5-2.0.2
Using GERONIMO_TMPDIR: c:\geronimo-jetty6-jee5-2.0.2\var\temp
Using JRE_HOME: c:\apps\java5\jre
...
Geronimo startup complete
Deploying jboss-seam-jee5.ear
Build the booking sample as follows:
jlaskowski@dev /cygdrive/c/apps/jboss-seam-2.0.0.GA/examples/jee5/booking
$ ant clean archive
Buildfile: build.xml
...
archive:
[jar] Building jar: c:\apps\jboss-seam-2.0.0.GA\examples\jee5\booking\dist\jboss-seam-jee5.jar
[jar] Building jar: c:\apps\jboss-seam-2.0.0.GA\examples\jee5\booking\dist\jboss-seam-jee5.war
[jar] Building jar: c:\apps\jboss-seam-2.0.0.GA\examples\jee5\booking\dist\jboss-seam-jee5.ear
BUILD SUCCESSFUL
Total time: 23 seconds
You can deploy jboss-seam-jee5.ear from the web console of Geronimo, but there's another way to do the same - executing deploy
command on the command line.
jlaskowski@dev /cygdrive/c/geronimo-jetty6-jee5-2.0.2
$ ./bin/deploy.sh -u system -p manager deploy hudson.war hudson-geronimo-plan.xml
Using GERONIMO_BASE: c:\geronimo-jetty6-jee5-2.0.2
Using GERONIMO_HOME: c:\geronimo-jetty6-jee5-2.0.2
Using GERONIMO_TMPDIR: c:\geronimo-jetty6-jee5-2.0.2\var\temp
Using JRE_HOME: c:\apps\java5\jre
Deployed hudson/hudson/1.153/war @ /hudson
The Geronimo console shows deployment progress as follows:
hudson home directory: C:\Documents and Settings\jlaskowski\.hudson 2007-11-08 08:53:12 hudson.TcpSlaveAgentListener <init> INFO: JNLP slave agent listener started on TCP port 3448 2007-11-08 08:53:12 hudson.model.Hudson load INFO: Took 31 ms to load
Running the webapp
Point the browser of your choice to http://localhost:8080/hudson. You should see hudson's welcome page.
Setting up a new Maven2 job in hudson works fine too.