[seam-commits] Seam SVN: r11413 - branches/community/Seam_2_2/doc/Seam_Reference_Guide/en-US.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Aug 20 20:42:12 EDT 2009
Author: denis.forveille
Date: 2009-08-20 20:42:11 -0400 (Thu, 20 Aug 2009)
New Revision: 11413
Modified:
branches/community/Seam_2_2/doc/Seam_Reference_Guide/en-US/Websphere.xml
Log:
JBSEAM-4324
Removed unusable section on seam-gen for WAS
Modified: branches/community/Seam_2_2/doc/Seam_Reference_Guide/en-US/Websphere.xml
===================================================================
--- branches/community/Seam_2_2/doc/Seam_Reference_Guide/en-US/Websphere.xml 2009-08-21 00:18:43 UTC (rev 11412)
+++ branches/community/Seam_2_2/doc/Seam_Reference_Guide/en-US/Websphere.xml 2009-08-21 00:42:11 UTC (rev 11413)
@@ -605,591 +605,4 @@
</section>
</section>
-
- <section>
- <title>Deploying an application created using <literal>seam-gen</literal> on WebSphere V7</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
- WebSphere. This section will take you through the exact steps.
- </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><![CDATA[
-./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/jbalunas/workspace
- [input] Enter your JBoss home directory [C:/Program Files/jboss-4.2.3.GA]
-[C:/Program Files/jboss-4.2.3.GA]
-/home/jbalunas/jboss/jboss-4.2.3.GA
- [input] Enter the project name [myproject] [myproject]
-websphere_example
- [echo] Accepted project name as: websphere_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, sakura, 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 [org.jboss.seam.
-tutorial.websphere.action] [org.jboss.seam.tutorial.websphere.action]
-org.jboss.seam.tutorial.websphere.action
- [input] Enter the Java package name for your entity beans [org.jboss.seam.
-tutorial.websphere.model] [org.jboss.seam.tutorial.websphere.model]
-org.jboss.seam.tutorial.websphere.model
- [input] Enter the Java package name for your test cases [org.jboss.seam.
-tutorial.websphere.action.test] [org.jboss.seam.tutorial.websphere.action.test]
-org.jboss.seam.tutorial.websphere.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 [/tmp/seam/lib/hsqldb.jar]
-[/tmp/seam/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:
-/rhdev/projects/jboss-seam/svn-seam_2_2/jboss-seam-2_2/seam-gen/build.properties
- [echo] Installing JDBC driver jar to JBoss server
- [copy] Copying 1 file to /home/jbalunas/jboss/jboss-4.2.3.GA/server/default/lib
- [echo] Type 'seam create-project' to create the new project
-
-BUILD SUCCESSFUL
-Total time: 3 minutes 5 seconds]]></programlisting>
-
- <para>
- Type
- <literal>./seam new-project</literal>
- to create your
- project and
- <literal>cd
- /home/jbalunas/workspace/websphere_example</literal>
- to the
- newly created structure.
- </para>
-
- </section>
- <section>
- <title>Changes needed for deployment to Websphere</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>DefaultDatasource</literal>
- . We are
- going to be using the integrated Websphere
- DB.
- </para>
- </listitem>
- <listitem>
- <para>
- Add or change the properties below.
- These are described in detail at
- <xref linkend="jee5-websphere-section" />
- :
- </para>
-
- <programlisting role="XML"><![CDATA[
-<property name="hibernate.dialect" value="GlassfishDerbyDialect"/>
-<property name="hibernate.hbm2ddl.auto" value="update"/>
-<property name="hibernate.show_sql" value="true"/>
-<property name="hibernate.format_sql" value="true"/>
-<property name="hibernate.cache.provider_class"
- value="org.hibernate.cache.HashtableCacheProvider"/>
-<property name="hibernate.transaction.manager_lookup_class"
- value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup"/>]]></programlisting>
- </listitem>
- <listitem>
- <para> Remove the JBoss AS specific method of exposing
- the EntityManagerFactory: </para>
-
- <programlisting role="XML"><![CDATA[<property
- name="jboss.entity.manager.factory.jndi.name"
- value="java:/websphere_exampleEntityManagerFactory">]]></programlisting>
- </listitem>
- <listitem>
- <para>
- You'll need to alter
- <literal>persistence-prod.xml</literal>
- as
- well if you want to deploy to Websphere using the
- prod profile.
- </para>
- </listitem>
- </itemizedlist>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <literal>src/GlassfishDerbyDialect.java
- </literal>
- </term>
- <listitem>
- <para>
- As with other examples we need to include this java class for
- DB support. It can be copied from the
- <literal>jpa</literal>
- example into the
- <literal>websphere_example/src</literal>
- directory.
-
- <programlisting><![CDATA[
-cp $SEAM/examples/jpa/src/GlassfishDerbyDialect.java
- ./src]]></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 datasources in JBoss AS, we
- are using Websphere's default datasource) </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>
- <transaction:ejb-transaction /> </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/websphere_example/#{ejbName}
- </literal>
- </para>
- </listitem>
- <listitem>
- <para>
- We do not need
- <literal>managed-persistence-context
- </literal>
- for this example and so can delete its
- entry.
- </para>
-
-
- <programlisting role="XML"><![CDATA[
-<persistence:managed-persistence-context name="entityManager"
- auto-create="true"
- persistence-unit-jndi-name="java:/websphere_exampleEntityManagerFactory"/> ]]></programlisting>
- </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 replacing /local string in
- <literal>ejb-ref-name</literal>
- to flag them for
- Websphere to perform the proper binding.
- </para>
-
-
- <programlisting role="XML"><![CDATA[
- <ejb-local-ref>
- <ejb-ref-name>websphere_example/AuthenticatorAction</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <local>org.jboss.seam.tutorial.websphere.action.Authenticator</local>
- </ejb-local-ref>
-
- <ejb-local-ref>
- <ejb-ref-name>websphere_example/EjbSynchronizations</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <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>
- <para>Change the generated Authenticator class</para>
- <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"><![CDATA[
- at Name("authenticator") @Stateless public class
- AuthenticatorAction implements Authenticator {]]></programlisting>
-
-
- <programlisting role="JAVA"><![CDATA[
- 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"><![CDATA[
-<project name="websphere_example" default="archive" basedir=".">]]></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>websphere_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> <target name="war"
- depends="compile" description="Build the distribution
- .war file"> </literal>
- target.
- </para>
-
- <programlisting role="XML"><![CDATA[
-<copy todir="${war.dir}">
- <fileset dir="${basedir}/resources" >
- <include name="*.drl" />
- </fileset>
-</copy>]]></programlisting>
- </listitem>
- <listitem>
- <para>
- Now we need to get extra jars into the
- <literal>build.xml</literal>
- . Look for the
- <literal><fileset dir="${basedir}"></literal>
- section
- of the task below. Add the new includes at the bottom of
- the fileset.
- </para>
-
-
- <programlisting role="XML"><![CDATA[
-<target name="ear" description="Build the EAR">
- <copy todir="${ear.dir}">
- <fileset dir="${basedir}/resources">
- <include name="*jpdl.xml" />
- <include name="*hibernate.cfg.xml" />
- <include name="jbpm.cfg.xml" />
- </fileset>
-
- <fileset dir="${basedir}">
- <include name="lib/jbpm*.jar" />
- <include name="lib/jboss-el.jar" />
- <include name="lib/drools-*.jar"/>
- <include name="lib/core.jar"/>
- <include name="lib/janino*.jar"/>
- <include name="lib/antlr-*.jar"/>
- <include name="lib/mvel*.jar"/>
- <include name="lib/richfaces-api*.jar" />
- </fileset>
- </copy>
- <copy todir="${ear.dir}/META-INF">
- <fileset dir="${basedir}/resources/META-INF">
- <include name="application.xml" />
- <include name="jboss-app.xml" />
- </fileset>
- </copy>
-</target>]]></programlisting>
- <itemizedlist>
- <listitem>
- <para>Hibernate dependencies</para>
- <programlisting role="XML"><![CDATA[
- <!-- Hibernate and deps -->
- <include name="lib/hibernate.jar"/>
- <include name="lib/hibernate-commons-annotations.jar"/>
- <include name="lib/hibernate-annotations.jar"/>
- <include name="lib/hibernate-entitymanager.jar"/>
- <include name="lib/hibernate-validator.jar"/>
- <include name="lib/jboss-common-core.jar" />]]></programlisting>
- </listitem>
- <listitem>
- <para> Third party dependencies.</para>
- <programlisting role="XML"><![CDATA[
- <!-- 3rd party and supporting jars -->
- <!--<include name="lib/log4j.jar" />-->
- <include name="lib/javassist.jar"/>
- <include name="lib/dom4j.jar" />
- <include name="lib/concurrent.jar" />
- <include name="lib/cglib.jar"/>
- <include name="lib/asm.jar"/>
- <include name="lib/antlr.jar" />
- <include name="lib/commons-logging.jar" />
- <include name="lib/commons-collections.jar" />]]></programlisting>
- </listitem>
- <listitem>
- <para>
- <literal>jboss-seam.jar</literal>
- - this is needed in
- the
- <literal>ear</literal>
- base
- directory.
- </para>
- <programlisting role="XML"><![CDATA[
- <!-- seam jar -->
- <include name="lib/jboss-seam.jar" />]]></programlisting>
- </listitem>
- </itemizedlist>
-
- <para>You should end up with something like:</para>
- <programlisting role="XML"><![CDATA[<fileset dir="${basedir}">
-
- <include name="lib/jbpm*.jar" />
- <include name="lib/jboss-el.jar" />
- <include name="lib/drools-*.jar"/>
- <include name="lib/core.jar"/>
- <include name="lib/janino*.jar"/>
- <include name="lib/antlr-*.jar"/>
- <include name="lib/mvel*.jar"/>
- <include name="lib/richfaces-api*.jar" />
-
- <!-- Hibernate and deps -->
- <include name="lib/hibernate.jar"/>
- <include name="lib/hibernate-commons-annotations.jar"/>
- <include name="lib/hibernate-annotations.jar"/>
- <include name="lib/hibernate-entitymanager.jar"/>
- <include name="lib/hibernate-validator.jar"/>
- <include name="lib/jboss-common-core.jar" />
-
- <!-- 3rd party and supporting jars -->
- <include name="lib/javassist.jar"/>
- <include name="lib/dom4j.jar" />
- <include name="lib/concurrent.jar" />
- <include name="lib/cglib.jar"/>
- <include name="lib/asm.jar"/>
- <include name="lib/antlr.jar" />
- <include name="lib/commons-logging.jar" />
- <include name="lib/commons-collections.jar" />
-
- <!-- seam jar -->
- <include name="lib/jboss-seam.jar" />
-
-</fileset>]]></programlisting>
-
- </listitem>
- </itemizedlist>
-
- </section>
- <section>
- <title> Building and deploying the seam-gen'd application to
- Websphere
- </title>
-
- <itemizedlist>
- <listitem>
- <para>
- Build your application by calling
- <literal>ant</literal>
- in the base directory of your
- project (ex.
- <literal>/home/jbalunas/workspace/websphere_example
- </literal>
- ). The target of the build will be
- <literal>dist/websphere_example.ear
- </literal>
- .
- </para>
- </listitem>
-
- <listitem>
- <para>
- To deploy the application follow the instructions here :
- <xref linkend="jee5-websphere-deploy" />
- but use references to
- this project
- <literal>websphere_example</literal>
- instead of
- <literal>jboss-seam-jee5</literal>
- .
- </para>
- </listitem>
- <listitem>
- <para>
- Checkout the app at:
- <literal>http://localhost:9080/websphere_example/index.html
- </literal>
- </para>
- </listitem>
- </itemizedlist>
-
- </section>
- </section>
- </section>
-
</chapter>
More information about the seam-commits
mailing list