[seam-commits] Seam SVN: r9119 - trunk/doc/Seam_Reference_Guide/en-US.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Sep 23 11:19:02 EDT 2008


Author: manaRH
Date: 2008-09-23 11:19:02 -0400 (Tue, 23 Sep 2008)
New Revision: 9119

Added:
   trunk/doc/Seam_Reference_Guide/en-US/Glassfish.xml
Modified:
   trunk/doc/Seam_Reference_Guide/en-US/Author_Group.xml
Log:
Added Glassfish chapter

Modified: trunk/doc/Seam_Reference_Guide/en-US/Author_Group.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Author_Group.xml	2008-09-23 14:51:16 UTC (rev 9118)
+++ trunk/doc/Seam_Reference_Guide/en-US/Author_Group.xml	2008-09-23 15:19:02 UTC (rev 9119)
@@ -64,6 +64,10 @@
       <firstname>Jacob</firstname>
       <surname>Orshalick</surname>
    </author>
+   <author>
+      <firstname>Marek</firstname>
+      <surname>Novotny</surname>
+   </author>
    <othercredit>
       <firstname>James</firstname>
       <surname>Cobb</surname>

Added: trunk/doc/Seam_Reference_Guide/en-US/Glassfish.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Glassfish.xml	                        (rev 0)
+++ trunk/doc/Seam_Reference_Guide/en-US/Glassfish.xml	2008-09-23 15:19:02 UTC (rev 9119)
@@ -0,0 +1,917 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="glassfish">
+	<title>Seam on Glassfish application server</title>
+
+	<para>Glassfish is an open source application server which
+		fully implements
+		Java EE 5. The latest stable release is v2 UR2.</para>
+
+	<para>First we will go over some basic information about the
+		Glassfish environment that we used for these examples. We will go over
+		the details of those steps with the jee5 example. We will also deploy
+		the JPA example application. Finally we show customizing of seam-gen's
+		generated application.</para>
+
+	<section>
+		<title>Glassfish environment and deployment information
+		</title>
+
+		<para>Glassfish is a open source project and its installation
+			is very
+			easy. This section will detail the exact server versions used and
+			installation tips.</para>
+
+		<section>
+			<title>Installation version and tips</title>
+
+			<para>
+				All of the examples and information in this chapter are based on
+				the the latest version of Glassfish at the time of this writing.
+				<itemizedlist>
+					<listitem>
+						<para>
+							<ulink url="https://glassfish.dev.java.net/downloads/v2ur2-b04.html">
+								Glassfish v2 UR2 - download page</ulink>
+						</para>
+					</listitem>
+				</itemizedlist>
+			</para>
+
+			<para>
+				After downloading suitable jar file with Glassfish, install it by
+				writing on command line in case of linux version:
+				<programlisting>java -Xmx256m -jar
+					glassfish-installer-v2ur2-b04-linux.jar</programlisting>
+			</para>
+
+			<para>
+				After installing, setup glassfish, the following command creates
+				Glassfish server domain:
+				<programlisting>cd glassfish; ant -f setup.xml</programlisting>
+				The created domain name is domain1.
+			</para>
+
+			<para>
+				Start the embedded JavaDB server:
+				<programlisting>bin/asadmin start-database
+				</programlisting>
+				This is default embedded database server in Glassfish.
+			</para>
+
+			<para>
+				Start the Glassfish server domain1:
+				<programlisting>bin/asadmin start-domain domain1
+				</programlisting>
+			</para>
+
+			<para>
+				The deployment and configuration is available at the Web
+				Administration console at http://localhost:4848/. Access the web
+				admin
+				console with default username/password: admin/adminadmin. You can also
+				copy EAR/WAR file to
+				<literal>glassfish/domains/domain1/autodeploy
+				</literal>
+				for quick
+				automatic deployment.
+			</para>
+
+			<para>
+				Stopping the server and database can be done by the following
+				command:
+				<programlisting>bin/asadmin stop-domain domain1;
+					bin/asadmin stop-database</programlisting>
+			</para>
+		</section>
+	</section>
+
+	<section id="jee5-glassfish-section">
+		<title>
+			The
+			<literal>jee5/booking</literal>
+			example
+		</title>
+
+		<para>
+			The
+			<literal>jee5/booking</literal>
+			example is based on the Hotel
+			Booking example (which runs on JBoss AS). Out of the box it is also
+			designed to run on Glassfish. It is located in the
+			<literal>$SEAM_DIST/examples/jee5/booking
+			</literal>
+			directory.
+		</para>
+
+		<section id="jee5-glassfish-deploy">
+			<title>Deploying the application to Glassfish</title>
+
+			<para>We will deploy the application on Glassfish with using of
+				Glassfish's administration console.</para>
+
+			<para>
+				The steps below are for the Glassfish version stated above.
+				<orderedlist>
+					<listitem>
+						<para>
+							Log in to the administration console
+							<programlisting>http://localhost:4848
+							</programlisting>
+						</para>
+					</listitem>
+
+					<listitem>
+						<para>
+							Access the
+							<literal>Enterprise Applications</literal>
+							in the
+							menu option under the
+							<literal>Applications</literal>
+							left side
+							menu.
+						</para>
+					</listitem>
+
+					<listitem>
+						<para>
+							At the top of the
+							<literal>Enterprise Application</literal>
+							table select
+							<literal>Deploy</literal>
+							. Below are installation
+							wizard pages and what needs to done on each:
+							<itemizedlist>
+								<listitem>
+									<para>
+										<literal>Preparing for the application
+											installation</literal>
+										<itemizedlist>
+											<listitem>
+												<para>
+													Browse to the
+													<literal>examples/jee5/booking/dist/jboss-seam-jee5.ear
+													</literal>
+													file using the file upload widget.
+												</para>
+											</listitem>
+
+											<listitem>
+												<para>
+													Select the
+													<literal>OK</literal>
+													button.
+												</para>
+											</listitem>
+										</itemizedlist>
+									</para>
+								</listitem>
+							</itemizedlist>
+						</para>
+					</listitem>
+
+					<listitem>
+						<para>
+							You can now access the application at
+							<literal>http://localhost:8081/seam-jee5/
+							</literal>
+							.
+						</para>
+					</listitem>
+				</orderedlist>
+			</para>
+		</section>
+	</section>
+
+	<section id="jpa-glassfish-section">
+		<title>
+			The
+			<literal>jpa</literal>
+			booking example
+		</title>
+
+		<para>This is the Hotel Booking example implemented in Seam POJOs
+			and
+			using Hibernate JPA with JPA transactions. It does not require EJB3
+			support to run on application server.</para>
+
+		<para>The example already has a break-out of configurations and
+			build
+			scripts for many of the common containers including Glassfish.</para>
+
+		<para>First thing we are going to do is build and deploy that
+			example.</para>
+
+		<section>
+			<title>
+				Building the
+				<literal>jpa</literal>
+				example
+			</title>
+
+			<para>
+				Building it only requires running the correct ant command:
+				<programlisting>ant glassfish</programlisting>
+				This will create
+				container specific distribution and exploded archive directories with
+				the
+				<literal>glassfish</literal>
+				suffix.
+			</para>
+		</section>
+
+		<section>
+			<title>
+				Deploying the
+				<literal>jpa</literal>
+				example
+			</title>
+
+			<para>
+				This is very similar to the
+				<literal>jee5</literal>
+				example at
+				<xref linkend="jee5-glassfish-deploy" />
+				.
+			</para>
+
+			<itemizedlist>
+				<listitem>
+					<para>
+						Log in to the administration console
+						<programlisting>http://localhost:4848
+						</programlisting>
+					</para>
+				</listitem>
+
+				<listitem>
+					<para>
+						Access the
+						<literal>Web Applications</literal>
+						in the menu
+						option under the
+						<literal>Applications</literal>
+						left side menu.
+						<itemizedlist>
+							<listitem>
+								<para>
+									<literal>Preparing for the application
+										installation</literal>
+									<itemizedlist>
+										<listitem>
+											<para>
+												Browse to the
+												<literal>examples/jpa/dist-glassfish/jboss-seam-jpa.war
+												</literal>
+												file using the file upload widget.
+											</para>
+										</listitem>
+
+										<listitem>
+											<para>
+												Select the
+												<literal>OK</literal>
+												button.
+											</para>
+										</listitem>
+									</itemizedlist>
+								</para>
+							</listitem>
+
+							<listitem>
+								<para>
+									You can now access the application at
+									<literal>http://localhost:8081/jboss-seam-jpa/
+									</literal>
+									.
+								</para>
+							</listitem>
+						</itemizedlist>
+					</para>
+				</listitem>
+			</itemizedlist>
+
+			<note>
+				<title>Using Derby instead of Hypersonic SQL DB</title>
+
+				In order for the app to work out of the box with Glassfish, we have
+				used the Derby (i.e., Java DB) database in Glassfish. However, we
+				strongly recommend you to use a non-Derby data source (e.g., HSQL is
+				a much better embeded DB) if possible. The
+				examples/jpa/resources-glassfish/WEB-INF/classes/GlassfishDerbyDialect.class
+				is a special hack to get around a Derby bug in Glassfish server. You
+				must use it as your Hibernate dialect if you use Derby with
+				Glassfish.
+			</note>
+		</section>
+
+		<section>
+			<title>What's different for Glassfish v2 UR2</title>
+
+			<para>The differences between the JPA examples that deploys to
+				JBoss 4.2
+				and Glassfish v2 UR2. Expected differences are in persistence related
+				configurations.</para>
+
+			<itemizedlist>
+				<listitem>
+					<para>
+						Configuration file changes
+						<itemizedlist>
+							<listitem>
+								<para>
+									<literal>META-INF/persistence.xml
+									</literal>
+									— the main
+									changes here are for the datasource JNDI path, switching to
+									the Glassfish transaction manager look up class, and changing
+									the hibernate dialect to be
+									<literal>GlassfishDerbyDialect</literal>
+									.
+								</para>
+							</listitem>
+
+							<listitem>
+								<para>
+									<literal>WEB-INF/classes/GlassfishDerbyDialect.class
+									</literal>
+									— this class is needed for the hibernate dialect
+									change to
+									<literal>GlassfishDerbyDialect</literal>
+								</para>
+							</listitem>
+
+							<listitem>
+								<para>
+									<literal>import.sql</literal>
+									— either for the dialect
+									or Derby DB the
+									<literal>ID</literal>
+									column can not be
+									populated by this file and was removed.
+								</para>
+							</listitem>
+						</itemizedlist>
+					</para>
+				</listitem>
+			</itemizedlist>
+		</section>
+	</section>
+
+	<section>
+		<title>
+			Deploying an application generated by
+			<literal>seam-gen</literal>
+			on Glassfish v2 UR2
+		</title>
+
+		<para>
+			<literal>seam-gen</literal>
+			is a very useful tool for developers to
+			quickly get an application up and running, and provides a foundation to
+			add your own functionality. Out of box
+			<literal>seam-gen</literal>
+			will
+			produce applications configured to run on JBoss AS. These instructions
+			will show the steps needed to get it to run on Glassfish. As stated above
+			in
+			<xref linkend="jee5-glassfish-section" />
+			there is easy to deploy on
+			glassfish either EJB3 or Seam POJOs based application
+		</para>
+
+		<section>
+			<title>
+				Running
+				<literal>seam-gen</literal>
+				Setup
+			</title>
+
+			<para>
+				The first step is setting up
+				<literal>seam-gen</literal>
+				to
+				construct the base project. There are several choices made below,
+				specifically the datasource and hibernate values that we will adjust
+				once the project is created.
+			</para>
+
+			<programlisting>
+				./seam setup
+				Buildfile: build.xml
+
+				init:
+
+				setup:
+				[echo] Welcome to seam-gen :-)
+				[input] Enter your Java project workspace (the directory that contains your
+				Seam projects) [C:/Projects] [C:/Projects]
+				/home/mnovotny/projects
+				[input] Enter your JBoss home directory [C:/Program Files/jboss-4.2.3.GA]
+				[C:/Program Files/jboss-4.2.3.GA]
+
+				[input] Enter the project name [myproject] [myproject]
+				seamgen_example
+				[echo] Accepted project name as: seamgen_example
+				[input] Do you want to use ICEfaces instead of RichFaces [n] (y, [n])
+
+				[input] skipping input as property icefaces.home.new has already
+				been set.
+				[input] Select a RichFaces skin [blueSky] ([blueSky], classic, ruby, wine,
+				deepMarine, emeraldTown, japanCherry, DEFAULT)
+
+				[input] Is this project deployed as an EAR (with EJB components) or a WAR
+				(with no EJB support) [ear] ([ear], war)
+
+				[input] Enter the Java package name for your session beans
+				[com.mydomain.seamgen_example] [com.mydomain.seamgen_example]
+				org.jboss.seam.tutorial.glassfish.action
+				[input] Enter the Java package name for your entity beans
+				[org.jboss.seam.tutorial.glassfish.action]
+				[org.jboss.seam.tutorial.glassfish.action]
+				org.jboss.seam.tutorial.glassfish.model
+				[input] Enter the Java package name for your test cases
+				[org.jboss.seam.tutorial.glassfish.action.test]
+				[org.jboss.seam.tutorial.glassfish.action.test]
+				org.jboss.seam.tutorial.glassfish.test
+				[input] What kind of database are you using? [hsql] ([hsql], mysql, oracle,
+				postgres, mssql, db2, sybase, enterprisedb, h2)
+
+				[input] Enter the Hibernate dialect for your database
+				[org.hibernate.dialect.HSQLDialect]
+				[org.hibernate.dialect.HSQLDialect]
+
+				[input] Enter the filesystem path to the JDBC driver jar
+				[../lib/hsqldb.jar] [../lib/hsqldb.jar]
+
+				[input] Enter JDBC driver class for your database [org.hsqldb.jdbcDriver]
+				[org.hsqldb.jdbcDriver]
+
+				[input] Enter the JDBC URL for your database [jdbc:hsqldb:.]
+				[jdbc:hsqldb:.]
+
+				[input] Enter database username [sa] [sa]
+
+				[input] Enter database password [] []
+
+				[input] Enter the database schema name (it is OK to leave this blank) [] []
+
+				[input] Enter the database catalog name (it is OK to leave this
+				blank) [] []
+
+				[input] Are you working with tables that already exist in the database? [n]
+				(y, [n])
+
+				[input] Do you want to drop and recreate the database tables and data in
+				import.sql each time you deploy? [n] (y, [n])
+
+				[propertyfile] Creating new property file:
+				/home/mnovotny/workspaces/jboss/jboss-seam/seam-gen/build.properties
+				[echo] Installing JDBC driver jar to JBoss server
+				[copy] Copying 1 file to
+				/home/mnovotny/workspaces/jboss/jboss-seam/seam-gen/C:/Program
+				Files/jboss-4.2.3.GA/server/default/lib
+				[echo] Type 'seam create-project' to create the new project
+
+				BUILD SUCCESSFUL
+				Total time: 4 minutes 5 seconds
+</programlisting>
+
+			<para>
+				Type
+				<literal>./seam new-project</literal>
+				to create your project
+				and
+				<literal>cd /home/mnovotny/projects/seamgen_example</literal>
+				to
+				the newly created structure.
+			</para>
+		</section>
+
+		<section>
+			<title>Changes needed for deployment to Glassfish</title>
+
+			<para>We now need to make some changes to the generated project.
+			</para>
+
+			<section>
+				<title>Configuration file changes</title>
+
+				<variablelist>
+					<varlistentry>
+						<term>
+							<literal>resources/META-INF/persistence-dev.xml
+							</literal>
+						</term>
+
+						<listitem>
+							<itemizedlist>
+								<listitem>
+									<para>
+										Alter the
+										<literal>jta-data-source</literal>
+										to be
+										<literal>jdbc/__default</literal>
+										. We are going to be
+										using the integrated Glassfish Derby DB.
+									</para>
+								</listitem>
+
+								<listitem>
+									<para>
+										Add or change the properties below. These are
+										described in detail at
+										<xref linkend="jee5-glassfish-section" />
+										:
+									</para>
+
+									<programlisting role="XML">
+&lt;property name="hibernate.dialect" value="GlassfishDerbyDialect"/&gt;
+&lt;property name="hibernate.hbm2ddl.auto" value="update"/&gt;
+&lt;property name="hibernate.show_sql" value="true"/&gt;
+&lt;property name="hibernate.format_sql" value="true"/&gt;
+&lt;property name="hibernate.cache.provider_class" 
+          value="org.hibernate.cache.HashtableCacheProvider"/&gt;
+&lt;property name="hibernate.transaction.manager_lookup_class" 
+          value="org.hibernate.transaction.SunONETransactionManagerLookup"/&gt;</programlisting>
+                </listitem>
+
+                <listitem>
+                  <para>You'll need to alter
+                  <literal>persistence-prod.xml</literal> as well if you want
+                  to deploy to Glassfish using the prod profile.</para>
+                </listitem>
+              </itemizedlist>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term><literal>resources/GlassfishDerbyDialect.class</literal></term>
+
+            <listitem>
+              <para>As with other examples we need to include this class for
+              DB support. It can be copied from the <literal>jpa</literal>
+              example into the <literal>seamgen_example/resources</literal>
+              directory. <programlisting>
+cp $SEAM_DIST/examples/jpa/resources-glassfish/WEB-INF/classes/GlassfishDerbyDialect.class
+   ./resources</programlisting></para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term><literal>resources/META-INF/jboss-app.xml</literal></term>
+
+            <listitem>
+              <para>You can delete this file as we aren't deploying to JBoss
+              AS ( <literal>jboss-app.xml</literal> is used to enable
+              classloading isolation in JBoss AS)</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term><literal>resources/*-ds.xml</literal></term>
+
+            <listitem>
+              <para>You can delete these file as we aren't deploying to JBoss
+              AS (these files define data sources in JBoss AS, we are using
+              Glassfish's default data source)</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term><literal>resources/WEB-INF/components.xml</literal></term>
+
+            <listitem>
+              <itemizedlist>
+                <listitem>
+                  <para>Enable container managed transaction integration - add
+                  the <literal> &lt;transaction:ejb-transaction /&gt;
+                  </literal> component, and it's namespace declaration
+                  <literal>
+                  xmlns:transaction="http://jboss.com/products/seam/transaction"
+                  </literal></para>
+                </listitem>
+
+                <listitem>
+                  <para>Alter the <literal>jndi-pattern</literal> to <literal>
+                  java:comp/env/seamgen_example/#{ejbName}/local </literal></para>
+                </listitem>
+
+              </itemizedlist>
+            </listitem>
+          </varlistentry>
+		  <varlistentry>
+              <term> <literal>resources/WEB-INF/web.xml</literal>
+              </term>
+              <listitem>
+                 <para>As with the <literal>jee5/booking</literal>
+                    example we need to add EJB references to the web.xml. These
+                    references require the empty
+                    <literal>local-home</literal> to flag them for
+                    Glassfish to perform the proper binding.</para>
+                  
+                  
+                  <programlisting role="XML"><![CDATA[
+  <ejb-local-ref>              
+    <ejb-ref-name>seamgen_example/AuthenticatorAction</ejb-ref-name>                
+    <ejb-ref-type>Session</ejb-ref-type>     
+    <local-home></local-home>
+    <local>org.jboss.seam.tutorial.glassfish.action.Authenticator</local>  
+  </ejb-local-ref>
+   
+  <ejb-local-ref>
+    <ejb-ref-name>seamgen_example/EjbSynchronizations</ejb-ref-name>  
+    <ejb-ref-type>Session</ejb-ref-type>
+    <local-home></local-home>
+    <local>org.jboss.seam.transaction.LocalEjbSynchronizations</local>
+  </ejb-local-ref>]]></programlisting>
+               </listitem>
+            </varlistentry>
+         </variablelist>
+      </section>
+
+      <section>
+        <title>Creating the <literal>AuthenticatorAction</literal> EJB</title>
+
+        <para>We want to take the existing <literal>Authenticator</literal>
+        Seam POJO component and create an EJB3 out of it.</para>
+
+        <orderedlist>
+          <listitem>
+            <itemizedlist>
+              <listitem>
+                <para>Rename the class to
+                <literal>AuthenticatorAction</literal></para>
+              </listitem>
+
+              <listitem>
+                <para>Add the <literal>@Stateless</literal> annotation to the
+                new <literal>AuthenticatorAction</literal> class.</para>
+              </listitem>
+
+              <listitem>
+                <para>Create an interface called
+                <literal>Authenticator</literal> which
+                <literal>AuthenticatorAction</literal> implements (EJB3
+                requires session beans to have a local interface). Annotate
+                the interface with <literal>@Local</literal> , and add a
+                single method with same signature as the
+                <literal>authenticate</literal> in
+                <literal>AuthenticatorAction</literal> .</para>
+              </listitem>
+            </itemizedlist>
+
+            <programlisting role="JAVA">
+ at Name("authenticator") @Stateless 
+public class AuthenticatorAction implements Authenticator {</programlisting>
+
+            <programlisting role="JAVA">
+ at Local 
+public interface Authenticator { 
+  public boolean authenticate(); 
+}</programlisting>
+          </listitem>
+
+          <listitem>
+            <para>We've already added its reference to the
+            <literal>web.xml</literal> file so are good to go.</para>
+          </listitem>
+        </orderedlist>
+      </section>
+
+      <section>
+        <title>Extra jar dependencies and other changes to the
+        <literal>build.xml</literal></title>
+
+        <para>This application has similar requirements as the
+        <literal>jee5/booking</literal> example.</para>
+
+        <itemizedlist>
+          <listitem>
+            <para>Change the default target to <literal>archive</literal> (we
+            aren't going to cover automatic deployment to Websphere).</para>
+
+            <programlisting role="XML">
+&lt;project name="seamgen_example" default="archive" basedir="."&gt;</programlisting>
+          </listitem>
+
+ 		<listitem>
+            <para>Websphere looks for the drools
+            <literal>/security.drl</literal> file in the root of the
+            <literal>war</literal> file instead of the root of the
+            <literal>seamgen_example.jar</literal> so we need to have the
+            <literal>build.xml</literal> move it to the correct location at
+            build time. The following must be added at the top of the
+            <literal> &lt;target name="war" depends="compile"
+            description="Build the distribution .war file"&gt; </literal>
+            target.</para>
+
+            <programlisting role="XML">
+&lt;copy todir="${war.dir}"&gt;
+   &lt;fileset dir="${basedir}/resources" &gt;
+       &lt;include name="*.drl" /&gt;
+   &lt;/fileset&gt;
+&lt;/copy&gt;</programlisting>
+          </listitem> 
+
+          <listitem>
+            <para>We need to get the
+            <literal>GlassfishDerbyDialect.class</literal> into our
+            application jar. To do that find the <literal>jar</literal> task
+            and modify the top of it so that it looks like this:</para>
+
+            <programlisting role="XML">
+&lt;target name="jar" depends="compile,copyclasses" 
+   description="Build the distribution .jar file"&gt;
+   &lt;copy todir="${jar.dir}"&gt;
+      &lt;fileset dir="${basedir}/resources"&gt;
+          &lt;include name="seam.properties" /&gt;
+          &lt;include name="*.drl" /&gt;
+          &lt;include name="GlassfishDerbyDialect.class" /&gt;
+      &lt;/fileset&gt;
+   &lt;/copy&gt;
+...</programlisting>
+          </listitem>
+
+   		  <listitem>
+            <para>Next we need to get the <literal>jboss-seam.jar</literal>
+            into the base of the <literal>EAR</literal> file. For deployment
+            Glassfish requires this jar to be in both the
+            <literal>/lib</literal> directory and at the base of the
+            <literal>EAR</literal>. You must add the following to the
+            <literal>archive</literal> task:</para>
+
+            <programlisting role="XML">
+&lt;fileset dir="${lib.dir}"&gt;
+   &lt;include name="jboss-seam.jar" /&gt;
+&lt;/fileset&gt;</programlisting>
+
+            <para>So that the whole <literal>archive</literal> task looks
+            like:</para>
+
+            <programlisting role="XML">
+&lt;target name="archive" depends="jar,war,ear" 
+        description="Package the archives"&gt;
+   &lt;jar jarfile="${dist.dir}/${project.name}.jar" basedir="${jar.dir}"/&gt;
+   &lt;jar jarfile="${dist.dir}/${project.name}.war" basedir="${war.dir}"/&gt;
+   &lt;jar jarfile="${dist.dir}/${project.name}.ear"&gt;
+       &lt;fileset dir="${ear.dir}"/&gt;
+       &lt;fileset dir="${dist.dir}"&gt;
+           &lt;include name="${project.name}.jar"/&gt;
+           &lt;include name="${project.name}.war"/&gt;
+       &lt;/fileset&gt;
+       &lt;fileset dir="${lib.dir}"&gt;
+          &lt;include name="jboss-seam.jar" /&gt;
+       &lt;/fileset&gt;
+    &lt;/jar&gt;
+&lt;/target&gt;</programlisting>
+          </listitem>
+          <listitem>
+            <para>Now we need to get extra jars into the
+            <literal>build.xml</literal>. Look for the <literal>&lt;fileset
+            dir="${basedir}"&gt;</literal> section of the task below. Add the
+            new includes at the bottom of the fileset.</para>
+
+            <programlisting role="XML">
+&lt;target name="ear" description="Build the EAR"&gt;
+    &lt;copy todir="${ear.dir}"&gt;
+            &lt;fileset dir="${basedir}/resources"&gt;
+                    &lt;include name="*jpdl.xml" /&gt;
+                    &lt;include name="*hibernate.cfg.xml" /&gt;
+                    &lt;include name="jbpm.cfg.xml" /&gt;
+            &lt;/fileset&gt;
+         &lt;fileset dir="${lib.dir}"&gt;
+               &lt;include name="jboss-seam.jar" /&gt;
+         &lt;/fileset&gt;
+            &lt;fileset dir="${basedir}"&gt;
+                    &lt;include name="lib/jbpm*.jar" /&gt;
+                    &lt;include name="lib/jboss-el.jar" /&gt;
+                    &lt;include name="lib/drools-*.jar"/&gt;
+                    &lt;include name="lib/core.jar"/&gt;
+                    &lt;include name="lib/janino*.jar"/&gt;
+                    &lt;include name="lib/antlr-*.jar"/&gt;
+                    &lt;include name="lib/mvel*.jar"/&gt;
+                  &lt;include name="lib/richfaces-api*.jar" /&gt;
+            &lt;/fileset&gt;
+    &lt;/copy&gt;
+    &lt;copy todir="${ear.dir}/META-INF"&gt;
+            &lt;fileset dir="${basedir}/resources/META-INF"&gt;
+                    &lt;include name="application.xml" /&gt;
+                    &lt;include name="jboss-app.xml" /&gt;
+            &lt;/fileset&gt;
+    &lt;/copy&gt;
+&lt;/target&gt;</programlisting>
+
+            <itemizedlist>
+              <listitem>
+                <para>Add Hibernate dependencies</para>
+
+                <programlisting role="XML">
+   &lt;!-- Hibernate and deps --&gt;
+   &lt;include name="lib/hibernate.jar"/&gt;
+   &lt;include name="lib/hibernate-commons-annotations.jar"/&gt;
+   &lt;include name="lib/hibernate-annotations.jar"/&gt;
+   &lt;include name="lib/hibernate-entitymanager.jar"/&gt;
+   &lt;include name="lib/hibernate-validator.jar"/&gt;
+   &lt;include name="lib/jboss-common-core.jar" /&gt;</programlisting>
+              </listitem>
+
+             <listitem>
+                <para>Add JSF dependencies. You will need to copy the
+                <literal>el-ri.jar</literal> from the
+                <literal>$SEAM_DIST/lib</literal> directory.</para>
+
+                <programlisting role="XML">
+   &lt;!-- jsf libs --&gt;
+   &lt;include name="lib/jsf-api.jar" /&gt;
+   &lt;include name="lib/jsf-impl.jar" /&gt;
+   &lt;include name="lib/el-api.jar" /&gt;
+   &lt;include name="lib/el-ri.jar"/&gt;</programlisting>
+              </listitem>
+
+              <listitem>
+                <para>Add third party dependencies.</para>
+
+                <programlisting role="XML">
+   &lt;!-- 3rd party and supporting jars --&gt;
+   &lt;include name="lib/javassist.jar"/&gt;
+   &lt;include name="lib/dom4j.jar" /&gt;
+   &lt;include name="lib/concurrent.jar" /&gt;
+   &lt;include name="lib/cglib.jar"/&gt;
+   &lt;include name="lib/asm.jar"/&gt;
+   &lt;include name="lib/antlr.jar" /&gt;
+   &lt;include name="lib/commons-logging.jar" /&gt;
+   &lt;include name="lib/commons-collections.jar" /&gt;</programlisting>
+              </listitem>   
+            </itemizedlist>
+
+            <para>You should end up with something like:</para>
+
+            <programlisting role="XML">
+&lt;fileset dir="${basedir}"&gt;
+
+   &lt;include name="lib/jbpm*.jar" /&gt;
+   &lt;include name="lib/jboss-el.jar" /&gt;
+   &lt;include name="lib/drools-*.jar"/&gt;
+   &lt;include name="lib/core.jar"/&gt;
+   &lt;include name="lib/janino*.jar"/&gt;
+   &lt;include name="lib/antlr-*.jar"/&gt;
+   &lt;include name="lib/mvel*.jar"/&gt;
+   &lt;include name="lib/richfaces-api*.jar" /&gt;
+                                 
+   &lt;!-- Hibernate and deps --&gt;
+   &lt;include name="lib/hibernate.jar"/&gt;
+   &lt;include name="lib/hibernate-commons-annotations.jar"/&gt;
+   &lt;include name="lib/hibernate-annotations.jar"/&gt;
+   &lt;include name="lib/hibernate-entitymanager.jar"/&gt;
+   &lt;include name="lib/hibernate-validator.jar"/&gt;
+   &lt;include name="lib/jboss-common-core.jar" /&gt;
+               
+   &lt;!-- jsf libs --&gt;
+   &lt;include name="lib/jsf-api.jar" /&gt;
+   &lt;include name="lib/jsf-impl.jar" /&gt;
+   &lt;include name="lib/el-api.jar" /&gt;
+   &lt;include name="lib/el-ri.jar"/&gt;
+               
+   &lt;!-- 3rd party and supporting jars --&gt;
+   &lt;include name="lib/javassist.jar"/&gt;
+   &lt;include name="lib/dom4j.jar" /&gt;
+   &lt;include name="lib/concurrent.jar" /&gt;
+   &lt;include name="lib/cglib.jar"/&gt;
+   &lt;include name="lib/asm.jar"/&gt;
+   &lt;include name="lib/antlr.jar" /&gt;
+   &lt;include name="lib/commons-logging.jar" /&gt;
+   &lt;include name="lib/commons-collections.jar" /&gt;
+                           
+&lt;/fileset&gt;</programlisting>
+          </listitem>
+        </itemizedlist>
+      </section>
+
+      <section>
+        <title>Building and deploying the seam-gen'd application to
+        Glassfish</title>
+
+        <itemizedlist>
+          <listitem>
+            <para>Build your application by calling <literal>ant</literal> in
+            the base directory of your project (ex.
+            <literal>/projects/seamgen-example</literal> ). The target of the
+            build will be <literal>dist/seamgen-example.ear</literal> .</para>
+          </listitem>
+
+          <listitem>
+            <para>To deploy the application follow the instructions here :
+            <xref linkend="jee5-glassfish-deploy" /> but use references to
+            this project <literal>seamgen-example</literal> instead of
+            <literal>jboss-seam-jee5</literal>.</para>
+          </listitem>
+
+          <listitem>
+            <para>Checkout the app at:
+            <literal>http://localhost:8081/seamgen_example/</literal></para>
+          </listitem>
+        </itemizedlist>
+      </section>
+    </section>
+  </section>
+</chapter>
\ No newline at end of file


Property changes on: trunk/doc/Seam_Reference_Guide/en-US/Glassfish.xml
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:mime-type
   + text/plain




More information about the seam-commits mailing list