[seam-commits] Seam SVN: r8353 - branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Mon Jun 9 09:12:17 EDT 2008
Author: manaRH
Date: 2008-06-09 09:12:16 -0400 (Mon, 09 Jun 2008)
New Revision: 8353
Removed:
branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Gwt.xml
branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Oc4j.xml
branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Weblogic.xml
branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Websphere.xml
Modified:
branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Configuration.xml
branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Dependencies.xml
branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Groovy.xml
branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Mail.xml
branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Preface.xml
branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Spring.xml
branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/master.xml
Log:
removed unsupported documentation parts, added tech preview notes
Modified: branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Configuration.xml
===================================================================
--- branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Configuration.xml 2008-06-09 13:10:44 UTC (rev 8352)
+++ branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Configuration.xml 2008-06-09 13:12:16 UTC (rev 8353)
@@ -957,6 +957,11 @@
<ulink url="http://labs.jboss.com/portletbridge">http://labs.jboss.com/portletbridge</ulink>
for more.
</para>
+
+ <note>
+ <title>Technology preview </title>
+ <para>Seam Integration with JBoss Portlet Bridge is marked as technology preview, so standard support is not guaranteed.</para>
+ </note>
</sect1>
Modified: branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Dependencies.xml
===================================================================
--- branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Dependencies.xml 2008-06-09 13:10:44 UTC (rev 8352)
+++ branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Dependencies.xml 2008-06-09 13:12:16 UTC (rev 8353)
@@ -694,6 +694,11 @@
These libraries are required if you with to use the Google Web Toolkit (GWT) with your Seam application.
</para>
+ <note>
+ <title>Technology preview </title>
+ <para>GWT in Seam is marked as technology preview, so standard support is not guaranteed.</para>
+ </note>
+
<table>
<title>GWT dependencies</title>
@@ -749,6 +754,11 @@
These libraries are required if you with to use the Spring Framework with your Seam application.
</para>
+ <note>
+ <title>Technology preview </title>
+ <para>Spring integration in Seam is marked as technology preview, so standard support is not guaranteed.</para>
+ </note>
+
<table>
<title>Spring Framework dependencies</title>
@@ -804,6 +814,11 @@
These libraries are required if you with to use Groovy with your Seam application.
</para>
+ <note>
+ <title>Technology preview </title>
+ <para>Groovy integration in Seam is marked as technology preview, so standard support is not guaranteed.</para>
+ </note>
+
<table>
<title>Groovy dependencies</title>
Modified: branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Groovy.xml
===================================================================
--- branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Groovy.xml 2008-06-09 13:10:44 UTC (rev 8352)
+++ branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Groovy.xml 2008-06-09 13:12:16 UTC (rev 8353)
@@ -16,6 +16,11 @@
and dynamic languages. JBoss Seam lets the application developer use the best tool for the task, without context
switching. Writing dynamic Seam components is exactly like writing regular Seam components. You use the same
annotations, the same APIs, the same everything.</para>
+
+ <note>
+ <title>Technology preview </title>
+ <para>Groovy integration in Seam is marked as technology preview, so standard support is not guaranteed.</para>
+ </note>
<section>
<title id="groovy-intro">Groovy introduction</title>
Deleted: branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Gwt.xml
===================================================================
--- branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Gwt.xml 2008-06-09 13:10:44 UTC (rev 8352)
+++ branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Gwt.xml 2008-06-09 13:12:16 UTC (rev 8353)
@@ -1,231 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
-
-<chapter id="gwt">
- <title>Seam and the Google Web Toolkit</title>
-
- <para>
- For those that prefer to use the Google Web Toolkit (GWT) to develop dynamic AJAX applications, Seam provides
- an integration layer that allows GWT widgets to interact directly with Seam components.
- </para>
-
- <para>
- To use GWT, we assume that you are already familiar with the GWT tools - more information can be found at
- <ulink url="http://code.google.com/webtoolkit/">http://code.google.com/webtoolkit/</ulink>. This chapter
- does not attempt to explain how GWT works or how to use it.
- </para>
-
- <section>
- <title>Configuration</title>
-
- <para>
- There is no special configuration required to use GWT in a Seam application, however the Seam resource servlet
- must be installed. See <xref linkend="configuration"/> for details.
- </para>
-
- </section>
-
- <section>
- <title>Preparing your component</title>
-
- <para>
- The first step in preparing a Seam component to be called via GWT, is to create both synchronous and
- asynchronous service interfaces for the methods you wish to call. Both of these interfaces should extend the
- GWT interface <literal>com.google.gwt.user.client.rpc.RemoteService</literal>:
- </para>
-
- <programlisting role="JAVA"><![CDATA[public interface MyService extends RemoteService {
- public String askIt(String question);
- }]]></programlisting>
-
- <para>
- The asynchronous interface should be identical, except that it also contains an additional
- <literal>AsyncCallback</literal> parameter for each of the methods it declares:
- </para>
-
- <programlisting role="JAVA"><![CDATA[public interface MyServiceAsync extends RemoteService {
- public void askIt(String question, AsyncCallback callback);
-}]]></programlisting>
-
- <para>
- The asynchronous interface, in this example <literal>MyServiceAsync</literal>, will be implemented by GWT and
- should never be implemented directly.
- </para>
-
- <para>
- The next step, is to create a Seam component that implements the synchronous interface:
- </para>
-
- <programlisting role="JAVA"><![CDATA[@Name("org.jboss.seam.example.remoting.gwt.client.MyService")
-public class ServiceImpl implements MyService {
-
- @WebRemote
- public String askIt(String question) {
-
- if (!validate(question)) {
- throw new IllegalStateException("Hey, this shouldn't happen, I checked on the client, " +
- "but its always good to double check.");
- }
- return "42. Its the real question that you seek now.";
- }
-
- public boolean validate(String q) {
- ValidationUtility util = new ValidationUtility();
- return util.isValid(q);
- }
-}]]></programlisting>
-
- <para>
- The methods that should be made accessible via GWT need to be annotated with the
- <literal>@WebRemote</literal> annotation, which is required for all web-remoteable methods.
- </para>
- </section>
-
- <section>
- <title>Hooking up a GWT widget to the Seam component</title>
-
- <para>
- The next step, is to write a method that returns the asynchronous interface to the component. This method
- can be located inside the widget class, and will be used by the widget to obtain a reference to the
- asynchronous client stub:
- </para>
-
- <programlisting role="JAVA"><![CDATA[private MyServiceAsync getService() {
- String endpointURL = GWT.getModuleBaseURL() + "seam/resource/gwt";
-
- MyServiceAsync svc = (MyServiceAsync) GWT.create(MyService.class);
- ((ServiceDefTarget) svc).setServiceEntryPoint(endpointURL);
- return svc;
-}]]></programlisting>
-
- <para>
- The final step is to write the widget code that invokes the method on the client stub. The following example
- creates a simple user interface with a label, text input and a button:
- </para>
-
- <programlisting role="JAVA"><![CDATA[
-public class AskQuestionWidget extends Composite {
- private AbsolutePanel panel = new AbsolutePanel();
-
- public AskQuestionWidget() {
- Label lbl = new Label("OK, what do you want to know?");
- panel.add(lbl);
- final TextBox box = new TextBox();
- box.setText("What is the meaning of life?");
- panel.add(box);
- Button ok = new Button("Ask");
- ok.addClickListener(new ClickListener() {
- public void onClick(Widget w) {
- ValidationUtility valid = new ValidationUtility();
- if (!valid.isValid(box.getText())) {
- Window.alert("A question has to end with a '?'");
- } else {
- askServer(box.getText());
- }
- }
- });
- panel.add(ok);
-
- initWidget(panel);
- }
-
- private void askServer(String text) {
- getService().askIt(text, new AsyncCallback() {
- public void onFailure(Throwable t) {
- Window.alert(t.getMessage());
- }
-
- public void onSuccess(Object data) {
- Window.alert((String) data);
- }
- });
- }
-
- ...]]></programlisting>
-
-
- <para>
- When clicked, the button invokes the <literal>askServer()</literal> method passing the contents of the input text (in this
- example, validation is also performed to ensure that the input is a valid question). The <literal>askServer()</literal>
- method acquires a reference to the asynchronous client stub (returned by the <literal>getService()</literal> method)
- and invokes the <literal>askIt()</literal> method. The result (or error message if the call fails) is shown in an alert window.
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/gwt-helloworld.png" align="center" scalefit="1"/>
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/gwt-helloworld.png" align="center"/>
- </imageobject>
- </mediaobject>
-
-
- <para>
- The complete code for this example can be found in the Seam distribution in the <literal>examples/remoting/gwt</literal>
- directory.
- </para>
- </section>
-
- <section>
- <title>GWT Ant Targets</title>
-
- <para>
- For deployment of GWT apps, there is a compile-to-Javascript step (which compacts and obfuscates the code). There is an
- ant utility which can be used instead of the command line or GUI utility that GWT provides. To use this, you will need
- to have the ant task jar in your ant classpath, as well as GWT downloaded (which you will need for hosted mode anyway).
- </para>
-
- <para>
- Then, in your ant file, place (near the top of your ant file):
- </para>
-
- <programlisting role="XML"><![CDATA[<taskdef uri="antlib:de.samaflost.gwttasks"
- resource="de/samaflost/gwttasks/antlib.xml"
- classpath="./lib/gwttasks.jar"/>
-
- <property file="build.properties"/>]]></programlisting>
-
- <para>
- Create a <literal>build.properties</literal> file, which has the contents:
- </para>
-
- <programlisting><![CDATA[gwt.home=/gwt_home_dir]]></programlisting>
-
- <para>
- This of course should point to the directory where GWT is installed. Then to use it, create a target:
- </para>
-
- <programlisting role="XML"><![CDATA[<!-- the following are are handy utilities for doing GWT development.
- To use GWT, you will of course need to download GWT seperately -->
- <target name="gwt-compile">
- <!-- in this case, we are "re homing" the gwt generated stuff, so in this case
- we can only have one GWT module - we are doing this deliberately to keep the URL short -->
- <delete>
- <fileset dir="view"/>
- </delete>
- <gwt:compile outDir="build/gwt"
- gwtHome="${gwt.home}"
- classBase="${gwt.module.name}"
- sourceclasspath="src"/>
- <copy todir="view">
- <fileset dir="build/gwt/${gwt.module.name}"/>
- </copy>
- </target>]]></programlisting>
-
- <para>
- This target when called will compile the GWT application, and copy it to the specified directory (which would be
- in the <literal>webapp</literal> part of your war - remember GWT generates HTML and Javascript artifacts). You
- never edit the resulting code that <literal>gwt-compile</literal> generates - you always edit in the GWT source
- directory.
- </para>
-
- <para>
- Remember that GWT comes with a hosted mode browser - you should be using that if you are developing with GWT. If you
- aren't using that, and are just compiling it each time, you aren't getting the most out of the toolkit (in fact, if
- you can't or won't use the hosted mode browser, I would go far as to say you should NOT be using GWT at all - it's
- that valuable!).
- </para>
-
- </section>
-</chapter>
Modified: branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Mail.xml
===================================================================
--- branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Mail.xml 2008-06-09 13:10:44 UTC (rev 8352)
+++ branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Mail.xml 2008-06-09 13:12:16 UTC (rev 8353)
@@ -334,6 +334,12 @@
version of JBoss AS you use already has this file, replace it.
</para>
+ <note>
+ <title>Technology preview </title>
+ <para>Distributed mail-ra.rar in Seam is marked as technology preview, so standard support is not guaranteed.</para>
+ </note>
+
+
<para>
You can configure it like this:
</para>
Deleted: branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Oc4j.xml
===================================================================
--- branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Oc4j.xml 2008-06-09 13:10:44 UTC (rev 8352)
+++ branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Oc4j.xml 2008-06-09 13:12:16 UTC (rev 8353)
@@ -1,1161 +0,0 @@
-<chapter id="oc4j">
- <title>Seam on OC4J</title>
-
- <para> OC4J (Oracle Containers for Java) 11g (currently a "Technology
- Preview" release) is Oracle's JEE5 application server. Seam application
- can be deployed to OC4J, but require some additional configuration
- changes, and dependencies. This chapter will show you exactly what must be
- done. We will start by looking at the building and deploying the JEE5 Hotel
- Booking example application which comes with Seam. Then we will deploy a
- project generated by <literal>seam-gen</literal> . First a basic
- <literal>seam-gen</literal> application with RichFaces ajax
- components, and facelets. Then expand that application to include Seam
- security with Drools, JPA provided with hibernate, and automatic CRUD
- reverse engineering of a MySQL database. </para>
-
- <section id="oc4j-install-operation">
- <title>Installation and operation of OC4J</title>
- <para> First we need to install the target container - OC4j. This chapter
- requires you to use OC4J 11g Technology Preview (not OC4J 10g). You can
- download OC4J 11g from <ulink
- url="http://www.oracle.com/technology/tech/java/oc4j/11/">
- http://www.oracle.com/technology/tech/java/oc4j/11/ </ulink>
- Below are instructions to install. launch, access, and shutdown the 11g
- release. For further information on installing OC4J, consult the
- <literal>readme.txt</literal> distributed with OC4J, or the OC4J
- installation guide and release notes.
- <orderedlist>
- <listitem>
- <para>Download and unzip OC4J</para>
- </listitem>
- <listitem>
- <para> Make sure you have <literal>$JAVA_HOME</literal> and
- <literal>$ORACLE_HOME</literal> set as environment
- variables ( <literal>$ORACLE_HOME</literal> is the
- directory to which you unzip OC4J). For further information
- on installing OC4J, consult the
- <literal>readme.txt</literal> distributed with OC4J
- </para>
- </listitem>
- <listitem>
- <para> Applications (ear/war) are deployed to the
- <literal>$ORACLE_HOME/j2ee/home/applications</literal>
- directory. </para>
- <para> Note that OC4J does not support hot deployment by default.
- This means every time you deploy the application you must
- restart the server. </para>
- </listitem>
- <listitem>
- <para> Start OC4J: <literal> $ORACLE_HOME/j2ee/home/java
- -jar -XX:MaxPermSize=256M oc4j.jar </literal> </para>
- <para> You must override the default PermGen memory settings
- using above command. See <ulink
- url="http://www.oracle.com/technology/tech/java/oc4j/11/oc4j-relnotes.html">
- OC4J release notes </ulink> for details. </para>
- <para> You will be asked to set the admin password if this is the
- first time you have started OC4J </para>
- </listitem>
- <listitem>
- <para> Once deployed you can check out your applications at
- <literal>http://localhost:8888/<your-app-path></literal>
- </para>
- </listitem>
- <listitem>
- <para> You can stop the server by pressing
- <literal>CTRL-C</literal> in the console on which the
- server is running. </para>
- </listitem>
- </orderedlist> </para>
- </section>
-
- <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 designed to
- run on Glassfish, but it's easy to build it for OC4J. It is located in the
- <literal>$SEAM_DIST/examples/jee5/booking</literal> directory.
- </para>
-
- <section>
- <title>Booking Example Dependencies</title>
-
- <para> First, lets look at the basic dependencies of the booking
- example. Armed with this knowledge we can look at the extra
- dependencies requirements that OC4J adds. </para>
-
- <para> We will show you how to get these dependencies into the
- application in <xref linkend="oc4j-build-jee5"/> below. </para>
- <section>
- <title>Core Seam dependencies</title>
- <itemizedlist>
- <listitem>
- <simpara><literal>jboss-seam.jar</literal> — We
- declare this as an EJB3 module (why? well Seam needs to be
- able to interact with container managed transactions;
- this is implemented as an EJB3 Stateful Session Bean)
- </simpara>
- </listitem>
- <listitem>
- <simpara> <literal>jboss-el.jar</literal> </simpara>
- </listitem>
- <listitem>
- <simpara><literal>jboss-seam-ui.jar</literal> —
- Seam's JSF controls depend on Apache's
- commons-beanutils</simpara>
- </listitem>
- <listitem>
- <simpara> <literal>jboss-seam-debug.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara> <literal>jsf-facelets.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara> <literal>richfaces-api.jar</literal> ,
- <literal>richfaces-impl.jar</literal> and
- <literal>richfaces-ui.jar</literal> — which
- requires Apache commons-digester and
- commons-beanutils </simpara>
- </listitem>
- </itemizedlist>
- </section>
-
- <section>
- <title>Extra dependencies</title>
- <itemizedlist>
- <listitem>
- <para> Hibernate — of course, we decided to use
- Hibernate as the JPA provider (rather than TopLink
- Essentials which ships with OC4J). </para>
- <para> To use Hibernate as your JPA provider you need the
- following jars:
- <itemizedlist>
- <listitem>
- <simpara> <literal>hibernate.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>hibernate-annotations.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>hibernate-entitymanager.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>hibernate-validator.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>jboss-common-core.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>commons-logging.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>commons-collections.jar</literal>
- </simpara>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- <listitem>
- <para> Third party jars — various jars needed for seam
- and this example to run.
- <itemizedlist>
- <listitem>
- <simpara> <literal>javaasist.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara> <literal>dom4j.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara> <literal>cglib.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara> <literal>asm.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>commons-beanutils.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>commons-digester.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara><literal>log4j.jar</literal>
- — This can be left out if you are not going
- to configure log4j. If it is packaged but not
- configured logging will be hidden in oc4j.
- </simpara>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- <listitem>
- <para> Extra OC4J jars — Running Seam on most
- application servers (such as JBoss AS or Glassfish) you
- only need to include the dependencies for those bits of
- Seam you actually use (e.g. if you use Seam Text you need to
- include ANTLR); but, on OC4J, due to its "interesting"
- classloading you must always include them:
- <itemizedlist>
- <listitem>
- <simpara>
- <literal>hibernate-search.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>hibernate-common-annotations.jar</literal>
- — needed for hibernate search
- </simpara>
- </listitem>
- <listitem>
- <simpara> <literal>lucene-core.jar</literal>
- — needed for hibernate search
- </simpara>
- </listitem>
- <listitem>
- <simpara> <literal>antlr.jar</literal>
- — needed for Seam Text </simpara>
- </listitem>
- <listitem>
- <simpara> <literal>jbpm-jpdl.jar</literal>
- — needed for Seam's JBPM </simpara>
- </listitem>
- <listitem>
- <simpara> <literal>quartz.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara> <literal>dbunit.jar</literal>
- — needed for some testing classes
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>jboss-embedded-api.jar</literal>
- — needed for some testing classes
- </simpara>
- </listitem>
- <listitem>
- <para> Drools — needed for Seam Security. We
- aren't using Seam security with Drools, but
- have to include it. Drools consists of 6 jars:
- <itemizedlist>
- <listitem>
- <simpara>
- <literal>drools-core.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>drools-compiler.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>janino.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>mvel141.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>core.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>antlr-runtime.jar</literal>
- </simpara>
- </listitem>
- </itemizedlist> Drools integration is not
- used in the example. </para>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- </itemizedlist>
- </section>
- </section>
-
- <section>
- <title>Configuration file changes</title>
-
- <para>There are just a few changes to be made:</para>
- <variablelist>
- <varlistentry>
- <term> <literal>web.xml</literal>
- </term>
- <listitem>
- <para> You need to declare all your ejb's in the
- <literal>web.xml</literal> . This is a silly
- requirement of a number of JEE5 application servers - for
- example OC4J and Glassfish. </para>
- <para> This is already done in the example's web.xml file,
- below is an example. </para>
-
-
- <programlisting role="XML"><![CDATA[<ejb-local-ref>
- <ejb-ref-name>
- jboss-seam-jee5/AuthenticatorAction/local
- </ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <local>
- org.jboss.seam.example.booking.Authenticator
- </local>
- <ejb-link>AuthenticatorAction</ejb-link>
-</ejb-local-ref>]]></programlisting>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term> <literal>persistence.xml</literal>
- </term>
- <listitem>
- <para> You need to provide the correct configuration for your
- JPA implementation. We are using Hibernate and due to OC4J
- bundling an old ANTLR, we need to use an alternative query
- factory, we also want to use the OC4J transaction manager:
- </para>
- <para> For our example modify the
- <literal>resources/META-INF/persistence.xml</literal>
- file. Comment out the Glassfish properties and
- un-comment the OC4J properties. </para>
-
-
- <programlisting role="XML"><![CDATA[<property name="hibernate.dialect"
- value="org.hibernate.dialect.HSQLDialect"/>
-<property name="hibernate.query.factory_class"
- value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>
-<property name="hibernate.transaction.manager_lookup_class"
- value="org.hibernate.transaction.OrionTransactionManagerLookup"/>]]></programlisting>
- </listitem>
- </varlistentry>
- </variablelist>
-
- </section>
-
- <section id="oc4j-build-jee5">
- <title> Building the <literal>jee5/booking</literal> example
- </title>
-
- <orderedlist>
- <listitem>
- <para> Modify the <literal>build.xml</literal> file in the
- example: </para>
- <itemizedlist>
- <listitem>
- <para> Un-comment the labeled OC4J-related library
- properties. This will include all the extra
- dependencies discussed above. </para>
- <para>It should look like the following:</para>
-
-
- <programlisting role="XML"><![CDATA[<!-- add libs for oc4j (eager classloading) -->
-<property name="jbpm.lib" value="true"/>
-<property name="drools.lib" value="true"/>
-<property name="quartz.lib" value="true" />
-<property name="search.lib" value="true" />
-<property name="dbunit.lib" value="true" />
-<property name="jboss-embedded-api.lib" value="true" />
- ]]></programlisting>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para> Build the demo app by running <literal>ant</literal> in
- the <literal>examples/jee5/booking</literal>
- directory. The build target is
- <literal>dist/jboss-seam-jee5.ear</literal> </para>
- </listitem>
- <listitem>
- <para> Copy <literal>dist/jboss-seam-jee5.ear</literal>
- following the instructions below. </para>
- </listitem>
- </orderedlist>
- </section>
- </section>
-
- <section id="oc4j-app-deploy">
- <title>Deploying the Seam application to OC4J</title>
- <para> This mini-tutorial describes the (fairly tedious) steps required
- to deploy a JEE 5 application to OC4J. It assumes you have already
- downloaded and installed it following the instructions in <xref
- linkend="oc4j-install-operation"/>. It also assumes you are
- deploying the <literal>jee5/booking</literal> example, using the
- embedded hsqldb database. To deploy another application you would need
- to alter the datasource and application name. </para>
- <orderedlist>
- <listitem>
- <para> Copy <literal>hsqldb.jar</literal> to OC4J shared library
- directory: <literal> cp ../../seam-gen/lib/hsqldb.jar
- $ORACLE_HOME/j2ee/home/applib/ </literal> (OC4J doesn't
- come with an embedded database so we decided to use HSQLDB)
- </para>
- </listitem>
- <listitem>
- <para> Edit the OC4J datasource file
- <literal>$ORACLE_HOME/j2ee/home/config/data-sources.xml</literal>
- and, inside <literal><data-sources></literal> , add
- </para>
-
-
- <programlisting role="XML"><![CDATA[<managed-data-source
- connection-pool-name="jee5-connection-pool"
- jndi-name="jdbc/__default"
- name="jee5-managed-data-source" />
-<connection-pool name="jee5-connection-pool">
- <connection-factory
- factory-class="org.hsqldb.jdbcDriver"
- user="sa"
- password=""
- url="jdbc:hsqldb:." />
-</connection-pool>]]></programlisting>
-
- <para> The <literal>jndi-name</literal> is used as the
- <literal>jta-data-source</literal> in
- <literal>persistence.xml</literal> . </para>
- </listitem>
- <listitem>
- <para> Edit
- <literal>$ORACLE_HOME/j2ee/home/config/server.xml</literal>
- and, inside <literal><application-server></literal>
- , add </para>
-
-
- <programlisting role="XML"><![CDATA[<application name="jboss-seam-jee5"
- path="../../home/applications/jboss-seam-jee5.ear"
- parent="default"
- start="true" />]]></programlisting>
- <para> To keep things simple use the same names as you used for
- project. </para>
- </listitem>
- <listitem>
- <para> Edit <literal>
- $ORACLE_HOME/j2ee/home/config/default-web-site.xml
- </literal> , and, inside
- <literal><web-site></literal> , add </para>
-
-
- <programlisting role="XML"><![CDATA[<web-app application="jboss-seam-jee5"
- name="jboss-seam-jee5"
- load-on-startup="true"
- root="/seam-jee5" />]]></programlisting>
- <para> The <literal>root</literal> is the context path you will put
- into your web browser to access the application. </para>
- </listitem>
- <listitem>
- <para> Copy the application to OC4J: <literal> cp
- dist/jboss-seam-jee5.ear
- $ORACLE_HOME/j2ee/home/applications/ </literal> </para>
- </listitem>
- <listitem>
- <para> Start/stop OC4J following instructions in <xref
- linkend="oc4j-install-operation"/> above. </para>
- </listitem>
- <listitem>
- <para> Checkout the app at:
- <literal>http://localhost:8888/seam-jee5</literal>
- </para>
- </listitem>
- </orderedlist>
- </section>
-
- <section>
- <title> Deploying an application created using
- <literal>seam-gen</literal> to OC4J </title>
-
- <para> <literal>seam-gen</literal> is a great tool for developers that
- can quickly get you up and running with a full Seam application. However
- the project that it created is configured to run on JBoss AS. This means
- there are some extra steps needed to have it execute on OC4j. The
- following explanation assumes you are using the command line and a
- simple text editor, but of course you can use your favorite IDE.
- <literal>seam-gen</literal> projects come with support for Eclipse
- and Netbeans. </para>
-
- <para> We will start by creating and deploying a pretty simple application
- using <literal>seam-gen</literal> . Then we'll show you how easy it is
- to use <literal>seam-gen</literal> and Hibernate Tools to reverse
- engineer a database schema into a functional CRUD application.
- <literal>seam-gen</literal> will create JPA entity beans, Seam
- Application Framework components and JSF views for you. We will also add
- Seam security using Drools. </para>
-
- <para> This tutorial uses MySQL (but of course you could use any database,
- altering the SQL and datasources as appropriate); install, configure
- and run MySQL, then create a database with some sample data. Don't forget
- to also download the
- <literal>mysql-connector-java-X.jar</literal> for jdbc support.
- When setting up Seam security this tutorial will assume there is a table
- named <literal>User</literal> with columns
- <literal>username</literal> and <literal>password</literal> with
- at least one entry. Beyond that you can set up any type of sample data and
- tables you would like. </para>
-
- <section>
- <title> Generating a basic <literal>seam-gen</literal> application
- </title>
- <para> First we need to tell the <literal>seam-gen</literal> what we
- want, run <literal>./seam setup</literal> in the seam
- distribution directory. Follow the settings example below based on
- your system and setup (ex. use your database name instead of
- <literal>oc4jexample</literal> ). </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.2.GA]
-[C:/Program Files/jboss-4.2.2.GA]
-/home/jbalunas/jboss/jboss-4.2.2.GA
- [input] Enter the project name [myproject] [myproject]
-oc4j_example
- [echo] Accepted project name as: oc4j_example
- [input] Select a RichFaces skin (not applicable if using ICEFaces) [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 [com.mydomain.
-oc4j_example] [com.mydomain.oc4j_example]
-org.jboss.seam.tutorial.oc4j.action
- [input] Enter the Java package name for your entity beans [org.jboss.seam.
-tutorial.oc4j.action] [org.jboss.seam.tutorial.oc4j.action]
-org.jboss.seam.tutorial.oc4j.model
- [input] Enter the Java package name for your test cases [org.jboss.seam.
-tutorial.oc4j.action.test] [org.jboss.seam.tutorial.oc4j.action.test]
-org.jboss.seam.tutorial.oc4j.test
- [input] What kind of database are you using? [hsql] ([hsql], mysql, oracle,
- postgres, mssql, db2, sybase, enterprisedb, h2)
-mysql
- [input] Enter the Hibernate dialect for your database [org.hibernate.
-dialect.MySQLDialect] [org.hibernate.dialect.MySQLDialect]
-
- [input] Enter the filesystem path to the JDBC driver jar [lib/hsqldb.jar]
-[lib/hsqldb.jar]
-lib/mysql-connector.jar
- [input] Enter JDBC driver class for your database [com.mysql.jdbc.Driver]
-[com.mysql.jdbc.Driver]
-
- [input] Enter the JDBC URL for your database [jdbc:mysql:///test]
-[jdbc:mysql:///test]
-jdbc:mysql:///oc4jexample
- [input] Enter database username [sa] [sa]
-username
- [input] Enter database password [] []
-password
- [input] skipping input as property hibernate.default_schema.new has already
-been set.
- [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], )
-y
- [input] Do you want to drop and recreate the database tables and data in
-import.sql each time you deploy? [n] (y, [n], )
-n
- [input] Enter your ICEfaces home directory (leave blank to omit ICEfaces) [] []
-
-[propertyfile] Creating new property file:
-/home/jbalunas/workspace/jboss-seam/seam-gen/build.properties
- [echo] Installing JDBC driver jar to JBoss server
- [copy] Copying 1 file to /home/jbalunas/jboss/jboss-4.2.2.GA/server/default/lib
- [echo] Type 'seam create-project' to create the new project
-
-BUILD SUCCESSFUL]]></programlisting>
-
- <para> Type <literal>./seam new-project</literal> to create your
- project and <literal>cd
- /home/jbalunas/workspace/oc4j_example</literal> to the newly
- created project. </para>
-
- </section>
- <section>
- <title>Changes needed for deployment to OC4J</title>
- <para>We now need to make some changes to the generated project.</para>
- <section>
- <title>Configuration file changes</title>
- <para>Let's start with the configuration files:</para>
- <variablelist>
- <varlistentry>
- <term> <literal>build.xml</literal>
- </term>
- <listitem>
- <itemizedlist>
- <listitem>
- <para>Change the default target to archive (we
- aren't going to cover automatic deployment to
- OC4J).
- </para>
- <programlisting role="XML"><![CDATA[<project name="oc4j_example" default="archive" basedir=".">]]></programlisting>
- </listitem>
- <listitem>
- <para>OC4J looks for the drools file
- <literal>/security.drl</literal> file in
- the root of the <literal>war</literal> file
- instead of the root of the
- <literal>ear</literal> file 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>
- </itemizedlist>
- </listitem>
- </varlistentry>
- <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/__oc4jexample</literal>
- (and use this as the
- <literal>jndi-name</literal> when creating
- the data source in
- <literal>data-sources.xml</literal> later
- during deployment). </para>
- </listitem>
- <listitem>
- <para> Add the properties (described in
- <literal>jee5/booking</literal> example):
- </para>
-
-
- <programlisting role="XML"><![CDATA[<property name="hibernate.query.factory_class"
- value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory" />
-<property name="hibernate.transaction.manager_lookup_class"
- value="org.hibernate.transaction.OrionTransactionManagerLookup" />
-<property name="hibernate.transaction.flush_before_completion"
- value="true"/>
-<property name="hibernate.cache.provider_class"
- value="org.hibernate.cache.HashtableCacheProvider"/>]]></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:/oc4j_exampleEntityManagerFactory">]]></programlisting>
- </listitem>
- <listitem>
- <para> You'll need to alter
- <literal>persistence-prod.xml</literal>
- as well if you want to deploy to OC4J using the
- prod profile. </para>
- </listitem>
- </itemizedlist>
- </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,
- in OC4J you have to edit the master
- <literal>data-sources.xml</literal> file)
- </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/oc4j_example/#{ejbName}/local
- </literal> </para>
- </listitem>
- <listitem>
- <para> We want to use a Seam Managed Persistence
- Context in our application. Unfortunately
- OC4J doesn't expose the EntityManagerFactory
- in JNDI, but Seam provides a built-in manager
- component. To activate add the following
- entry: </para>
-
-
- <programlisting role="XML"><![CDATA[<persistence:entity-manager-factory
- auto-create="true"
- name="oc4jEntityManagerFactory"
- persistence-unit-name="oc4j_example" />]]></programlisting>
- <para> We then need to tell Seam to use it, so we alter
- the
- <literal>managed-persistence-context</literal>
- injecting the Entity Manager Factory into the
- existing element: </para>
-
-
- <programlisting role="XML"><![CDATA[<persistence:managed-persistence-context
- name="entityManager"
- auto-create="true"
- entity-manager-factory="#{oc4jEntityManagerFactory}" />]]>
- </programlisting>
- </listitem>
- </itemizedlist>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term> <literal>resources/WEB-INF/web.xml</literal>
- </term>
- <listitem>
- <para> You must add the Seam container managed
- transaction integration EJB entry below. Remember
- for OC4j you need to declare all your EJBs here if you
- modify the application further. </para>
-
-
- <programlisting role="XML"><![CDATA[<ejb-local-ref>
- <ejb-ref-name>
- oc4j_example/EjbSynchronizations/local
- </ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <local>
- org.jboss.seam.transaction.LocalEjbSynchronizations
- </local>
- <ejb-link>EjbSynchronizations</ejb-link>
-</ejb-local-ref>]]></programlisting>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <literal>resources/META-INF/orion-application.xml</literal>
- </term>
- <listitem>
- <itemizedlist>
- <listitem>
- <para> This is a file that you must create so that
- RichFaces and Ajax4Jsf stylesheets will work
- with OC4J. This file basically tells OC4J not
- force its own inherited URL settings. </para>
-
-
- <programlisting role="XML"><![CDATA[<?xml version = '1.0' encoding = 'utf-8'?>
-<orion-application
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/
- orion-application-10_0.xsd"
- schema-major-version="10"
- schema-minor-version="0"
- component-classification="internal">
-
- <imported-shared-libraries>
- <remove-inherited name="oracle.xml"/>
- </imported-shared-libraries>
-</orion-application>]]></programlisting>
- </listitem>
- <listitem>
- <para> Now you need to tell the
- <literal>build.xml</literal> file that it
- needs to copy this file to the
- <literal>ear</literal> archive. Find the
- <literal> <target name="ear"
- description="Build the EAR"> </literal>
- target and modify the <literal>
- <copy todir="${ear.dir}/META-INF">
- </literal> section to look like the following:
- </para>
-
-
- <programlisting role="XML"><![CDATA[<copy todir="${ear.dir}/META-INF">
- <fileset dir="${basedir}/resources/META-INF">
- <include name="application.xml" />
- <include name="orion-application.xml"/>
- <include name="jboss-app.xml" />
- </fileset>
- </copy>]]></programlisting>
- </listitem>
- </itemizedlist>
- </listitem>
- </varlistentry>
- </variablelist>
- </section>
- <section>
- <title>Extra jar dependencies</title>
- <para> This application has similar requirements as the
- <literal>jee5/booking</literal> example above. </para>
- <para> The <literal>build.xml</literal> must be modified to add
- the jars listed below to the generated archive files. Look for the
- <literal><fileset dir="${basedir}"></literal>
- section below and add the imports underneath the other libraries
- being imported. </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" />
- <include name="*.drl" />
- </fileset>
- <fileset dir="${lib.dir}">
- <include name="jboss-seam.jar" />
- </fileset>
- <fileset dir="${basedir}">
- <include name="lib/jbpm*.jar" />
- <include name="lib/jboss-el.jar" />
- <include name="lib/drools-*.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:</para>
-
-
- <programlisting role="XML"><![CDATA[<include name="lib/hibernate.jar"/>
-<include name="lib/hibernate-annotations.jar"/>
-<include name="lib/hibernate-commons-annotations.jar"/>
-<include name="lib/hibernate-entitymanager.jar"/>
-<include name="lib/hibernate-search.jar"/>
-<include name="lib/hibernate-validator.jar"/>
-<include name="lib/commons-logging.jar"/>
-<include name="lib/commons-collections.jar"/>
-<include name="lib/jboss-common-core.jar"/>]]></programlisting>
- </listitem>
- <listitem>
- <para> Drools — because we are using Drools to provide
- Seam Security rules, we need to add in Eclipse JDT compiler
- (you don't need this on JBoss AS; again this is due to OC4J's
- classloading): </para>
-
-
- <programlisting role="XML"><![CDATA[<include name="lib/core.jar"/>]]></programlisting>
- </listitem>
- <listitem>
- <para> Third party jars — most of these are only needed
- because of OC4J's classloading: </para>
-
-
- <programlisting role="XML"><![CDATA[<include name="lib/javassist.jar"/>
-<include name="lib/quartz.jar"/>
-<include name="lib/dbunit.jar"/>
-<include name="lib/jboss-embedded-api.jar"/>
-<include name="lib/dom4j.jar"/>
-<include name="lib/lucene-core.jar"/>
-<include name="lib/cglib.jar"/>
-<include name="lib/asm.jar"/>
-<include name="lib/commons-beanutils.jar"/>
-<include name="lib/commons-digester.jar"/>
-<include name="lib/antlr.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/janino*.jar"/>
- <include name="lib/antlr-*.jar"/>
- <include name="lib/mvel*.jar"/>
- <include name="lib/richfaces-api*.jar" />
- <include name="lib/hibernate.jar"/>
- <include name="lib/hibernate-annotations.jar"/>
- <include name="lib/hibernate-commons-annotations.jar"/>
- <include name="lib/hibernate-entitymanager.jar"/>
- <include name="lib/hibernate-search.jar"/>
- <include name="lib/hibernate-validator.jar"/>
- <include name="lib/commons-logging.jar"/>
- <include name="lib/commons-collections.jar"/>
- <include name="lib/jboss-common-core.jar"/>
- <include name="lib/core.jar"/>
- <include name="lib/javassist.jar"/>
- <include name="lib/quartz.jar"/>
- <include name="lib/dbunit.jar"/>
- <include name="lib/jboss-embedded-api.jar"/>
- <include name="lib/dom4j.jar"/>
- <include name="lib/lucene-core.jar"/>
- <include name="lib/cglib.jar"/>
- <include name="lib/asm.jar"/>
- <include name="lib/commons-beanutils.jar"/>
- <include name="lib/commons-digester.jar"/>
- <include name="lib/antlr.jar"/>
-</fileset>]]></programlisting>
- </section>
-
- </section>
- <section>
- <title> Building and deploying the seam-gen'd application to OC4J
- </title>
- <para> These instructions are very similar to the ones in <xref
- linkend="oc4j-app-deploy"/> but with the correct references
- for the <literal>oc4j_example</literal> application. </para>
-
- <itemizedlist>
- <listitem>
- <para> Build your application by calling
- <literal>ant</literal> in the base directory of your
- project (ex.
- <literal>/home/jbalunas/workspace/oc4j_example</literal>
- ). The target of the build will be
- <literal>dist/oc4j_example.ear</literal> . </para>
- </listitem>
- <listitem>
- <para> Copy the <literal>mysql-connector.jar</literal> file
- to the
- <literal>$ORACLE_HOME/j2ee/home/applib</literal>
- directory so that jdbc drivers are available. </para>
- </listitem>
-
- <listitem>
- <para> <literal>
- $ORACLE_HOME/j2ee/home/config/data-sources.xml
- </literal> </para>
-
-
- <programlisting role="XML"><![CDATA[<managed-data-source
- connection-pool-name="oc4j-example-connection-pool"
- jndi-name="jdbc/__oc4jexample"
- name="oc4j-example-managed-data-source" />
-<connection-pool
- name="oc4j-example-connection-pool">
- <connection-factory
- factory-class="com.mysql.jdbc.Driver"
- user="username"
- password="password"
- url="jdbc:mysql:///oc4j" />
-</connection-pool>]]></programlisting>
- </listitem>
- <listitem>
- <para>
- <literal>$ORACLE_HOME/j2ee/home/config/server.xml</literal>
- </para>
-
-
- <programlisting role="XML"><![CDATA[<application name="oc4j_example"
- path="../../home/applications/oc4j_example.ear"
- parent="default"
- start="true" />]]></programlisting>
- </listitem>
- <listitem>
- <para> <literal>
- $ORACLE_HOME/j2ee/home/config/default-web-site.xml
- </literal> </para>
-
-
- <programlisting role="XML"><![CDATA[<web-app application="oc4j_example"
- name="oc4j_example"
- load-on-startup="true"
- root="/oc4j_example" />]]></programlisting>
- </listitem>
-
- <listitem>
- <para> Start/stop OC4J following instructions in the
- <literal>Installation and operation of OC4J</literal>
- section above. </para>
- </listitem>
- <listitem>
- <para> Checkout the app at:
- <literal>http://localhost:8888/oc4j_example</literal>
- </para>
- </listitem>
- </itemizedlist>
-
- </section>
-
- <section>
- <title> Extending example with reverse engineered CRUD and Drools
- </title>
- <para> In this section we extend the basic
- <literal>seam-gen</literal> application into a full blown CRUD
- application based on an existing database. Plus we will add
- <literal>Drools</literal> based security as well. </para>
- <section>
- <title> Have <literal>seam-gen</literal> generate your CRUD
- applications </title>
- <para> Type <literal>./seam generate-entities</literal> in the
- base directory of your seam distribution. This will create the
- entities, the Seam Application Framework classes and the
- relevant views for the CRUD application. </para>
-
- <para> That's it...no really...that's it. Build and deploy as
- before and see for yourself. </para>
-
- </section>
- <section>
- <title> Hook up drools authentication using your new CRUD
- application </title>
- <para> As stated above this section assumes your database had a
- <literal>User</literal> table with
- <literal>username</literal> and
- <literal>password</literal> columns with at least one entry.
- If you don't have this you may need to modify the
- <literal>authenticate</literal> method below. </para>
- <para> Lets link our <literal>User</literal> entity into Seam
- Security by making our authenticator class a Stateless Session
- Bean (OC4J is a EJB3 container after all!): </para>
-
- <orderedlist>
- <listitem>
- <itemizedlist>
- <listitem>
- <para> Add the <literal>@Stateless</literal>
- annotation to the
- <literal>Authenticator</literal> class.
- </para>
- </listitem>
- <listitem>
- <para> Rename the class to
- <literal>AuthenticatorAction</literal>
- </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[@Name("authenticator") @Stateless public class
- AuthenticatorAction implements Authenticator {]]></programlisting>
-
-
- <programlisting role="JAVA"><![CDATA[@Local public interface Authenticator {
- public boolean authenticate();
-}]]></programlisting>
- </listitem>
- <listitem>
- <para> Use <literal>@PersistenceContext</literal> to
- inject an EntityManager by adding this line the
- <literal>AuthenticatorAction</literal> class:
- </para>
-
-
- <programlisting role="JAVA"><![CDATA[@PersistenceContext private EntityManager entityManager;]]></programlisting>
- </listitem>
- <listitem>
- <para>Implement authenticate:</para>
-
-
- <programlisting role="JAVA"><![CDATA[public boolean authenticate() {
- List <User> users = entityManager .createQuery("select u from User u where
- u.username = #{identity.username} and
- u.password = #{identity.password}") .getResultList();
- if (users.size() == 1) {
- identity.addRole("admin");
- return true;
- } else {
- return false;
- }
-}]]></programlisting>
- </listitem>
- <listitem>
- <para> And then add the EJB3 reference to
- <literal>web.xml</literal> : </para>
-
-
- <programlisting role="XML"><![CDATA[<ejb-local-ref>
- <ejb-ref-name>
- oc4j_example/AuthenticatorAction/local
- </ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <local>
- org.jboss.seam.tutorial.oc4j.action.Authenticator
- </local>
- <ejb-link>AuthenticatorAction</ejb-link>
-</ejb-local-ref>]]></programlisting>
- </listitem>
- </orderedlist>
-
- <para> Build and deploy as before and notice that now only actual
- username and passwords are accepted. </para>
- </section>
-
- </section>
-
- </section>
- <section>
- <title>Finishing up</title>
- <para> That's it, we're through. You now have a great starting point for any
- Seam based application deployed to OC4J. </para>
- </section>
-</chapter>
\ No newline at end of file
Modified: branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Preface.xml
===================================================================
--- branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Preface.xml 2008-06-09 13:10:44 UTC (rev 8352)
+++ branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Preface.xml 2008-06-09 13:12:16 UTC (rev 8353)
@@ -83,6 +83,12 @@
ICEfaces. These solutions let you add AJAX capability to your user interface without
the need to write any JavaScript code.
</para>
+
+ <note>
+ <title>Technology preview </title>
+ <para>Icefaces integration in Seam is marked as technology preview, so standard support is not guaranteed.</para>
+ </note>
+
<para>
Alternatively, Seam provides a built-in JavaScript remoting layer that lets you call
components asynchronously from client-side JavaScript without the need for an intermediate
Modified: branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Spring.xml
===================================================================
--- branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Spring.xml 2008-06-09 13:10:44 UTC (rev 8352)
+++ branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Spring.xml 2008-06-09 13:12:16 UTC (rev 8353)
@@ -5,7 +5,12 @@
<para>The Spring integration module allows easy migration of Spring-based projects to Seam and allows Spring
applications to take advantage of key Seam features like conversations and Seam's more sophisticated persistence
context management.</para>
-
+
+ <note>
+ <title>Technology preview </title>
+ <para>Spring integration in Seam is marked as technology preview, so standard support is not guaranteed.</para>
+ </note>
+
<para>Note! The Spring integration code is included in the jboss-seam-ioc library. This dependency is required for
all seam-spring integration techniques covered in this chapter.</para>
Deleted: branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Weblogic.xml
===================================================================
--- branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Weblogic.xml 2008-06-09 13:10:44 UTC (rev 8352)
+++ branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Weblogic.xml 2008-06-09 13:12:16 UTC (rev 8353)
@@ -1,1595 +0,0 @@
-<chapter id="weblogic">
- <title>Seam on BEA's Weblogic</title>
-
- <para> Weblogic 10.X is BEA's JEE5 server offering, currently 10.0.MP1 is
- their stable release, and 10.3.TP is their latest tech preview release.
- Seam applications can be deployed and developed on Weblogic servers, and
- this chapter will show you how. There are some known issues with the
- Weblogic servers that will need to be worked around, and configuration
- changes that are needed. </para>
-
- <para> First step is to get Weblogic downloaded, installed and running (no
- small feat). Then we'll talk about Seam's JEE5 example and the hurdles to
- getting it running. After that, the JPA example will
- be modified and deployed to the server. Then finally we will create a
- <literal>seam-gen</literal> application and get it up and running to
- provide a jump start to your own application. </para>
-
- <section>
- <title>Installation and operation of Weblogic</title>
- <para> First things first we need to get the server installed - and there
- is a choice to be made. Weblogic 10.0.MP1 is the most recent stable
- release, while 10.3.TP is a technical preview version that fixes some
- things and breaks others. </para>
- <itemizedlist>
- <listitem>
- <para><literal>Weblogic 10.0.MP1</literal>
- — <ulink
-url="http://commerce.bea.com/showproduct.jsp?family=WLS&major=10&minor=1">
- Download page </ulink></para>
- <para> 10.0.MP1 has a known issue with EJBs that use
- <literal>varargs</literal> in their methods (it confuses them
- as <literal>transient</literal> ). This causes exceptions
- when Weblogic attempts to compile the Seam EJBs. There is a BEA
- support patch available to fix this issue, but BEA is currently
- working on a second issue related to the EJBs. See the
- <literal>jee5/booking</literal> example for more details. </para>
- </listitem>
- <listitem>
- <para><literal>Weblogic 10.3.TP</literal>
- — <ulink
-url="http://commerce.bea.com/showproduct.jsp?family=WLS&major=10.3Tech&minor=-1&DL=www_WLS_10-3TechPreview_icon&WT.ac=DL_www_WLS_10.3_TechPreviewicon">
- Download page </ulink></para>
- <para> This version still has not fixed the
- <literal>varargs</literal> bug, and there is a new issue with
- EJBs that do not use <literal>kodo</literal> (BEA's
- implementation of JPA). BEA has said that the <literal>varargs
- </literal> issue will be resolved in the final version of 10.3,
- but the <literal>kodo</literal> issue is a blocker for getting
- the <literal>jee5/booking</literal> working.
- </para>
- </listitem>
- </itemizedlist>
-
- <note>
- <title>Special <literal>jboss-seam.jar</literal> for Weblogic EJB
- Support</title>
- <para> Starting with Seam 2.0.2.CR2 a special Weblogic specific jar has
- been created that does not contain the <literal>TimerServiceDispatcher
- </literal>. This is the EJB that uses <literal>varargs</literal> and
- exposes the second EJB issue. We will be using this jar for the
- <literal>jee5/booking</literal> example, as it avoids both known BEA
- issues.
- </para>
- </note>
-
- <section>
- <title>Installing 10.0.MP1</title>
-
- <para>
- Here are the quick steps to installing Weblogic 10.1.MP1.
- For more details or if you are having any issues please
- check with the BEA docs at the
- <ulink url="http://e-docs.bea.com/wls/docs100/index.html">
- Weblogic 10.0 Doc Center
- </ulink>
- . Here we install the RHEL 5 version using the graphical
- installer:
- </para>
-
- <orderedlist>
- <listitem>
- <para> Follow the link given above for 10.0.MP1 and download the
- correct version for your environment. You will need to sign up
- for an account with BEA in order to do this. </para>
- </listitem>
- <listitem>
- <para> You may need to change the the
- <literal>server1001_XX.bin</literal> file to be
- executable: </para>
- <programlisting>chmod a+x server1001_XX.bin</programlisting>
- </listitem>
- <listitem>
- <para> Execute the install: </para>
- <programlisting>./server1001_XX.bin</programlisting>
- </listitem>
- <listitem>
- <para> When the graphical install loads, you need to set the BEA
- home location. This is where all BEA applications are
- installed. This location will be known as
- <literal>$BEA_HOME</literal> in this document e.g.:
- </para>
- <programlisting>/jboss/apps/bea</programlisting>
- </listitem>
- <listitem>
- <para> Select <literal>Complete</literal> as the
- installation type. You do not need all the extras of the
- complete install (such as struts and beehive libraries), but
- it will not hurt. </para>
- </listitem>
- <listitem>
- <para> Then you need to tell it where to install the server
- components: </para>
- <programlisting>$BEA_HOME/wlserver_10.0</programlisting>
- </listitem>
- </orderedlist>
- </section>
- <section id="weblogic-domain">
- <title>Creating your Weblogic domain</title>
- <para> A Weblogic domain is similar to a JBoss server configuration - it
- is a self contained server instance. The Weblogic server you just
- installed has some example domains, but we are going to create one
- just for the seam examples. You can use the existing domains if you
- wish (modify the instructions as needed). </para>
- <orderedlist>
- <listitem>
- <para> Start up the Weblogic configuration wizard:</para>
- <programlisting>$BEA_HOME/wlserver_10.0/common/bin/config.sh
- </programlisting>
- </listitem>
- <listitem>
- <para> Choose to create a new domain, configured to support
- <literal>Weblogic Server</literal>. Note that this is
- the default domain option. </para>
- </listitem>
- <listitem>
- <para>Set a username and password for this domain.</para>
- </listitem>
- <listitem>
- <para> Next choose <literal>Development Mode</literal> and
- the default JDK when given the option. </para>
- </listitem>
- <listitem>
- <para> The next screen asks if you want to customize any setting.
- Select <literal>No</literal>. </para>
- </listitem>
- <listitem>
- <para> Finally set the name of the domain to
- <literal>seam_examples</literal> and leave the default
- domain location. </para>
- </listitem>
- </orderedlist>
- </section>
- <section id="bea_start_stop_access">
- <title>How to Start/Stop/Access your domain</title>
- <para>
- Now that the server is installed and the domain is created
- you need to know how to start and stop it, plus how to
- access its configuration console.
- </para>
- <itemizedlist>
- <listitem>
- <para> Starting the domain:</para>
- <para> This is the easy part - go to the <literal>
- $BEA_HOME/user_projects/domains/seam_examples/bin
- </literal> directory and run the
- <literal>./startWeblogic.sh</literal> script. </para>
- </listitem>
- <listitem>
- <para> Accessing the configuration console:</para>
- <para> Launch
- <literal>http://127.0.0.1:7001/console</literal> in
- your web browser. It will ask for your username and password
- that you entered before. We won't get into this much now, but
- this is the starting point for a lot of the various
- configurations that are needed later. </para>
- </listitem>
- <listitem>
- <para> Stopping the domain:</para>
- <para> There are a couple of options here: </para>
- <itemizedlist>
- <listitem>
- <para> The recommended way is through the configuration
- console:
- <orderedlist>
- <listitem>
- <para> Select
- <literal>seam_examples</literal> on the
- left hand side of the console. </para>
- </listitem>
- <listitem>
- <para> Choose the
- <literal>Control</literal> tab in the
- middle of the page. </para>
- </listitem>
- <listitem>
- <para> Select the check box
- <literal>AdminServer</literal> in the
- table. </para>
- </listitem>
- <listitem>
- <para> Choose <literal>Shutdown</literal>
- just above the table, and select either
- <literal>When work completes</literal>
- or <literal>Force shutdown now</literal>
- as appropriate. </para>
- </listitem>
- <listitem>
- <para> Then finally confirm that you want to
- shut this server down. </para>
- </listitem>
- </orderedlist> </para>
- </listitem>
- <listitem>
- <para> Hitting <literal>Ctrl-C</literal> in the
- terminal where you started the domain.</para>
- <para> No negative effects have been seen, but we would not
- recommend doing this while in the middle of
- configuration changes in the console. </para>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para><note>
- <title>A note on Weblogic classloading</title>
- <para>When using the
- <literal>@DOMAIN/autodeploy</literal> directory as
- described in this chapter you may see
- <literal>NoClassDefFound</literal> exceptions. If
- you see this try restarting the Weblogic server. If you
- still see it remove the auto-deployed EAR/WAR files,
- restart the server, and redeploy. We could not find a
- specific reason for this, but others seem to be having this
- issue as well. </para> </note></para>
- </listitem>
- </itemizedlist>
- </section>
- </section>
-
- <section>
- <title> The <literal>jee5/booking</literal> Example </title>
-
- <para>
- Do you want to run Seam using EJB's on Weblogic? If so there
- are some obstacles that you will have to avoid. This section
- describes those obstacles and what changes are needed to the
- <literal>jee5/booking</literal>
- example to get it deployed and functioning.
- </para>
-
- <section id="weblogic-ejb-issues">
- <title>EJB3 Issues with Weblogic</title>
- <para>
- For several releases of Weblogic there has been an issue
- with how Weblogic compiles EJB's that use variable arguments
- in their methods. This is confirmed in the Weblogic 9.X and
- 10.X versions. Seam uses variable arguments in one of its
- internal EJB's (
- <literal>TimerServiceDispatcher</literal>
- ). So Seam will not function correctly without
- modifications.
- </para>
-
- <para>
- The basic explanation of the issue is that the Weblogic EJB
- compiler believes that methods that use
- <literal>varargs</literal>
- are
- <literal>transient</literal>
- and the deployment will fail with exceptions like below:
-
- <programlisting><![CDATA[java.io.IOException: Compiler failed executable.exec:
-/jboss/apps/bea/wlserver_10.0/user_projects/domains/seam_examples/servers/AdminServer
-/cache/EJBCompilerCache/5yo5dk9ti3yo/org/jboss/seam/async/
-TimerServiceDispatcher_qzt5w2_LocalTimerServiceDispatcherImpl.java:194: modifier transient
-not allowed here
- public transient javax.ejb.Timer scheduleAsynchronousEvent(java.lang.String arg0,
- java.lang.Object[] arg1)
- ^
-/jboss/apps/bea/wlserver_10.0/user_projects/domains/seam_examples/servers/AdminServer
-/cache/EJBCompilerCache/5yo5dk9ti3yo/org/jboss/seam/async/
-TimerServiceDispatcher_qzt5w2_LocalTimerServiceDispatcherImpl.java:275: modifier transient
-not allowed here
- public transient javax.ejb.Timer scheduleTimedEvent(java.lang.String arg0,
- org.jboss.seam.async.TimerSchedule arg1, java.lang.Object[] arg2)]]></programlisting>
- <para>
- BEA has created a patch (
- <literal>CR327275</literal>
- ) for this issue that can be requested from their
- support. It is rumored that it will be included in the
- final release of Weblogic 10.3, although not confirmed.
- </para>
- <para>
- Unfortunately a second issue has been reported and
- verified by BEA (
- <literal>CR363182</literal>
- ). This issue has to do with certain EJB methods
- incorrectly left out of Weblogic's generated internal
- stub classes. At the time of this writing the status of
- this issue is not known. When this issue has been
- patched, and tested with Seam this reference guide
- chapter will be updated.
- </para>
-
- <para>
- So that Seam's users can deploy an EJB application to
- Weblogic a special Weblogic specific jar has been
- created, starting with Seam 2.0.2.CR2. It is located in
- the
- <literal>$SEAM/lib/interop</literal>
- directory and is called
- <literal>jboss-seam-wls-compatible.jar</literal>
- . The only difference between this jar and the
- <literal>jboss-seam.jar</literal>
- is that it does not contain the
- <literal>TimerServiceDispatcher</literal>
- EJB. To use this jar simply rename the
- <literal>jboss-seam-wls-compatible.jar</literal>
- to
- <literal>jboss-seam.jar</literal>
- and replace the original in your applications
- <literal>EAR</literal>
- file. The
- <literal>jee5/booking</literal>
- example demonstrates this.
- </para>
- </para>
- </section>
-
- <section>
- <title>Getting the <literal>jee5/booking</literal> Working</title>
- <para>In this section we will go over the steps needed to get
- the <literal>jee5/booking</literal> example to up and running.</para>
-
- <section id="weblogic-hsql-jee5-ds">
- <title>Setting up the hsql datasource</title>
- <para>This example uses the in memory hypersonic database, and the
- correct data source needs to be set up. The admin console uses a
- wizard like set of pages to configure it.
-
- <orderedlist>
- <listitem>
- <para>Copy <literal>hsqldb.jar</literal> to the Weblogic
- domain's shared library directory: <literal> cp
- ../../../lib/hsqldb.jar
- /jboss/apps/bea/user_projects/domains/seam_examples/lib
- </literal>
- </para>
- </listitem>
- <listitem>
- <para>Start up the server and navigate to the
- administration console following <xref
- linkend="bea_start_stop_access"/></para>
- </listitem>
- <listitem>
- <para>On the left side tree navigate
- <literal>seam_examples - Services- JDBC - Data
- Sources</literal>.</para>
- </listitem>
- <listitem>
- <para>You must lock the domain configuration using the
- button in the upper left box.</para>
- </listitem>
- <listitem>
- <para>Then select the <literal>New</literal>
- button at the top of the data source table</para>
- </listitem>
- <listitem>
- <para>Fill in the following:
- <orderedlist>
- <listitem>
- <para>Name:
- <literal>seam-jee5-ds</literal>
- </para>
- </listitem>
- <listitem>
- <para>JNDI Name:
- <literal>seam-jee5-ds</literal>
- </para>
- </listitem>
- <listitem>
- <para>Database Type and Driver:
- <literal>other</literal></para>
- </listitem>
- <listitem>
- <para>Select <literal>Next</literal>
- button</para>
- </listitem>
- </orderedlist></para>
- </listitem>
- <listitem>
- <para>Select <literal>Next</literal> button on the
- <literal>Transaction Options</literal>
- page</para>
- </listitem>
- <listitem>
- <para>Fill in the following on the <literal>Connection
- Properties</literal> page:
- <orderedlist>
- <listitem>
- <para>Database Name:
- <literal>hsqldb</literal></para>
- </listitem>
- <listitem>
- <para>Host Name:
- <literal>127.0.0.1</literal></para>
- </listitem>
- <listitem>
- <para>Port: <literal>9001</literal>
- </para>
- </listitem>
- <listitem>
- <para>Username: <literal>sa</literal> will
- empty password fields.</para>
- </listitem>
- <listitem>
- <para>Select <literal>Next</literal>
- button</para>
- </listitem>
- </orderedlist></para>
- </listitem>
- <listitem>
- <para>Fill in the following on the <literal>Connection
- Properties</literal> page:
- <orderedlist>
- <listitem>
- <para>Driver Class Name:
- <literal>org.hsqldb.jdbcDriver</literal>
- </para>
- </listitem>
- <listitem>
- <para>URL:
- <literal>jdbc:hsqldb:.</literal>
- </para>
- </listitem>
- <listitem>
- <para>Username: <literal>sa</literal> will
- empty password fields.</para>
- </listitem>
- <listitem>
- <para>Leave the rest of the fields
- as is.</para>
- </listitem>
- <listitem>
- <para>Select <literal>Next</literal>
- button</para>
- </listitem>
- </orderedlist></para>
- </listitem>
- <listitem>
- <para>Choose the target domain for the data source in our
- case the only one <literal>AdminServer</literal>.
- Click <literal>Next</literal>.</para>
- </listitem>
- <listitem>
- <para>Finally - apply the changes by selecting the
- <literal>Apply Changes</literal> button in the
- upper left corner.</para>
- </listitem>
- </orderedlist> </para>
- </section>
- <section id="weblogic-jsf-deploy">
- <title>Setting up Weblogics JSF Support</title>
- <para>These are the instructions to deploy and configure Weblogic's
- JSF 1.2 libraries. Out of the box Weblogic does not come with its
- own JSF libraries active, and unfortunately when deploying an
- <literal>EAR</literal> based application Weblogic requires its
- own JSF libraries to function. This appears to be caused by
- classloader issues. The assumption being that JSF libraries
- in the application are not visible to Weblogic during deployment of
- the <literal>EAR</literal> application. Why this does not effect
- <literal>WAR</literal> based applications is not known.</para>
-
- <orderedlist>
- <listitem>
- <para>In the administration console navigate to the
- <literal>Deployments</literal> page using the left hand
- menu.</para>
- </listitem>
- <listitem>
- <para>You must lock the domain configuration using the
- button in the upper left box.</para>
- </listitem>
- <listitem>
- <para>Then select the <literal>Install</literal>
- button at the top of the deployments table</para>
- </listitem>
- <listitem>
- <para>Using the directory browser navigate to the
- <literal>/jboss/apps/bea/wlserver_10.0/common/deployable-libraries
- </literal>
- directory. Then select the <literal>jsj-1.2.war</literal>
- archive, and click the <literal>Next</literal> button.</para>
- </listitem>
- <listitem>
- <para>Make sure that the <literal>Install this deployment
- as a library</literal> is selected. Click the <literal>Next
- </literal> button on the <literal>Install Application
- Assistant</literal> page.</para>
- </listitem>
- <listitem>
- <para>Click the <literal>Next</literal> button on the
- <literal> Optional Settings</literal> page.</para>
- </listitem>
- <listitem>
- <para>Make sure that the <literal>Yes, take me to the
- deployment's configuration screen.</literal> is selected.
- Click the <literal>Finish</literal> button on the <literal>
- Review your choices and click Finish</literal> page.</para>
- </listitem>
- <listitem>
- <para>On the <literal>Settings for jsf(1.2,1.2.3.1)</literal>
- page set the <literal>Deployment Order</literal> to
- <literal>99</literal> so that it is deployed prior to
- autodeployed applications. Then click the <literal>
- Save</literal> button.</para>
- </listitem>
- <listitem>
- <para>Then activate the changes by clicking the green
- button in the upper left.</para>
- </listitem>
- </orderedlist>
-
- <para>There is another step that is needed for this to work. For
- some reason, even with the steps above classes in the <literal>
- jsf-api.jar</literal> are not found during application deployment.
- The only way I found for this to work is to put the <literal>
- jsf-api.jar</literal> from <literal>$SEAM/lib</literal> directory
- in the domains shared library
- <literal>/jboss/apps/bea/user_projects/domains/seam_domain/lib</literal>
- </para>
-
- <orderedlist>
- <listitem>
- <para>Shutdown the server following <xref
- linkend="bea_start_stop_access"/></para>
- </listitem>
- <listitem>
- <para>Then execute
- <literal>
-cp ../../../lib/jsf-api.jar /jboss/apps/bea/user_projects/domains/seam_examples/lib
- </literal>. Verify the jar was copied correctly.</para>
- </listitem>
- <listitem>
- <para>Start up the server and navigate to the
- administration console following <xref
- linkend="bea_start_stop_access"/></para>
- </listitem>
- <listitem>
- <para>Then verify a clean start up of the server.</para>
- </listitem>
- </orderedlist>
- </section>
- <section>
- <title>Configuration and Build changes</title>
- <para>
- OK - now we are ready to finally begin adjusting the seam
- application for deployment to the Weblogic server.
- </para>
- <variablelist>
- <varlistentry>
- <term>
- <literal>
- resources/META-INF/persistence.xml
- </literal>
- </term>
- <listitem>
- <itemizedlist>
- <listitem>
- <para>
- Change the
- <literal>jta-data-source</literal>
- to what you entered above :
- </para>
- <programlisting role="XML"><![CDATA[
- <jta-data-source>seam-jee5-ds</jta-data-source>]]></programlisting>
- </listitem>
- <listitem>
- <para>
- Then comment out the glassfish properties.
- </para>
- </listitem>
- <listitem>
- <para>
- Then add these two properties for weblogic
- support.
- </para>
- <programlisting role="XML"><![CDATA[
-<property name="hibernate.dialect"
- value="org.hibernate.dialect.HSQLDialect"/>
-<property name="hibernate.transaction.manager_lookup_class"
- value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
-]]></programlisting>
- </listitem>
- </itemizedlist>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <literal>
- resources/META-INF/weblogic-application.xml
- </literal>
- </term>
- <listitem>
- <itemizedlist>
- <listitem>
- <para>
- This file needs to be created and should
- contain the following:
- </para>
- <programlisting role="XML"><![CDATA[
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<weblogic-application>
- <library-ref>
- <library-name>jsf</library-name>
- <specification-version>1.2</specification-version>
- <implementation-version>1.2</implementation-version>
- <exact-match>false</exact-match>
- </library-ref>
- <prefer-application-packages>
- <package-name>antlr.*</package-name>
- </prefer-application-packages>
-</weblogic-application>
-]]></programlisting>
- </listitem>
- <listitem>
- <para>
- These changes do two two different things.
- The first element
- <literal>library-ref</literal>
- tells weblogic that this application will
- be using the deployed JSF libraries. The
- second element
- <literal>
- prefer-application-packages
- </literal>
- tells weblogic that the
- <literal>antlr</literal>
- jars take precedence. This avoids a
- conflict with hibernate.
- </para>
- </listitem>
- </itemizedlist>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <literal>resources/META-INF/ejb-jar.xml</literal>
- </term>
- <listitem>
- <itemizedlist>
- <listitem>
- <para>
- The changes described here work around an
- issue where Weblogic is only using a
- single instance of the
- <literal>sessionBeanInterceptor</literal>
- for all session beans. Seam's interceptor
- caches and stores some component specific
- attributes, so when a call comes in - the
- interceptor is primed for a different
- component and an error is seen. To solve
- this problem you must define a separate
- interceptor binding for each EJB you wish
- to use. When you do this Weblogic will use
- a separate instance for each EJB.
- </para>
- <para>
- Modify the
- <literal>assembly-descriptor</literal>
- element to look like this:
- </para>
- <programlisting role="XML"><![CDATA[
-<assembly-descriptor>
- <interceptor-binding>
- <ejb-name>AuthenticatorAction</ejb-name>
- <interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
- </interceptor-binding>
- <interceptor-binding>
- <ejb-name>BookingListAction</ejb-name>
- <interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
- </interceptor-binding>
- <interceptor-binding>
- <ejb-name>RegisterAction</ejb-name>
- <interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
- </interceptor-binding>
- <interceptor-binding>
- <ejb-name>ChangePasswordAction</ejb-name>
- <interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
- </interceptor-binding>
- <interceptor-binding>
- <ejb-name>HotelBookingAction</ejb-name>
- <interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
- </interceptor-binding>
- <interceptor-binding>
- <ejb-name>HotelSearchingAction</ejb-name>
- <interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
- </interceptor-binding>
- <interceptor-binding>
- <ejb-name>EjbSynchronizations</ejb-name>
- <interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
- </interceptor-binding>
-</assembly-descriptor>]]></programlisting>
- </listitem>
- </itemizedlist>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <literal>resources/WEB-INF/weblogic.xml</literal>
- </term>
- <listitem>
- <itemizedlist>
- <listitem>
- <para>
- This file needs to be created and should
- contain the following:
- </para>
- <programlisting role="XML"><![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
-
-<weblogic-web-app>
-<library-ref>
- <library-name>jsf</library-name>
- <specification-version>1.2</specification-version>
- <implementation-version>1.2</implementation-version>
- <exact-match>false</exact-match>
- </library-ref>
-</weblogic-web-app>
-]]></programlisting>
- </listitem>
- <listitem>
- <para>
- This file and the element
- <literal>library-ref</literal>
- tells Weblogic that this application will
- using the deployed JSF libraries. This is
- needed in both this file and the
- <literal>
- weblogic-application.xml
- </literal>
- file because both applications require
- access.
- </para>
- </listitem>
- </itemizedlist>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <literal>resources/WEB-INF/web.xml</literal>
- </term>
- <listitem>
- <itemizedlist>
- <listitem>
- <para>
- Because the
- <literal>jsf-impl.jar</literal>
- is not going to be in the
- <literal>$WAR/WEB_INF/lib</literal>
- directory we need to add a configuration
- listener to this file.
- </para>
- <programlisting role="XML"><![CDATA[
- <listener>
- <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
- </listener>
-]]></programlisting>
- </listitem>
- </itemizedlist>
- </listitem>
- </varlistentry>
- </variablelist>
- </section>
- <section>
- <title>Building and Deploying the Application</title>
- <para>
- There are some changes needed to the build script and the
- <literal>jboss-seam.jar</literal>
- then we can deploy the app.
- </para>
- <variablelist>
- <varlistentry>
- <term>
- <literal>build.xml</literal>
- </term>
- <listitem>
- <itemizedlist>
- <listitem>
- <para>
- Add the following to the
- <literal>build.xml</literal>
- . Note that
- <literal>richfaces-api.jar</literal>
- is only needed if using the admin console
- to deploy. For some reason Weblogic needs
- it in the
- <literal>WAR</literal>
- when it scans the application.
- </para>
- <programlisting role="XML"><![CDATA[
-<fileset id="war.lib.extras" dir="${seam.dir}">
- <include name="lib/richfaces-api.jar" />
-</fileset>]]></programlisting>
- </listitem>
- <listitem>
- <para>
- Next we need to add the follow so that the
- <literal>
- weblogic-application.xml
- </literal>
- will be packaged.
- </para>
- <programlisting role="XML"><![CDATA[
- <!-- Resources to go in the ear -->
- <fileset id="ear.resources" dir="${resources.dir}">
- <include name="META-INF/application.xml" />
- <include name="META-INF/weblogic-application.xml" />
- <include name="META-INF/*-service.xml" />
- <include name="META-INF/*-xmbean.xml" />
- <include name="treecache.xml" />
- <include name="*.jpdl.xml" />
- <exclude name=".gpd.*" />
- <include name="*.cfg.xml" />
- <include name="*.xsd" />
- </fileset>]]></programlisting>
- </listitem>
- <listitem>
- <para>
- Then finally we need to add two jars to
- the
- <literal>EAR</literal>
- . Add these two lines to the
- <literal>ear.lib.extras</literal>
- fileset.
- </para>
- <programlisting role="XML"><![CDATA[
- <include name="examples/wiki/lib/jboss-archive-browsing.jar" />
- <include name="lib/concurrent.jar" />]]></programlisting>
- </listitem>
- </itemizedlist>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <literal>
- $SEAM/lib/interop/jboss-seam-wls-compatible.jar
- </literal>
- </term>
- <listitem>
- <itemizedlist>
- <listitem>
- <para>
- This is the change discussed above in
- <xref linkend="weblogic-ejb-issues" />
- . There are really two options.
- </para>
- </listitem>
- <listitem>
- <para>
- Rename this jar and replace the original
- <literal>
- $SEAM/lib/jboss-seam.jar
- </literal>
- file. This approach does not require any
- changes to the packaged
- <literal>EAR</literal>
- archive, but overwrites the original
- <literal>jboss-seam.jar</literal>
- </para>
- </listitem>
- <listitem>
- <para>
- The other option is the modify the
- packaged
- <literal>EAR</literal>
- archive and replace the
- <literal>jboss-seam.jar</literal>
- in the archive manually. This leaves the
- original jar alone, but requires a manual
- step when ever the archive is packaged.
- </para>
- </listitem>
- </itemizedlist>
- </listitem>
- </varlistentry>
- </variablelist>
-
- <para>
- Assuming that you choose the first option for handling
- the
- <literal>jboss-seam-wls-compatible.jar</literal>
- we can build the application by running
- <literal>ant archive</literal>
- at the base of the
- <literal>jee5/booking</literal>
- example directory.
- </para>
-
- <para>
- Because we chose to create our Weblogic domain in
- development mode we can deploy the application by putting
- the EAR file in the domains autodeploy directory.
-
- <programlisting>
- cp ./dist/jboss-seam-jee5.ear
- /jboss/apps/bea/user_projects/domains/seam_examples/autodeploy
- </programlisting>
- </para>
-
- <para>
- Check out the application at
- <literal>http://localhost:7001/seam-jee5/</literal>
- </para>
- </section>
- </section>
-
- </section>
-
- <section>
- <title> The <literal>jpa</literal> booking example </title>
- <para>This is the Hotel Booking example implemented in Seam POJO and
- Hibernate JPA and does not require EJB3 support to run. The example
- already has a breakout of configurations and build scripts for many of
- the common containers including Weblogic 10.X </para>
-
- <para> First we'll build the example for Weblogic 10.x and do the needed
- steps to deploy. Then we'll talk about what is different between the
- Weblogic versions, and with the JBoss AS version. </para>
-
- <para>Note that this example assumes that Weblogic's JSF libraries have
- been configured as described in <xref linkend="weblogic-jsf-deploy"/>.</para>
-
- <section>
- <title>
- Building and deploying
- <literal>jpa</literal>
- booking example
- </title>
-
- <para>
- Step one setup the datasource, step two build the app, step
- three deploy.
- </para>
-
- <section>
- <title>Setting up the datasource</title>
-
- <para>
- The Weblogic 10.X version of the example will use the in
- memory hsql database instead of the built in PointBase
- database. If you wish to use the PointBase database you
- must setup a PointBase datasource, and adjust the
- hibernate setting in
- <literal>persistence.xml</literal>
- to use the PointBase dialect. For reference the
- <literal>jpa/weblogic92</literal>
- example uses PointBase.
- </para>
- <para>
- Configuring the datasource is very similar to the jee5
- <xref linkend="weblogic-hsql-jee5-ds" />
- . Follow the steps in that section, but use the following
- entries where needed.
- <itemizedlist>
- <listitem>
- <para>
- DataSource Name:
- <literal>seam-jpa-ds</literal>
- </para>
- </listitem>
- <listitem>
- <para>
- JNDI Name:
- <literal>seam-jpa-ds</literal>
- </para>
- </listitem>
- </itemizedlist>
- </para>
- </section>
- <section>
- <title>Building the example</title>
-
- <para>
- Building it only requires running the correct ant
- command:
-
- <programlisting>
- ant -f build-weblogic10.xml
- </programlisting>
- This will create a container specific distribution and
- exploded archive directories.
- </para>
- </section>
- <section>
- <title>Deploying the example</title>
-
- <para>
- When we installed Weblogic following
- <xref linkend="weblogic-domain" />
- we chose to have the domain in development mode. This
- means to deploy the application all we need to do is copy
- it into the autodeploy directory.
- </para>
-
- <programlisting>
- cp ./dist-weblogic10/jboss-seam-jpa.war
- /jboss/apps/bea/user_projects/domains/seam_examples/autodeploy
- </programlisting>
-
- <para>
- Check out the application at the following
- <literal>http://localhost:7001/jboss-seam-jpa/</literal>
- .
- </para>
- </section>
- </section>
- <section id="weblogic-jpa-diff">
- <title>What's different with Weblogic 10.x</title>
- <itemizedlist>
- <listitem>
- <para>Between the the Weblogic 10.x and 9.2 examples there are
- several differences:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <literal>META-INF/persistence.xml</literal>
- — The 9.2 version is configured to use the
- <literal>PointBase</literal> database and a
- pre-installed datasource. The 10.x version uses
- the <literal>hsql</literal> database and a
- custom datasource.</para>
- </listitem>
- <listitem>
- <para id="weblogic.xml"
- xreflabel="description of WEB-INF/weblogic.xml">
- <literal>WEB-INF/weblogic.xml</literal>
- — This file and its contents solve an issue
- with an older version of the
- <literal>ANTLR</literal> libraries that
- Weblogic 10.x uses internally. OC4J have the same
- issue as well. It also configures the application to
- use the shared JSF libraries that were installed
- above.</para>
-
- <programlisting role="XML"><![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
-<weblogic-web-app
-xmlns="http://www.bea.com/ns/weblogic/90"
-xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-xsi:schemaLocation="http://www.bea.com/ns/weblogic/90
- http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">
- <library-ref>
- <library-name>jsf</library-name>
- <specification-version>1.2</specification-version>
- <implementation-version>1.2</implementation-version>
- <exact-match>false</exact-match>
- </library-ref>
- <container-descriptor>
- <prefer-web-inf-classes>true</prefer-web-inf-classes>
- </container-descriptor>
-</weblogic-web-app>]]></programlisting>
- <para>This make Weblogic use classes and
- libraries in the web application before other
- libraries in the classpath. Without this change
- hibernate is required to use a older, slower query
- factory by setting the following property in the
- <literal>META-INF/persistence.xml</literal>
- file. </para>
-
- <programlisting role="XML"><![CDATA[
-<property name="hibernate.query.factory_class"
- value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>]]>
- </programlisting>
- </listitem>
- <listitem>
- <para>
- <literal>WEB-INF/components.xml</literal>
- — In the Weblogic 10.x version JPA entity
- transactions is enabled by adding:</para>
-
-
- <programlisting role="XML"><![CDATA[
- <transaction:entity-transaction entity-manager="#{em}"/>]]></programlisting>
- </listitem>
- <listitem>
- <para>
- <literal>WEB-INF/web.xml</literal>
- — Because the <literal>jsf-impl.jar</literal>
- is not in the <literal>WAR</literal> this listener
- need to be configured :</para>
- <programlisting role="XML"><![CDATA[
- <listener>
- <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
- </listener>]]></programlisting>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para>Between the Weblogic 10.x version and the JBoss version
- there are more changes. Here is the rundown:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <literal>META-INF/persistence.xml</literal>
- — Except for datasource name the Weblogic
- version sets:
- </para>
- <programlisting role="XML"><![CDATA[
-<property name="hibernate.transaction.manager_lookup_class"
- value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>]]>
- </programlisting>
- </listitem>
- <listitem>
- <para><literal>WEB-INF/lib</literal> — The
- Weblogic version requires several library
- packages because they are not included as they are
- with JBoss AS. These are primarily for hibernate,
- and its dependencies.
- </para>
- <itemizedlist>
- <listitem>
- <para> To use Hibernate as your JPA provider
- you need the following jars:
- </para>
- <itemizedlist>
- <listitem>
- <simpara>
- <literal>hibernate.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>hibernate-annotations.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>hibernate-entitymanager.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>hibernate-validator.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>jboss-common-core.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>commons-logging.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>commons-collections.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>jboss-archive-browsing.jar</literal>
- </simpara>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para>Various third party jars that
- Weblogic needs:
- </para>
- <itemizedlist>
- <listitem>
- <simpara>
- <literal>antlr.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>cglib.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>asm.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>dom4j.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>el-ri.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>javassist.jar</literal>
- </simpara>
- </listitem>
- </itemizedlist>
- </listitem>
- </itemizedlist>
- </listitem>
- </itemizedlist>
- </listitem>
- </itemizedlist>
- </section>
-
- </section>
-
- <section>
- <title> Deploying an application created using
- <literal>seam-gen</literal> on Weblogic 10.x</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 Weblogic.
- </para>
- <para><literal>seam-gen</literal> was build for simplicity so, as you
- can imagine, deploying an application generated by
- <literal>seam-gen</literal> to Weblogic 10.x is not too hard.
- Basically it consists of updating or removing some configuration
- files, and adding dependent jars that Weblogic 10.x does not ship
- with.</para>
-
- <para>This example will cover the basic <literal>seam-gen WAR</literal>
- deployment. This will demonstrate Seam POJO components, Hibernate
- JPA, Facelets, Drools security, RichFaces, and a configurable
- dataSource.</para>
-
- <section>
- <title>Running <literal>seam-gen</literal> setup</title>
-
- <para>The first thing we need to do it tell
- <literal>seam-gen</literal> about the project we want to make.
- This is done by running <literal>./seam setup</literal> in the base
- directory of the Seam distribution. Note the paths here are my own,
- feel free to change for you environment.
-
- <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.2.GA]
-[C:/Program Files/jboss-4.2.2.GA]
-/jboss/apps/jboss-4.2.2.GA
- [input] Enter the project name [myproject] [myproject]
-weblogic-example
- [echo] Accepted project name as: weblogic_example
- [input] Select a RichFaces skin (not applicable if using ICEFaces) [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, )
-war
- [input] Enter the Java package name for your session beans [org.jboss.seam.
-tutorial.weblogic.action] [org.jboss.seam.tutorial.weblogic.action]
-org.jboss.seam.tutorial.weblogic.action
- [input] Enter the Java package name for your entity beans [org.jboss.seam.
-tutorial.weblogic.model] [org.jboss.seam.tutorial.weblogic.model]
-org.jboss.seam.tutorial.weblogic.model
- [input] Enter the Java package name for your test cases [org.jboss.seam.
-tutorial.weblogic.action.test] [org.jboss.seam.tutorial.weblogic.action.test]
-org.jboss.seam.tutorial.weblogic.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], )
-
- [input] Enter your ICEfaces home directory (leave blank to omit ICEfaces) [] []
-
-[propertyfile] Creating new property file:
-/rhdev/projects/jboss-seam/cvs-head/jboss-seam/seam-gen/build.properties
- [echo] Installing JDBC driver jar to JBoss server
- [copy] Copying 1 file to /jboss/apps/jboss-4.2.2.GA/server/default/lib
- [echo] Type 'seam create-project' to create the new project
-
-BUILD SUCCESSFUL]]></programlisting>
- </para>
- <para> Type <literal>./seam new-project</literal> to create your
- project and <literal>cd
- /home/jbalunas/workspace/weblogic_example</literal> to see
- the newly created project. </para>
- </section>
-
- <section>
- <title>What to change for Weblogic 10.X</title>
- <para>First we change and delete some configuration files, then we
- update the libraries that are deployed with the
- application.</para>
-
- <section>
- <title>Configuration file changes</title>
- <variablelist>
- <varlistentry>
- <term> <literal>build.xml</literal>
- </term>
- <listitem>
- <itemizedlist>
- <listitem>
- <para>Change the default target to
- <literal>archive</literal>.
- </para>
- <programlisting role="XML">
-<![CDATA[<project name="weblogic_example" default="archive" basedir=".">]]>
- </programlisting>
- </listitem>
- </itemizedlist>
- </listitem>
- </varlistentry>
- <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>seam-gen-ds</literal> (and
- use this as the
- <literal>jndi-name</literal> when
- creating the data source in Weblogic's
- admin console)</para>
- </listitem>
- <listitem>
- <para>
- Change the transaction type to
- <literal>RESOURCE_LOCAL</literal>
- so that we can use JPA transactions.
- </para>
- <programlisting role="XML">
- <![CDATA[
-<persistence-unit name="weblogic_example" transaction-type="RESOURCE_LOCAL">]]>
- </programlisting>
- </listitem>
- <listitem>
- <para>
- Add/modify the properties below for
- Weblogic support:
- </para>
- <programlisting role="XML"><![CDATA[<property name="hibernate.cache.provider_class"
- value="org.hibernate.cache.HashtableCacheProvider"/>
-<property name="hibernate.transaction.manager_lookup_class"
- value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
-]]></programlisting>
- </listitem>
- <listitem>
- <para> You'll need to alter
- <literal>persistence-prod.xml</literal>
- as well if you want to deploy to Weblogic
- using the prod profile. </para>
- </listitem>
- </itemizedlist>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <literal>resource/WEB-INF/weblogic.xml</literal>
- </term>
- <listitem>
- <para> You will need to create this file and populate it
- following <xref linkend="weblogic.xml"/>.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <literal>
- resource/WEB-INF/components.xml
- </literal>
- </term>
- <listitem>
- <para>
- We want to use JPA transactions so we need to
- add the following to let Seam know.
- </para>
- <programlisting role="XML"><![CDATA[<transaction:entity-transaction entity-manager="#{entityManager}"/>]]></programlisting>
- <para>
- You will also need to add the transaction
- namespace and schema location to the top of
- the document.
- </para>
- <programlisting role="XML"><![CDATA[xmlns:transaction="http://jboss.com/products/seam/transaction"]]></programlisting>
- <programlisting role="XML"><![CDATA[http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.1.xsd]]></programlisting>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <literal>resource/WEB-INF/web.xml</literal>
- </term>
- <listitem>
- <para>
- <literal>WEB-INF/web.xml</literal>
- — Because the
- <literal>jsf-impl.jar</literal>
- is not in the
- <literal>WAR</literal>
- this listener need to be configured :
- </para>
- <programlisting role="XML"><![CDATA[
- <listener>
- <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
- </listener>]]></programlisting>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <literal>
- resources/WEB-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 files as we aren't
- deploying to JBoss AS. These files define
- datasources in JBoss AS, in Weblogic we will use the
- administration console.</para>
- </listitem>
- </varlistentry>
- </variablelist>
- </section>
- <section id="weblogic-seam-gen-lib-changes">
- <title>Library changes</title>
- <para>The <literal>seam-gen</literal> application has very
- similar library dependencies as the <literal>jpa</literal>
- example above. See <xref linkend="weblogic-jpa-diff"/>.
- Below is the changes that are needed to get them in this
- application.</para>
-
- <itemizedlist>
-
- <listitem>
- <para>Missing jar — There is one library that
- <literal>seam-gen</literal> does not provide by
- default. This needs to be copied into your projects
- <literal>/lib</literal> directory manually.
- </para>
- <itemizedlist>
- <listitem>
- <para>jboss-archive-browsing.jar — can
- be found in the
- <literal>@SEAM_DIST/examples/wiki/lib</literal>
- directory. </para>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para>build.xml — Now we need to adjust the
- <literal>build.xml</literal>. Find the target
- <literal>war</literal> and add the following to the end
- of the target.</para>
- <programlisting role="XML"><![CDATA[
- <copy todir="${war.dir}/WEB-INF/lib">
- <fileset dir="${lib.dir}">
- <!-- Misc 3rd party -->
- <include name="commons-logging.jar" />
- <include name="dom4j.jar" />
- <include name="javassist.jar" />
- <include name="cglib.jar" />
- <include name="antlr.jar" />
-
- <!-- Hibernate -->
- <include name="hibernate.jar" />
- <include name="hibernate-commons-annotations.jar" />
- <include name="hibernate-annotations.jar" />
- <include name="hibernate-entitymanager.jar" />
- <include name="hibernate-validator.jar" />
- <include name="jboss-archive-browsing.jar" />
- </fileset>
- </copy>]]></programlisting>
- </listitem>
- </itemizedlist>
-
- </section>
-
- <section>
- <title><literal>seam-gen</literal> development profile
- issue</title>
- <para>There is currently an issue with the behavior of the
- <literal>seam-gen WAR</literal> application when built using
- the development profile (the default) and deployed to Weblogic.
- The symptom is that the login page of the application will always
- show a <literal>login failed</literal> message.</para>
-
- <para>When the application is built using the development profile
- the <literal>action</literal> class files are placed in the
- <literal>WEB-INF/dev</literal> directory. Normally these
- class files are hot deployable and managed by Seam. This does not
- happen on Weblogic (see <ulink
- url="http://jira.jboss.com/jira/browse/JBSEAM-2455">
- jira JBSEAM-2455</ulink> for details and status).</para>
-
- <para>To workaround this you need to modify the
- <literal>build-dev.properties</literal> file. Simply
- remove the property
- <literal>action.dir=WEB-INF/dev</literal>.</para>
- </section>
-
- </section>
-
- <section>
- <title>Building and Deploying your application</title>
- <para>Finally all that's left is deploying the application. This
- involves setting up a data source, building the app, and deploying
- it.</para>
-
- <section>
- <title>Setting up the data source</title>
- <para>Configuring the datasource is very similar to the jee5 <xref
- linkend="weblogic-hsql-jee5-ds"/>. Except for what is
- listed here follow that instruction from the link.
- <itemizedlist>
- <listitem>
- <para>DataSource Name:
- <literal>seam-gen-ds</literal></para>
- </listitem>
- <listitem>
- <para>JNDI Name: <literal>seam-gen-ds</literal>
- </para>
- </listitem>
- </itemizedlist> </para>
- </section>
- <section>
- <title>Building the application</title>
- <para>This is as easy as typing <literal>ant</literal> in the
- projects base directory.</para>
- </section>
- <section>
- <title>Deploying the example</title>
-
- <para>When we installed Weblogic following <xref
- linkend="weblogic-domain"/> we chose to have the domain in
- development mode. This means to deploy the application all we
- need to do is copy it into the autodeploy directory.
- </para>
-
-<programlisting role="XML">cp ./dist/weblogic_example.war /jboss/apps/bea/user_projects/domains/seam_examples/autodeploy</programlisting>
-
- <para>Check out the application at the following
- <literal>http://localhost:7001/weblogic_example/</literal>.
- .</para>
- </section>
- </section>
- </section>
-
-</chapter>
Deleted: branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Websphere.xml
===================================================================
--- branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Websphere.xml 2008-06-09 13:10:44 UTC (rev 8352)
+++ branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/Websphere.xml 2008-06-09 13:12:16 UTC (rev 8353)
@@ -1,1545 +0,0 @@
-<chapter id="websphere">
- <title>Seam on IBM's Websphere</title>
-
- <para>Websphere 6.1.x is IBM's application server offering. The latest
- release is 6.1.0.13 which does not have <literal>EJB3</literal> or
- <literal>JEE5</literal> support. There is a recently released (Nov 07)
- <literal>EJB3</literal> feature pack which provides some support for
- <literal>EJB3</literal> and <literal>JPA</literal>. Currently there
- is no true <literal>JEE5</literal> offering from IBM. This causes some
- issues with Seam integration with applications that use EJB3.</para>
-
- <para>First we will go over some basic information about the Websphere
- environment that we used for these examples. After a good deal of research
- and work we were able to get EJB3 applications to function correctly. We will
- go over the details of those steps with the jee5 example. We will also deploy
- the the JPA example application. </para>
-
- <section>
- <title>Websphere environment and deployment information</title>
-
- <para>Websphere is a commercial product and so we will not discuss the
- details of its installation other than to say follow the directions
- provided by your particular installation type and license. This
- section will detail the exact server versions used, installation tips,
- and some custom properties that are needed for all of the
- examples.</para>
-
- <section>
- <title>Installation versions and tips</title>
- <para>All of the examples and information in this chapter are based on
- the the latest version of Websphere at the time of this writing.
- <itemizedlist>
- <listitem>
- <para><ulink
- url="http://www.ibm.com/developerworks/websphere/zones/was/">
- Websphere Application Server 6.1.0.13</ulink></para>
- </listitem>
- <listitem>
- <para><ulink
- url="http://www-1.ibm.com/support/docview.wss?rs=180&uid=swg21287579">
- Feature Pack for EJB 3.0 for Websphere Application Server
- V6.1 (3.0.6.1.0.13)</ulink></para>
- </listitem>
- </itemizedlist> </para>
-
- <para>The EJB3 feature pack that we installed came with the 6.1.0.13
- patch version of Websphere. Installing the feature pack does not
- ensure that your server will have the proper environment for EJB3
- applications. Be sure that as part of the installation of the feature
- pack you follow the instructions to create a new server
- profile with the EJB3 feature pack enabled, or augment one of your
- existing ones. This can also be done after the installation
- by running the profile managment tool.</para>
- <note>
- <title>A note about restarting the server</title>
- <para>There are times that restarting the server will be required after
- deploying or changes the examples in this chapter. Its does not seem
- like every change requires a restart. If you get errors or exceptions
- after modifing a property or deploying an application try to restart
- the server. </para> </note>
- </section>
-
- <section>
- <title>Required custom properties</title>
- <para>There are a couple of Websphere custom properties that are required
- for Seam integration. These properties are not needed specifically
- for Seam, but work around some issues with Websphere. These are
- set following the instructions here : <ulink
- url="http://www-1.ibm.com/support/docview.wss?rss=180&uid=swg21284395">
- Setting web container custom properties</ulink></para>
-
- <itemizedlist>
- <listitem>
- <para><literal>prependSlashToResource = "true"</literal>
- — This solves a fairly common issue with Websphere
- where applications are not using a leading "/" when
- attempting to access resources. If this is not set then a
- <literal>java.net.MalformedURLException</literal>
- will be thrown. With this property set you will still see
- warnings, but the resources will be retrieved as expected.
- <note>
- <title>Detailed can be found at:</title>
- <para><ulink
- url="http://www-1.ibm.com/support/docview.wss?uid=swg21190234">
- SRVE0238E: Resource paths must have a leading
- slash</ulink></para> </note> </para>
- </listitem>
- <listitem>
- <para>
- <literal>com.ibm.ws.webcontainer.invokefilterscompatibility
- = "true"</literal> — This solves an issue with
- Websphere where it throws a
- <literal>FileNotFoundException</literal> when a web
- application attempts to access a file resource that does not
- actually exist on disk. This is a common practice in modern web
- applications where filters or servlets are used to process
- resource requests like these. This issue manifests itself as
- failures to retrieve JavaScript, CSS, images, etc... when
- requesting a web page. <note>
- <title>Detailed can be found at:</title>
- <para><ulink
- url="http://www-1.ibm.com/support/docview.wss?uid=swg24014758">
- PK33090; 6.1: A filter that serves a file does not pop-up an
- alert message</ulink></para> </note></para>
- </listitem>
- </itemizedlist>
- </section>
- </section>
-
- <section id="jee5-websphere-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 designed
- to run on Glassfish, but with the steps below it can be deployed to
- Websphere. It is located in the
- <literal>$SEAM_DIST/examples/jee5/booking</literal> directory.
- </para>
-
- <para>As stated before the <literal>EJB3</literal> feature pack does not
- provide a full <literal>jee5</literal> implementation. This means
- that there are some tricks to getting an application deployed and
- functioning. </para>
-
- <section>
- <title>Configuration file changes</title>
-
- <para>Below are the configuration file changes that are need to the base
- example.</para>
-
- <variablelist>
- <varlistentry>
- <term>
- <literal>resources/WEB-INF/components.xml</literal>
- </term>
- <listitem>
- <para>We need to change the way that we look up EJBs for
- Websphere. We need to remove the
- <literal>/local</literal> from the end of the
- <literal>jndi-pattern</literal> attribute. It should
- look like this: </para>
-
-
- <programlisting role="XML"><![CDATA[
-<core:init jndi-pattern="java:comp/env/jboss-seam-jee5/#{ejbName}" debug="true"/>
- ]]></programlisting>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term> <literal>resources/WEB-INF/web.xml</literal>
- </term>
- <listitem>
- <para>This is the first place that we notice an unexpected
- change because this is not full <literal>jee5</literal>
- implementation. </para>
- <para> Websphere does not support <literal>Servlet
- 2.5</literal>, it requires <literal>Servlet
- 2.4</literal>. For this change we need to adjust the top of
- the <literal>web.xml</literal> file to look like the
- following:</para>
-
-
- <programlisting role="XML"><![CDATA[<xml version="1.0" encoding="UTF-8"?>
-<web-app version="2.4"
- xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
- http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
- ]]></programlisting>
- <para>Next, we have to make some changes to the EJB references
- in the <literal>web.xml</literal>. These changes are
- what will allow Websphere to bind the EJB2 references in
- the web module to the the actual EJB3 beans in the EAR
- module. Replace all of the
- <literal>ejb-local-refs</literal> when the values
- below.</para>
-
-
- <programlisting role="XML"><![CDATA[
- <!-- JEE5 EJB3 names -->
- <ejb-local-ref>
- <ejb-ref-name>jboss-seam-jee5/AuthenticatorAction</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <local-home></local-home>
- <local>org.jboss.seam.example.booking.Authenticator</local>
- </ejb-local-ref>
-
- <ejb-local-ref>
- <ejb-ref-name>jboss-seam-jee5/BookingListAction</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <local-home></local-home>
- <local>org.jboss.seam.example.booking.BookingList</local>
- </ejb-local-ref>
-
- <ejb-local-ref>
- <ejb-ref-name>jboss-seam-jee5/RegisterAction</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <local-home></local-home>
- <local>org.jboss.seam.example.booking.Register</local>
- </ejb-local-ref>
-
- <ejb-local-ref>
- <ejb-ref-name>jboss-seam-jee5/ChangePasswordAction</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <local-home></local-home>
- <local>org.jboss.seam.example.booking.ChangePassword</local>
- </ejb-local-ref>
-
- <ejb-local-ref>
- <ejb-ref-name>jboss-seam-jee5/HotelBookingAction</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <local-home></local-home>
- <local>org.jboss.seam.example.booking.HotelBooking</local>
- </ejb-local-ref>
-
- <ejb-local-ref>
- <ejb-ref-name>jboss-seam-jee5/HotelSearchingAction</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <local-home></local-home>
- <local>org.jboss.seam.example.booking.HotelSAll of the examples and informaearching</local>
- </ejb-local-ref>
-
- <ejb-local-ref>
- <ejb-ref-name>jboss-seam-jee5/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>
- <para>The important change is that there is an empty
- <literal>local-home</literal> element for each EJB.
- This tells Websphere to make the correct bindings between
- the web module and the EJB3 beans. The
- <literal>ejb-link</literal> element is simply not used.
- </para>
- <para>Note also that <literal>EjbSynchronizations</literal> is
- a built-in Seam EJB and not part of the Hotel Booking example. This
- means that if your application's <literal>components.xml</literal>
- specifies <literal>transaction:ejb-transaction</literal>
- , then you must include:</para>
- <programlisting role="XML"><![CDATA[
- <ejb-local-ref>
- <ejb-ref-name>myapp/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>
- <para>in your web.xml. If you don't include it, you'll get the following error:</para>
- <programlisting>Name comp/env/myapp/EjbSynchronizations not found in context java:</programlisting>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <literal>resources/META-INF/persistence.xml</literal>
- </term>
- <listitem>
- <para>For this example we will be using the default
- datasource that comes with Websphere. To do this change the
- <literal>jta-data-source</literal> element:</para>
- <programlisting role="XML"><![CDATA[
-<jta-data-source>DefaultDatasource</jta-data-source>
- ]]></programlisting>
- <para>Then we need to adjust some of the hibernate
- properties. First comment out the Glassfish properties.
- Next you need to add/change the properties:</para>
-
-
- <programlisting role="XML"><![CDATA[
-<!--<property name="hibernate.transaction.flush_before_completion" value="true"/>-->
-<property name="hibernate.cache.provider_class"
- value="org.hibernate.cache.HashtableCacheProvider"/>
-<property name="hibernate.dialect" value="GlassfishDerbyDialect"/>
-<property name="hibernate.transaction.manager_lookup_class"
- value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup"/>
- ]]></programlisting>
- <para>
- <itemizedlist>
- <listitem>
- <para>
- <literal>hibernate.transaction.manager_lookup_class</literal>
- — Standard Hibernate transaction
- manager property for Websphere 6.X</para>
- </listitem>
- <listitem>
- <para>
- <literal>hibernate.transaction.flush_before_completion</literal>
- — This is commented out because we want
- the container to manage the transactions. Also
- if this is set to <literal>true</literal> an
- exception will be thrown by Websphere when the
- EJBContext is looked up.
-
-
- <programlisting><![CDATA[com.ibm.wsspi.injectionengine.InjectionException:
- EJBContext may only be looked up by or injected into an EJB]]></programlisting></para>
- </listitem>
- <listitem>
- <para><literal>hibernate.dialect</literal>
- — From WAS 6.1.0.9 on the embedded DB was
- switched to the same Derby DB in
- Glassfish.</para>
- </listitem>
- </itemizedlist></para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <literal>resources/GlassfishDerbyDialect.class</literal>
- </term>
- <listitem>
- <para>You will need to get the
- <literal>GlassfishDerbyDialect.class</literal> and
- copy it into the <literal>/resources</literal>
- directory. The class exists in the JPA example and can be
- copied using the command below assuming you are in
- <literal>jee5/booking</literal> directory:</para>
-
-
- <programlisting><![CDATA[
-cp ../../jpa/resources-websphere61/WEB-INF/classes/GlassfishDerbyDialect.class
- ./resources]]></programlisting>
- <para>This class will be put into the
- <literal>jboss-seam-jee5.jar</literal> file using
- changes to the build.xml discussed later. </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term> <literal>resources/import.sql</literal>
- </term>
- <listitem>
- <para>This file must also be copied from the JPA example
- because either the Derby DB or the dialect does not support
- changes to the <literal>ID</literal> column. The files
- are identical except for the column difference. Use the
- following command to make the copy
-
-
- <programlisting><![CDATA[
-cp ../../jpa/resources-websphere61/import.sql ./resources]]></programlisting>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
-
- </section>
-
- <section>
- <title>Building the <literal>jee5/booking</literal>
- example</title>
-
- <para>In order to get the changes we have made into our application we
- need to make some changes to the <literal>build.xml</literal>.
- There are also some additional jars that are required by our
- application in order to work with Websphere. This section will cover
- what changes are needed to the <literal>build.xml</literal>.</para>
-
- <section>
- <title>New libraries dependencies</title>
- <para>
- <itemizedlist>
- <listitem>
- <para>JSF libraries — Websphere 6.1 comes with
- its own version of JSF 1.1 (Seam requires JSF 1.2). So
- we must add these jars to our application:
- <itemizedlist>
- <listitem>
- <para><literal>jsf-api.jar</literal>
- </para>
- </listitem>
- <listitem>
- <para><literal>jsf-impl.jar</literal>
- </para>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- <listitem>
- <para>Since Websphere is not a fully compliant
- <literal>JEE5</literal> implementation we need to
- add these EL libraries:
- <itemizedlist>
- <listitem>
- <para><literal>el-api.jar</literal>
- </para>
- </listitem>
- <listitem>
- <para><literal>el-ri.jar</literal>
- </para>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- <listitem>
- <para><literal>jboss-seam.jar</literal> — for
- some reason when deploying the application through
- the Websphere administration console it can not find
- the <literal>jboss-seam.jar</literal> at the base
- of the EAR archive. This means that we need to add it to
- the <literal>/lib</literal> of the EAR.</para>
- </listitem>
- <listitem>
- <para>Finally we remove the <literal>log4j.jar</literal>
- so that all of the log output from our application will
- be added to the Websphere log. Additional steps are
- required to fully configure log4j and those are outside
- of the scope of this document.</para>
- </listitem>
- </itemizedlist> </para>
-
- </section>
-
- <section>
- <title>Updating the <literal>build.xml</literal> file</title>
-
- <para>Add the following entry to the bottom of the
- <literal>build.xml</literal> file. This overrides the
- default fileset that is used to populate the
- <literal>jboss-seam-jee5.jar</literal>. The primary change
- is the addition of the
- <literal>GlassfishDerbyDialect.class</literal>:
- </para>
-
-
- <programlisting role="XML"><![CDATA[
- <fileset id="jar.resources" dir="${resources.dir}">
- <include name="import.sql" />
- <include name="seam.properties" />
- <include name="GlassfishDerbyDialect.class" />
- <include name="META-INF/persistence.xml" />
- <include name="META-INF/ejb-jar.xml" />
- </fileset>]]></programlisting>
-
-
- <para>Next we need to add the library dependencies discussed above.
- For this add the following to bottom of the
- <literal>ear.lib.extras</literal> fileset entry:
- </para>
-
-
- <programlisting role="XML"><![CDATA[
- <!--<include name="lib/log4j.jar" />-->
- <include name="lib/el-api.jar" />
- <include name="examples/jpa/lib/el-ri.jar" />
- <include name="lib/jsf-api.jar" />
- <include name="lib/jsf-impl.jar" />
- <include name="lib/jboss-seam.jar" />
-</fileset>]]></programlisting>
-
-
- <para>Now all that is left is to execute the <literal>ant
- archive</literal> task and the built application will be in
- the <literal>jee5/booking/dist</literal> directory.
- </para>
- </section>
-
- </section>
-
- <section id="jee5-websphere-deploy">
- <title>Deploying the application to Websphere</title>
-
- <para>So now we have everything we need in place. All that is left is to
- deploy it - just a few steps more.</para>
- <para> For this we will use Websphere's administration console. As
- before there are some tricks and tips that must be followed.</para>
-
- <para>The steps below are for the Websphere version stated above, yours
- may be slightly different.
- <orderedlist>
- <listitem>
- <para>Log in to the administration console
-
-
- <programlisting><![CDATA[
-https://localhost:9043/ibm/console]]></programlisting>
- </para>
- </listitem>
- <listitem>
- <para>Access the <literal>Enterprise
- Application</literal> menu option under the
- <literal>Applications</literal> top menu. </para>
- </listitem>
- <listitem>
- <para>At the top of the <literal>Enterprise
- Application</literal> table select
- <literal>Install</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>Next</literal>
- button.</para>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- <listitem>
- <para><literal>Select installation
- options</literal>
- <itemizedlist>
- <listitem>
- <para>Select the <literal>Deploy
- enterprise beans</literal>
- check box. This is needed unless you
- used a Websphere tool to package the
- application. </para>
- </listitem>
- <listitem>
- <para>Select the
- <literal>Next</literal>
- button.</para>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- <listitem>
- <para><literal>Map modules to
- servers</literal>
- <itemizedlist>
- <listitem>
- <para>No changes needed here as we only
- have one server. Select the
- <literal>Next</literal>
- button.</para>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- <listitem>
- <para><literal>Map EJB references to
- beans</literal> This page will list all of the
- beans that we entered in the web.xml.
- <itemizedlist>
- <listitem>
- <para>Make sure that <literal>Allow
- EJB reference targets to resolve
- automatically</literal> check box
- is selected. This will tell
- Websphere to bind our EJB3 beans to
- the EJB references in the web
- module.</para>
- </listitem>
- <listitem>
- <para>Select the
- <literal>Next</literal>
- button.</para>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- <listitem>
- <para><literal>Map virtual hosts for Web
- modules</literal>
- <itemizedlist>
- <listitem>
- <para>No changes needed here. Select
- the <literal>Next</literal>
- button.</para>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- <listitem>
- <para><literal>Summary</literal>
- <itemizedlist>
- <listitem>
- <para>No changes needed here. Select
- the <literal>Finish</literal>
- button.</para>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- <listitem>
- <para><literal>Installation</literal>
- <itemizedlist>
- <listitem>
- <para>Now you will see it installing and
- deploying your
- application.</para>
- </listitem>
- <listitem>
- <para>When if finishes select the
- <literal>Save</literal> link and
- you will be returned to the
- <literal>Enterprise
- Applications</literal>
- table.</para>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- <listitem id="websphere-app-adj-after-install" xreflabel="installation adjustments for jee5 example">
- <para>Now that we have our application installed we need to
- make some adjustments to it before we can start it:
- <itemizedlist>
- <listitem>
- <para>Starting from the <literal>Enterprise
- Applications</literal> table select the
- <literal>Seam Booking</literal>
- link.</para>
- </listitem>
- <listitem>
- <para>Select the <literal>Manage
- Modules</literal> link.</para>
- </listitem>
- <listitem>
- <para>Select the
- <literal>jboss-seam-jee5.war</literal>
- link.</para>
- </listitem>
- <listitem>
- <para>Change the <literal>Class loader
- order</literal> combo box to
- <literal>Classes loaded with application
- class loader first</literal>.</para>
- </listitem>
- <listitem>
- <para>Select <literal>Apply</literal> and then
- <literal>Save</literal> options.</para>
- </listitem>
- <listitem>
- <para>Return the <literal>Seam
- Booking</literal> page.</para>
- </listitem>
- <listitem>
- <para>On this page select the <literal>Class
- loading and update detection</literal>
- link.</para>
- </listitem>
- <listitem>
- <para>Select the radio button for
- <literal>Classes loaded with application
- class loader first</literal>.</para>
- </listitem>
- <listitem>
- <para>Even though we are not enabling class reload
- you must also enter a valid number in the
- <literal>Polling interval for updated
- files</literal> text area (zero works
- fine).</para>
- </listitem>
- <listitem>
- <para>Select <literal>Apply</literal> and then
- <literal>Save</literal> options.</para>
- </listitem>
- <listitem>
- <para>You should verify that the change you just
- made has been remembered. We have had problems with the last
- class loader change not taking effect - even
- after a restart. If the change did not take you
- will need to do it manually, following these
- directions:
- <itemizedlist>
- <listitem>
- <para> Open the following file in a text
- editor of your choice:
-
-
- <programlisting><![CDATA[
-$WebSphereInstall/$yourServerName/profiles/$yourProfileName/config/cells/
- $yourCellName/applications/Seam Booking.ear/deployments/
- Seam Booking/deployment.xml]]></programlisting>
- </para>
- </listitem>
- <listitem>
- <para> Modify the following line so that
- <literal>PARENT_FIRST</literal>
- is now
- <literal>PARENT_LAST</literal>:
-
-
- <programlisting><![CDATA[
-<classloader xmi:id="Classloader_#######" mode="PARENT_FIRST"/>]]></programlisting>
- </para>
- </listitem>
- <listitem>
- <para> Save the file and now when go to the
- <literal>Class loading and update
- detection</literal> page you
- should see <literal>Classes loaded
- with application class loader
- first</literal> selected. </para>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- <listitem>
- <para>To start the application return to the
- <literal>Enterprise Applications</literal> table and
- select our application in the list. Then choose the
- <literal>Start</literal> button at the top of the
- table.</para>
- </listitem>
- <listitem>
- <para>You can now access the application at
- <literal>http://localhost:9080/seam-jee5/</literal>
- .</para>
- </listitem>
- </orderedlist>
- <note>
- <title>A note about Websphere Stateful bean timeouts</title>
- <para>The default timeout period for a Websphere 6.1 Stateful
- EJB is 10 minutes. This means that you may see some EJB timeout
- exceptions after some idle time. It is possible to adjust the
- timeout of the Stateful EJBs on an individual basis, but
- that is beyond the scope of this document. See the Websphere
- documentation for details.
- </para>
- </note>
- </para>
- </section>
-
- </section>
-
- <section>
- <title> The <literal>jpa</literal> booking example </title>
- <para>Thankfully getting the <literal>jpa</literal> example to work is
- much easier than the <literal>jee5</literal> example. 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.</para>
-
- <para> The example already has a breakout of configurations and build
- scripts for many of the common containers including Websphere.</para>
-
- <para>First thing we are going to do is build and deploy that example. Then
- we'll go over some key changes that we needed.</para>
-
- <section>
- <title>Building the <literal>jpa</literal> example</title>
- <para> Building it only requires running the correct ant command:
- <programlisting>ant websphere61</programlisting>
- This will create container specific distribution and exploded
- archive directories with the <literal>websphere61</literal> label.</para>
- </section>
- <section>
- <title>Deploying the <literal>jpa</literal> example</title>
- <para>This is similar to the <literal>jee5</literal> example at
- <xref linkend="jee5-websphere-deploy"/>, but without so many steps.
- </para>
- <itemizedlist>
- <listitem>
- <para>From the <literal>Enterprise Applications</literal> table
- select the <literal>Install</literal> button.
- <itemizedlist>
- <listitem>
- <para><literal>Preparing for the application
- installation</literal>
- <itemizedlist>
- <listitem>
- <para>Browse to the
- <literal>examples/jpa/dist-websphere61/jboss-seam-jpa.war</literal>
- file using the file upload widget.
- </para>
- </listitem>
- <listitem>
- <para>In the <literal>Context root</literal> text box
- enter <literal>jboss-seam-jpa</literal>.
- </para>
- </listitem>
- <listitem>
- <para>Select the <literal>Next</literal> button.
- </para>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- <listitem>
- <para>Select the <literal>Next</literal> button for the next
- three pages, no changes are needed.
- </para>
- </listitem>
- <listitem>
- <para><literal>Summary</literal> page
- <itemizedlist>
- <listitem>
- <para>Review the settings if you wish and select
- the <literal>Finish</literal> button to install
- the application. When installation finished select the <literal>
- Save</literal> link and you will be returned to the
- <literal>Enterprise Applications</literal> table.
- </para>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- </itemizedlist>
- </para>
- </listitem>
- <listitem>
- <para>As with the <literal>jee5</literal> example there are some
- class loader changes needed before we start the application.
- Follow the instructions at <xref linkend="websphere-app-adj-after-install"/>
- but exchange <literal>jboss-seam-jpa</literal> for <literal>Seam Booking</literal>.
- </para>
- </listitem>
- <listitem>
- <para>Finally start the application by selecting it in the
- <literal>Enterprise Applications</literal> table and clicking
- the <literal>Start</literal> button.
- </para>
- </listitem>
- <listitem>
- <para>You can now access the application at the
- <literal>http://localhost:9080/jboss-seam-jpa/index.html</literal>.
- </para>
- </listitem>
- </itemizedlist>
- </section>
-
- <section>
- <title>Whats different for Websphere 6.1</title>
- <para>The differences between the JPA examples that deploys to JBoss
- 4.2 and Websphere 6.1 are mostly expected; library and
- configuration file changes. </para>
- <itemizedlist>
- <listitem>
- <para>Configuration file changes
- <itemizedlist>
- <listitem>
- <para><literal>WEB-INF/web.xml</literal>
- — the only significant change is that
- Websphere 6.1 only support <literal>Servlet
- 2.4</literal> so the top of this file was changed.
- </para>
- </listitem>
- <listitem>
- <para>
- <literal>META-INF/persistence.xml</literal>
- — the main changes here are for the
- datasource JNDI path, switching to the Websphere
- 6.1 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>
- <listitem>
- <para>Changes for dependent libraries</para>
- <para><literal>WEB-INF/lib</literal> — The Websphere
- version requires several library packages because they are
- not included as they are with JBoss AS. These are primarily for
- hibernate, JSF-RI support and their dependencies. Below are
- listed only the additional jars needed above and beyond the JBoss
- <literal>JPA</literal> example.
- <itemizedlist>
- <listitem>
- <para> To use Hibernate as your JPA provider you need
- the following jars:
- <itemizedlist>
- <listitem>
- <simpara>
- <literal>hibernate.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>hibernate-annotations.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>hibernate-commons-annotations.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>hibernate-entitymanager.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>hibernate-validator.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>commons-collections.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>jboss-archive-browsing.jar</literal>
- </simpara>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- <listitem>
- <para>Seam requires JSF 1.2 and these are the jars needed
- for that. Websphere 6.1 ships with its own implementation
- of JSF 1.1.
- <itemizedlist>
- <listitem>
- <simpara>
- <literal>jsf-api.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>jsf-impl.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara> <literal>el-ri.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara> <literal>el-api.jar</literal>
- </simpara>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- <listitem>
- <para>Various third party jars that Websphere needs:
- <itemizedlist>
- <listitem>
- <simpara> <literal>antlr.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara> <literal>cglib.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara> <literal>asm.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara> <literal>dom4j.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>javassist.jar</literal>
- </simpara>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- </itemizedlist> </para>
- </listitem>
- </itemizedlist>
-
- </section>
-
-
- </section>
-
- <section>
- <title>Deploying an application created using
- <literal>seam-gen</literal> on Websphere 6.1.0.13</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.
- As stated above in <xref linkend="jee5-websphere-section"/> there
- are some tricky changes needed to get an EJB3 application running. 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.2.GA]
-[C:/Program Files/jboss-4.2.2.GA]
-/home/jbalunas/jboss/jboss-4.2.2.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 [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:
-/rhdev/projects/jboss-seam/svn-seam_2_0/jboss-seam-2_0/seam-gen/build.properties
- [echo] Installing JDBC driver jar to JBoss server
- [copy] Copying 1 file to /home/jbalunas/jboss/jboss-4.2.2.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>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>websphere_example/resources</literal>
- directory.
-
- <programlisting><![CDATA[
-cp $SEAM/examples/jpa/resources-websphere61/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 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> Websphere does not support <literal>Servlet
- 2.5</literal>, it required <literal>Servlet
- 2.4</literal>. For this change we need to adjust the top of
- the <literal>web.xml</literal> file to look like the
- following:</para>
-
- <programlisting role="XML"><![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
-<web-app version="2.4"
- xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
- http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
- ]]></programlisting>
-
- <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
- 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-home></local-home>
- <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-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"><![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>We need to ge 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"><![CDATA[
-<target name="jar" depends="compile,copyclasses"
- description="Build the distribution .jar file">
- <copy todir="${jar.dir}">
- <fileset dir="${basedir}/resources">
- <include name="seam.properties" />
- <include name="*.drl" />
- <include name="GlassfishDerbyDialect.class" />
- </fileset>
- </copy>
-...]]></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 Websphere
- 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"><![CDATA[
-<fileset dir="${lib.dir}">
- <include name="jboss-seam.jar" />
-</fileset>]]></programlisting>
- <para>So that the whole <literal>archive</literal> task looks
- like:</para>
-
-
- <programlisting role="XML"><![CDATA[
-<target name="archive" depends="jar,war,ear"
- description="Package the archives">
- <jar jarfile="${dist.dir}/${project.name}.jar" basedir="${jar.dir}"/>
- <jar jarfile="${dist.dir}/${project.name}.war" basedir="${war.dir}"/>
- <jar jarfile="${dist.dir}/${project.name}.ear">
- <fileset dir="${ear.dir}"/>
- <fileset dir="${dist.dir}">
- <include name="${project.name}.jar"/>
- <include name="${project.name}.war"/>
- </fileset>
- <fileset dir="${lib.dir}">
- <include name="jboss-seam.jar" />
- </fileset>
- </jar>
-</target>]]></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="${lib.dir}">
- <include name="jboss-seam.jar" />
- </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>JSF dependencies. You will need to copy the
- <literal>el-ri.jar</literal> from the
- <literal>$SEAM/examples/jpa/lib</literal> directory.</para>
- <programlisting role="XML"><![CDATA[
- <!-- jsf libs -->
- <include name="lib/jsf-api.jar" />
- <include name="lib/jsf-impl.jar" />
- <include name="lib/el-api.jar" />
- <include name="lib/el-ri.jar"/>]]></programlisting>
- </listitem>
- <listitem>
- <para> Third party dependencies. You will need to copy the
- <literal>jboss-archive-browsing.jar</literal> from the
- <literal>$SEAM/examples/jpa/lib</literal> directory into the
- the projects <literal>/lib</literal> directory. You will
- also need to acquire the <literal>concurrent.jar</literal>
- and place it in the same directory. You can get this from
- any jboss distribution or just search for it.</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/jboss-archive-browsing.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
- both the <literal>ear</literal> base and
- <literal>/lib</literal>
- 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" />
-
- <!-- jsf libs -->
- <include name="lib/jsf-api.jar" />
- <include name="lib/jsf-impl.jar" />
- <include name="lib/el-api.jar" />
- <include name="lib/el-ri.jar"/>
-
- <!-- 3rd party and supporting jars -->
- <!--<include name="lib/log4j.jar" />-->
- <include name="lib/javassist.jar"/>
- <include name="lib/dom4j.jar" />
- <include name="lib/jboss-archive-browsing.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>
Modified: branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/master.xml
===================================================================
--- branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/master.xml 2008-06-09 13:10:44 UTC (rev 8352)
+++ branches/Seam_2_0_FP/doc/Seam_Reference_Guide/en-US/master.xml 2008-06-09 13:12:16 UTC (rev 8353)
@@ -26,7 +26,6 @@
<xi:include href= "Cache.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href= "Webservices.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href= "Remoting.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href= "Gwt.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href= "Spring.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href= "Hsearch.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href= "Configuration.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
@@ -36,9 +35,6 @@
<xi:include href= "Elenhancements.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href= "Testing.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href= "Tools.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href= "Oc4j.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href= "Weblogic.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href= "Websphere.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href= "Dependencies.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</book>
\ No newline at end of file
More information about the seam-commits
mailing list