Seam SVN: r8170 - in branches/Seam_2_0/examples: jpa and 1 other directory.
by seam-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2008-05-12 15:30:19 -0400 (Mon, 12 May 2008)
New Revision: 8170
Modified:
branches/Seam_2_0/examples/jee5/readme.txt
branches/Seam_2_0/examples/jpa/readme.txt
Log:
Updated based on new reference guide info for Weblogic
Modified: branches/Seam_2_0/examples/jee5/readme.txt
===================================================================
--- branches/Seam_2_0/examples/jee5/readme.txt 2008-05-12 19:27:41 UTC (rev 8169)
+++ branches/Seam_2_0/examples/jee5/readme.txt 2008-05-12 19:30:19 UTC (rev 8170)
@@ -4,7 +4,8 @@
The examples in this directory showcases how to build Java EE 5 compliant Seam
applications. The application should run on all Java EE 5 compliant
application servers with minimal changes in code and configuration files. The
-default build script builds a deployable EAR for Glassfish.
+default build script builds a deployable EAR for Glassfish. See Seam reference
+guide for instructions for other containers.
Glassfish v2
------------
Modified: branches/Seam_2_0/examples/jpa/readme.txt
===================================================================
--- branches/Seam_2_0/examples/jpa/readme.txt 2008-05-12 19:27:41 UTC (rev 8169)
+++ branches/Seam_2_0/examples/jpa/readme.txt 2008-05-12 19:30:19 UTC (rev 8170)
@@ -30,11 +30,13 @@
WebLogic 10.X:
* Install WebLogic 10.X
* Create an hsql datasource called 'seam-jpa-ds" (see reference guide)
+ * Deploy Weblogics jsf-1.2.war shared library for JSF 1.2 support. (see reference guide)
* ant weblogic10
* Start the WebLogic domain you created or the "examples" domain if installed.
* Load the admin console http://localhost:7001/console/
* Deploy dist-weblogic10/jboss-seam-jpa.war
* Access the app at http://localhost:7001/jboss-seam-jpa/
+ * See Weblogic reference guide chapter for full details.
WebSphere 6.1:
16 years, 6 months
Seam SVN: r8169 - in trunk/examples: jpa and 1 other directory.
by seam-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2008-05-12 15:27:41 -0400 (Mon, 12 May 2008)
New Revision: 8169
Modified:
trunk/examples/jee5/readme.txt
trunk/examples/jpa/readme.txt
Log:
Updated based on new reference guide info
Modified: trunk/examples/jee5/readme.txt
===================================================================
--- trunk/examples/jee5/readme.txt 2008-05-12 19:20:19 UTC (rev 8168)
+++ trunk/examples/jee5/readme.txt 2008-05-12 19:27:41 UTC (rev 8169)
@@ -4,7 +4,8 @@
The examples in this directory showcases how to build Java EE 5 compliant Seam
applications. The application should run on all Java EE 5 compliant
application servers with minimal changes in code and configuration files. The
-default build script builds a deployable EAR for Glassfish.
+default build script builds a deployable EAR for Glassfish. See Seam reference
+guide for instructions for other containers.
Glassfish v2
------------
Modified: trunk/examples/jpa/readme.txt
===================================================================
--- trunk/examples/jpa/readme.txt 2008-05-12 19:20:19 UTC (rev 8168)
+++ trunk/examples/jpa/readme.txt 2008-05-12 19:27:41 UTC (rev 8169)
@@ -29,11 +29,13 @@
WebLogic 10.X:
* Install WebLogic 10.X
* Create an hsql datasource called 'seam-jpa-ds" (see reference guide)
+ * Deploy Weblogics jsf-1.2.war shared library for JSF 1.2 support. (see reference guide)
* ant weblogic10
* Start the WebLogic domain you created or the "examples" domain if installed.
* Load the admin console http://localhost:7001/console/
* Deploy dist-weblogic10/jboss-seam-jpa.war
* Access the app at http://localhost:7001/jboss-seam-jpa/
+ * See Weblogic reference guide chapter for full details.
WebSphere 6.1:
16 years, 6 months
Seam SVN: r8168 - in trunk: examples/jpa and 1 other directories.
by seam-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2008-05-12 15:20:19 -0400 (Mon, 12 May 2008)
New Revision: 8168
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Weblogic.xml
trunk/examples/jpa/build-weblogic10.xml
trunk/examples/jpa/resources-weblogic10/WEB-INF/web.xml
trunk/examples/jpa/resources-weblogic10/WEB-INF/weblogic.xml
Log:
JBSEAM-2482, JBSEAM-2592 - Major update to Weblogic reference guide chapter based on updates and changes related to Welogic EJB support. JPA example was also updated for the same reason.
Modified: trunk/doc/Seam_Reference_Guide/en-US/Weblogic.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Weblogic.xml 2008-05-12 19:01:55 UTC (rev 8167)
+++ trunk/doc/Seam_Reference_Guide/en-US/Weblogic.xml 2008-05-12 19:20:19 UTC (rev 8168)
@@ -4,84 +4,94 @@
<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>
+ 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, and what blockers exist. After that the JPA example will
- be modified and deployed to the server. Then finally we will create
+ 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 application. </para>
+ 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>
+ <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">
+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 as
- <literal>varargs</literal> are used. There seems to be no work
- around to this issue in 10.0.MP1. Because of this only the
- <literal>jpa</literal> and WAR based
- <literal>seam-gen</literal> examples work with this version.
- See the <literal>jee5/booking</literal> example for more
- details. </para>
+ 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&...">
+url="http://commerce.bea.com/showproduct.jsp?family=WLS&major=10.3Tech&...">
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). See the
- <literal>jee5/booking</literal> example for more details.
- However if the <literal>varargs</literal> issue is going to get
- fixed it will most likely be an update to this version. </para>
+ 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>
- <para> For the reasons listed above, and the fact that 10.3.TP gets us closer
- to the goal of Seam EJB3 support on Weblogic, 10.3.TP will be used for the
- examples below. </para>
+ <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.3.TP</title>
+ <title>Installing 10.0.MP1</title>
- <para> Here are the quick steps to installing Weblogic 10.3.TP. For more
- details or if you are having any issues please check with the BEA docs
- at the <ulink
- url="http://edocs.bea.com/wls/essex/TechPreview/"> Tech
- Preview Doc Center </ulink> . Here we install the RHEL 5 version using
- the graphical installer: </para>
-
+ <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.3.TP and download the
+ <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>server103tp_XX.bin</literal> file to be
+ <literal>server1001_XX.bin</literal> file to be
executable: </para>
- <programlisting>chmod a+x server103tp_XX.bin</programlisting>
+ <programlisting>chmod a+x server1001_XX.bin</programlisting>
</listitem>
<listitem>
<para> Execute the install: </para>
- <programlisting>./server103tp_XX.bin</programlisting>
+ <programlisting>./server1001_XX.bin</programlisting>
</listitem>
<listitem>
<para> When the graphical install loads, you need to set the BEA
@@ -89,7 +99,7 @@
installed. This location will be known as
<literal>$BEA_HOME</literal> in this document e.g.:
</para>
- <programlisting>/home/jbalunas/bea</programlisting>
+ <programlisting>/jboss/apps/bea</programlisting>
</listitem>
<listitem>
<para> Select <literal>Complete</literal> as the
@@ -100,7 +110,7 @@
<listitem>
<para> Then you need to tell it where to install the server
components: </para>
- <programlisting>$BEA_HOME/wlserver_10.3tp</programlisting>
+ <programlisting>$BEA_HOME/wlserver_10.0</programlisting>
</listitem>
</orderedlist>
</section>
@@ -110,16 +120,16 @@
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>
-
+ wish (modify the instructions as needed). </para>
<orderedlist>
<listitem>
<para> Start up the Weblogic configuration wizard:</para>
- <programlisting>$BEA_HOME/wlserver_10.3tp/common/bin/config.sh</programlisting>
+ <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 TP</literal>. Note that this is
+ <literal>Weblogic Server</literal>. Note that this is
the default domain option. </para>
</listitem>
<listitem>
@@ -142,9 +152,11 @@
</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>
+ <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>
@@ -172,7 +184,7 @@
<orderedlist>
<listitem>
<para> Select
- <literal>seam-examples</literal> on the
+ <literal>seam_examples</literal> on the
left hand side of the console. </para>
</listitem>
<listitem>
@@ -225,95 +237,99 @@
</section>
<section>
- <title> The <literal>jee5/booking</literal> example </title>
+ <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
- blockers that keep it from working. This section describes what changes
- are needed to the <literal>jee5/booking</literal> example to get it as
- close to deploying as possible. First we'll talk about the blockers and
- what they effect.</para>
-
- <section id="weblogic-ejb-blockers">
- <title>EJB Blockers with Weblogic</title>
- <para>For several releases of Weblogic there has been an issue with
- compiling EJB's that use variable arguments in their methods. This
- is confirmed in the Weblogic 9.X and 10.X versions. We had hoped that
- the issue would be resolved in the tech preview release, but it is not.
- Seam uses variable arguments in its internal EJB's and so until this
- is fixed Seam with EJB's will not work.</para>
-
- <para>The gist 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:
-
-
+ <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:
-/home/jbalunas/bea/wlserver_10.3tp/user_projects/domains/seam_examples/servers/AdminServer
+/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)
^
-/home/jbalunas/bea/wlserver_10.3tp/user_projects/domains/seam_examples/servers/AdminServer
+/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>
- BEA says that this is a bug with Java specification. Sun admits the
- issue, and provides a work around, and will not fix the core issue.
-
- <itemizedlist>
- <listitem>
- <para><ulink
- url="http://forums.bea.com/thread.jspa?threadID=300002074">
- BEA forum</ulink> — Discusses the issue and
- suggests waiting for a new release of 10.X</para>
- </listitem>
- <listitem>
- <para><ulink
- url="http://forums.bea.com/thread.jspa?messageID=300006290">
- BEA forum</ulink> — Discusses response from BEA
- support and that BEA is saying it is an issue with the spec
- with links to the bug.</para>
- </listitem>
- <listitem>
- <para><ulink
- url="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6516895">
- Sun bug report </ulink> — Describes details of the
- issue, but says that it will not be fixed.</para>
- </listitem>
- </itemizedlist> So what does that mean to us? At least for now EJB's
- with variable arguments will not run on Weblogic. </para>
-
- <section>
- <title>Secondary issue with the Tech Preview</title>
- <para>A less severe issue is also present in the tech preview version
- of Weblogic. You can not use any JPA provider with EJB's except for
- the default <literal>kodo</literal> or
- <literal>openJPA</literal> implementation. As you set up this
- example you will run into this issue before the
- <literal>varargs</literal> problem. Unfortunately using
- <literal>kodo</literal> or <literal>openJPA</literal> does
- not help with the blocker described above but is important to
- know.</para>
-
- <para>Other users have seen this issue with the tech preview and I
- would hope/expect that it will be fixed in future releases (
- <ulink
- url="http://forums.bea.com/thread.jspa?threadID=300004403">
- BEA Forum</ulink>). The forum entry has the exact stack trace,
- and the response from BEA.</para>
- </section>
+ <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>The <literal>jee5/booking</literal> example</title>
- <para>In this section will will quickly go over the steps needed to get
- the <literal>jee5/booking</literal> example to the point that
- blocker shows itself.</para>
+ <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>
@@ -323,10 +339,11 @@
<orderedlist>
<listitem>
- <para> Copy <literal>hsqldb.jar</literal> to weblogic
+ <para>Copy <literal>hsqldb.jar</literal> to the Weblogic
domain's shared library directory: <literal> cp
- ../../seam-gen/lib/hsqldb.jar
- /home/jbalunas/bea/user_projects/domains/seam_examples/lib</literal>
+ ../../../lib/hsqldb.jar
+ /jboss/apps/bea/user_projects/domains/seam_examples/lib
+ </literal>
</para>
</listitem>
<listitem>
@@ -344,7 +361,7 @@
button in the upper left box.</para>
</listitem>
<listitem>
- <para>Then select button <literal>New</literal>
+ <para>Then select the <literal>New</literal>
button at the top of the data source table</para>
</listitem>
<listitem>
@@ -421,7 +438,7 @@
</listitem>
<listitem>
<para>Leave the rest of the fields
- empty.</para>
+ as is.</para>
</listitem>
<listitem>
<para>Select <literal>Next</literal>
@@ -441,108 +458,459 @@
</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>
+ <literal>
+ resources/META-INF/persistence.xml
+ </literal>
</term>
<listitem>
- <itemizedlist>
- <listitem>
- <para>Because the tech preview version will
- only work with <literal>kodo</literal> or
- <literal>openJPA</literal> as the JPA
- provider you must change the provider to :
- </para>
- <programlisting role="XML"><![CDATA[<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>]]></programlisting>
- </listitem>
- <listitem>
- <para> Next you need to 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>The other properties in the file are
- hibernate specific and are not used by
- <literal>openJPA</literal> but can be
- left in.</para>
- </listitem>
- </itemizedlist>
+ <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>Deploying the Application</title>
- <para>There are some changes needed to the build script and then we
- can attempt to deploy the app.</para>
-
+ <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>
+ <literal>build.xml</literal>
</term>
<listitem>
- <para> Weblogic does not ship with a default JSF
- implementation so we need to add the JSF libraries to
- the WAR. Add the following to the
- <literal>build.xml</literal> and this will add the
- needed jars. 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/jsf-api.jar" />
- <include name="lib/jsf-impl.jar" />
+ <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>Now we can build the application by running <literal>ant
- archive</literal> at the base of the 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
- /home/jbalunas/bea/user_projects/domains/seam_examples/autodeploy</programlisting></para>
-
- <para>Here is where we see the <literal>varargs</literal> issue.
- In the console output you will some Kodo warnings, then
- exceptions and compile errors like the one below.
-
-
- <programlisting><![CDATA[
-<Error> <EJB> <BEA-012036> <Compiling generated EJB classes produced
- the following Java compiler error message:
-/home/jbalunas/bea/user_projects/domains/seam_examples/servers/AdminServer/cache/
-EJBCompilerCache/5yo5dk9ti3yo/org/jboss/seam/async/
-TimerServiceDispatcher_qzt5w2_LocalTimerServiceDispatcherImpl.java:32:
- modifier transient not allowed here
- public transient void scheduleTransactionSuccessEvent(java.lang.String arg0,
- java.lang.Object[] arg1)
- ^
-/home/jbalunas/bea/user_projects/domains/seam_examples/servers/AdminServer/cache/
-EJBCompilerCache/5yo5dk9ti3yo/org/jboss/seam/async/
-TimerServiceDispatcher_qzt5w2_LocalTimerServiceDispatcherImpl.java:113:
- modifier transient not allowed here
- public transient javax.ejb.Timer scheduleAsynchronousEvent(java.lang.String arg0,
- java.lang.Object[] arg1)
+ <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>
-...
-]]></programlisting></para>
-
- <para>This is as far as we can go with Weblogic using EJB's with seam
- until the <literal>varargs</literal> issue is
- resolved.</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>
@@ -558,63 +926,92 @@
<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>
-
+ <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 uses 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.
+
+ <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>
+ <para>
+ DataSource Name:
+ <literal>seam-jpa-ds</literal>
+ </para>
</listitem>
<listitem>
- <para>JNDI Name: <literal>seam-jpa-ds</literal>
- </para>
+ <para>
+ JNDI Name:
+ <literal>seam-jpa-ds</literal>
+ </para>
</listitem>
- </itemizedlist> </para>
+ </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 container specific distribution and exploded
- archive directories.</para>
+
+ <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
- /home/jbalunas/bea/user_projects/domains/seam_examples/autodeploy</programlisting>
-
- <para>Check out the application at the following
+
+ <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>
+ .
+ </para>
</section>
</section>
<section id="weblogic-jpa-diff">
@@ -642,31 +1039,39 @@
with an older version of the
<literal>ANTLR</literal> libraries that
Weblogic 10.x uses internally. OC4J have the same
- issue as well. </para>
+ 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"?>
+ <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 file make Weblogic use classes and
+ <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>
+ file. </para>
-
- <programlisting role="XML"><![CDATA[<property name="hibernate.query.factory_class"
- value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>]]></programlisting>
+ <programlisting role="XML"><![CDATA[
+<property name="hibernate.query.factory_class"
+ value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>]]>
+ </programlisting>
</listitem>
<listitem>
<para>
@@ -675,9 +1080,20 @@
transactions is enabled by adding:</para>
- <programlisting role="XML"><![CDATA[<transaction:entity-transaction entity-manager="#{em}"/>]]></programlisting>
-
+ <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>
@@ -688,24 +1104,20 @@
<listitem>
<para>
<literal>META-INF/persistence.xml</literal>
- — Except for datasource name the WebLogic
+ — 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>
+ <programlisting role="XML"><![CDATA[
+<property name="hibernate.transaction.manager_lookup_class"
+ value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>]]>
+ </programlisting>
</listitem>
<listitem>
- <para><literal>WEB-INF/jboss-web.xml</literal>
- — The JBoss version uses this instead of
- <literal>weblogic.xml</literal></para>
- </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,
- JSF-RI support and their dependencies.
+ and its dependencies.
</para>
<itemizedlist>
<listitem>
@@ -754,27 +1166,8 @@
</simpara>
</listitem>
</itemizedlist>
- </listitem>
+ </listitem>
<listitem>
- <para>Seam requires JSF 1.2 and these are
- jars needed for that. Weblogic 10.3.TP
- does not ship JSF libraries installed by
- default.
- </para>
- <itemizedlist>
- <listitem>
- <simpara>
- <literal>jsf-api.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>jsf-impl.jar</literal>
- </simpara>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
<para>Various third party jars that
Weblogic needs:
</para>
@@ -837,16 +1230,10 @@
files, and adding dependent jars that Weblogic 10.x does not ship
with.</para>
- <para>We still need to live within the constraints imposed to us by
- Weblogic, and because of that this example will generate a
- <literal>WAR</literal> based application instead of an
- <literal>EAR</literal>. See <xref
- linkend="weblogic-ejb-blockers"/> for details.</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>
+ dataSource.</para>
<section>
<title>Running <literal>seam-gen</literal> setup</title>
@@ -857,7 +1244,6 @@
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
@@ -870,7 +1256,7 @@
/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
+/jboss/apps/jboss-4.2.2.GA
[input] Enter the project name [myproject] [myproject]
weblogic-example
[echo] Accepted project name as: weblogic_example
@@ -922,7 +1308,7 @@
[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 /home/jbalunas/jboss/jboss-4.2.2.GA/server/default/lib
+ [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>
@@ -949,10 +1335,11 @@
<itemizedlist>
<listitem>
<para>Change the default target to
- <literal>archive</literal>.
-
+ <literal>archive</literal>.
</para>
- <programlisting role="XML"><![CDATA[<project name="weblogic_example" default="archive" basedir=".">]]></programlisting>
+ <programlisting role="XML">
+<![CDATA[<project name="weblogic_example" default="archive" basedir=".">]]>
+ </programlisting>
</listitem>
</itemizedlist>
</listitem>
@@ -973,14 +1360,21 @@
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>
+ <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>
+ <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"
@@ -988,14 +1382,6 @@
]]></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:/weblogic_exampleEntityManagerFactory">]]></programlisting>
- </listitem>
- <listitem>
<para> You'll need to alter
<literal>persistence-prod.xml</literal>
as well if you want to deploy to Weblogic
@@ -1016,31 +1402,61 @@
</varlistentry>
<varlistentry>
<term>
- <literal>resource/WEB-INF/components.xml</literal>
+ <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>
+ <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>
+ <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>resources/WEB-INF/jboss-app.xml</literal>
+ <literal>resource/WEB-INF/web.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>
+ <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>
@@ -1063,23 +1479,18 @@
<itemizedlist>
<listitem>
- <para>Missing jars — There are two libraries that
+ <para>Missing jar — There is one library that
<literal>seam-gen</literal> does not provide by
- default. These need to be copied into your projects
- <literal>lib</literal> directory manually.
+ 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/jpa/lib</literal>
+ <literal>@SEAM_DIST/examples/wiki/lib</literal>
directory. </para>
</listitem>
- <listitem>
- <para>el-ri.jar — is also found in the
- <literal>@SEAM_DIST/examples/jpa/lib</literal>
- directory. </para>
- </listitem>
</itemizedlist>
</listitem>
<listitem>
@@ -1087,33 +1498,25 @@
<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}">
- <!--JSF implementation -->
- <include name="jsf-api.jar" />
- <include name="jsf-impl.jar" />
-
- <!-- 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" />
-
- <!-- Needed for Drools -->
- <include name="core.jar"/>
- </fileset>
- </copy>]]></programlisting>
+ <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>
@@ -1179,12 +1582,12 @@
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>
-
- <programlisting role="XML">cp ./dist/weblogic_example.war /home/jbalunas/bea/user_projects/domains/seam_examples/autodeploy</programlisting>
<para>Check out the application at the following
- <literal>http://localhost:7001/weblogic_example/</literal>
- .</para>
+ <literal>http://localhost:7001/weblogic_example/</literal>.
+ .</para>
</section>
</section>
</section>
Modified: trunk/examples/jpa/build-weblogic10.xml
===================================================================
--- trunk/examples/jpa/build-weblogic10.xml 2008-05-12 19:01:55 UTC (rev 8167)
+++ trunk/examples/jpa/build-weblogic10.xml 2008-05-12 19:20:19 UTC (rev 8168)
@@ -32,9 +32,6 @@
<include name="lib/commons-digester.jar" />
<include name="lib/commons-collections.jar" />
<include name="lib/commons-logging.jar" />
- <!-- JSF (and related) implementation -->
- <include name="lib/jsf-api.jar" />
- <include name="lib/jsf-impl.jar" />
<!-- Hibernate and deps -->
<include name="lib/hibernate.jar" />
Modified: trunk/examples/jpa/resources-weblogic10/WEB-INF/web.xml
===================================================================
--- trunk/examples/jpa/resources-weblogic10/WEB-INF/web.xml 2008-05-12 19:01:55 UTC (rev 8167)
+++ trunk/examples/jpa/resources-weblogic10/WEB-INF/web.xml 2008-05-12 19:20:19 UTC (rev 8168)
@@ -9,6 +9,10 @@
<listener>
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
</listener>
+
+ <listener>
+ <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+ </listener>
<filter>
<filter-name>Seam Filter</filter-name>
Modified: trunk/examples/jpa/resources-weblogic10/WEB-INF/weblogic.xml
===================================================================
--- trunk/examples/jpa/resources-weblogic10/WEB-INF/weblogic.xml 2008-05-12 19:01:55 UTC (rev 8167)
+++ trunk/examples/jpa/resources-weblogic10/WEB-INF/weblogic.xml 2008-05-12 19:20:19 UTC (rev 8168)
@@ -1,10 +1,14 @@
<?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">
-
-<container-descriptor>
- <prefer-web-inf-classes>true</prefer-web-inf-classes>
-</container-descriptor>
+<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>
16 years, 6 months
Seam SVN: r8167 - in branches/Seam_2_0: examples/jpa and 1 other directories.
by seam-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2008-05-12 15:01:55 -0400 (Mon, 12 May 2008)
New Revision: 8167
Modified:
branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/Weblogic.xml
branches/Seam_2_0/examples/jpa/build-weblogic10.xml
branches/Seam_2_0/examples/jpa/resources-weblogic10/WEB-INF/web.xml
branches/Seam_2_0/examples/jpa/resources-weblogic10/WEB-INF/weblogic.xml
Log:
JBSEAM-2482, JBSEAM-2592 - Major update to Weblogic reference guide chapter based on updates and changes related to Welogic EJB support. JPA example was also updated for the same reason.
Modified: branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/Weblogic.xml
===================================================================
--- branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/Weblogic.xml 2008-05-12 18:06:12 UTC (rev 8166)
+++ branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/Weblogic.xml 2008-05-12 19:01:55 UTC (rev 8167)
@@ -4,84 +4,94 @@
<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>
+ 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, and what blockers exist. After that the JPA example will
- be modified and deployed to the server. Then finally we will create
+ 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 application. </para>
+ 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>
+ <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">
+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 as
- <literal>varargs</literal> are used. There seems to be no work
- around to this issue in 10.0.MP1. Because of this only the
- <literal>jpa</literal> and WAR based
- <literal>seam-gen</literal> examples work with this version.
- See the <literal>jee5/booking</literal> example for more
- details. </para>
+ 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&...">
+url="http://commerce.bea.com/showproduct.jsp?family=WLS&major=10.3Tech&...">
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). See the
- <literal>jee5/booking</literal> example for more details.
- However if the <literal>varargs</literal> issue is going to get
- fixed it will most likely be an update to this version. </para>
+ 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>
- <para> For the reasons listed above, and the fact that 10.3.TP gets us closer
- to the goal of Seam EJB3 support on Weblogic, 10.3.TP will be used for the
- examples below. </para>
+ <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.3.TP</title>
+ <title>Installing 10.0.MP1</title>
- <para> Here are the quick steps to installing Weblogic 10.3.TP. For more
- details or if you are having any issues please check with the BEA docs
- at the <ulink
- url="http://edocs.bea.com/wls/essex/TechPreview/"> Tech
- Preview Doc Center </ulink> . Here we install the RHEL 5 version using
- the graphical installer: </para>
-
+ <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.3.TP and download the
+ <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>server103tp_XX.bin</literal> file to be
+ <literal>server1001_XX.bin</literal> file to be
executable: </para>
- <programlisting>chmod a+x server103tp_XX.bin</programlisting>
+ <programlisting>chmod a+x server1001_XX.bin</programlisting>
</listitem>
<listitem>
<para> Execute the install: </para>
- <programlisting>./server103tp_XX.bin</programlisting>
+ <programlisting>./server1001_XX.bin</programlisting>
</listitem>
<listitem>
<para> When the graphical install loads, you need to set the BEA
@@ -89,7 +99,7 @@
installed. This location will be known as
<literal>$BEA_HOME</literal> in this document e.g.:
</para>
- <programlisting>/home/jbalunas/bea</programlisting>
+ <programlisting>/jboss/apps/bea</programlisting>
</listitem>
<listitem>
<para> Select <literal>Complete</literal> as the
@@ -100,7 +110,7 @@
<listitem>
<para> Then you need to tell it where to install the server
components: </para>
- <programlisting>$BEA_HOME/wlserver_10.3tp</programlisting>
+ <programlisting>$BEA_HOME/wlserver_10.0</programlisting>
</listitem>
</orderedlist>
</section>
@@ -110,16 +120,16 @@
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>
-
+ wish (modify the instructions as needed). </para>
<orderedlist>
<listitem>
<para> Start up the Weblogic configuration wizard:</para>
- <programlisting>$BEA_HOME/wlserver_10.3tp/common/bin/config.sh</programlisting>
+ <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 TP</literal>. Note that this is
+ <literal>Weblogic Server</literal>. Note that this is
the default domain option. </para>
</listitem>
<listitem>
@@ -142,9 +152,11 @@
</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>
+ <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>
@@ -172,7 +184,7 @@
<orderedlist>
<listitem>
<para> Select
- <literal>seam-examples</literal> on the
+ <literal>seam_examples</literal> on the
left hand side of the console. </para>
</listitem>
<listitem>
@@ -225,95 +237,99 @@
</section>
<section>
- <title> The <literal>jee5/booking</literal> example </title>
+ <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
- blockers that keep it from working. This section describes what changes
- are needed to the <literal>jee5/booking</literal> example to get it as
- close to deploying as possible. First we'll talk about the blockers and
- what they effect.</para>
-
- <section id="weblogic-ejb-blockers">
- <title>EJB Blockers with Weblogic</title>
- <para>For several releases of Weblogic there has been an issue with
- compiling EJB's that use variable arguments in their methods. This
- is confirmed in the Weblogic 9.X and 10.X versions. We had hoped that
- the issue would be resolved in the tech preview release, but it is not.
- Seam uses variable arguments in its internal EJB's and so until this
- is fixed Seam with EJB's will not work.</para>
-
- <para>The gist 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:
-
-
+ <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:
-/home/jbalunas/bea/wlserver_10.3tp/user_projects/domains/seam_examples/servers/AdminServer
+/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)
^
-/home/jbalunas/bea/wlserver_10.3tp/user_projects/domains/seam_examples/servers/AdminServer
+/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>
- BEA says that this is a bug with Java specification. Sun admits the
- issue, and provides a work around, and will not fix the core issue.
-
- <itemizedlist>
- <listitem>
- <para><ulink
- url="http://forums.bea.com/thread.jspa?threadID=300002074">
- BEA forum</ulink> — Discusses the issue and
- suggests waiting for a new release of 10.X</para>
- </listitem>
- <listitem>
- <para><ulink
- url="http://forums.bea.com/thread.jspa?messageID=300006290">
- BEA forum</ulink> — Discusses response from BEA
- support and that BEA is saying it is an issue with the spec
- with links to the bug.</para>
- </listitem>
- <listitem>
- <para><ulink
- url="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6516895">
- Sun bug report </ulink> — Describes details of the
- issue, but says that it will not be fixed.</para>
- </listitem>
- </itemizedlist> So what does that mean to us? At least for now EJB's
- with variable arguments will not run on Weblogic. </para>
-
- <section>
- <title>Secondary issue with the Tech Preview</title>
- <para>A less severe issue is also present in the tech preview version
- of Weblogic. You can not use any JPA provider with EJB's except for
- the default <literal>kodo</literal> or
- <literal>openJPA</literal> implementation. As you set up this
- example you will run into this issue before the
- <literal>varargs</literal> problem. Unfortunately using
- <literal>kodo</literal> or <literal>openJPA</literal> does
- not help with the blocker described above but is important to
- know.</para>
-
- <para>Other users have seen this issue with the tech preview and I
- would hope/expect that it will be fixed in future releases (
- <ulink
- url="http://forums.bea.com/thread.jspa?threadID=300004403">
- BEA Forum</ulink>). The forum entry has the exact stack trace,
- and the response from BEA.</para>
- </section>
+ <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>The <literal>jee5/booking</literal> example</title>
- <para>In this section will will quickly go over the steps needed to get
- the <literal>jee5/booking</literal> example to the point that
- blocker shows itself.</para>
+ <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>
@@ -323,10 +339,11 @@
<orderedlist>
<listitem>
- <para> Copy <literal>hsqldb.jar</literal> to weblogic
+ <para>Copy <literal>hsqldb.jar</literal> to the Weblogic
domain's shared library directory: <literal> cp
- ../../seam-gen/lib/hsqldb.jar
- /home/jbalunas/bea/user_projects/domains/seam_examples/lib</literal>
+ ../../../lib/hsqldb.jar
+ /jboss/apps/bea/user_projects/domains/seam_examples/lib
+ </literal>
</para>
</listitem>
<listitem>
@@ -344,7 +361,7 @@
button in the upper left box.</para>
</listitem>
<listitem>
- <para>Then select button <literal>New</literal>
+ <para>Then select the <literal>New</literal>
button at the top of the data source table</para>
</listitem>
<listitem>
@@ -421,7 +438,7 @@
</listitem>
<listitem>
<para>Leave the rest of the fields
- empty.</para>
+ as is.</para>
</listitem>
<listitem>
<para>Select <literal>Next</literal>
@@ -441,108 +458,459 @@
</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>
+ <literal>
+ resources/META-INF/persistence.xml
+ </literal>
</term>
<listitem>
- <itemizedlist>
- <listitem>
- <para>Because the tech preview version will
- only work with <literal>kodo</literal> or
- <literal>openJPA</literal> as the JPA
- provider you must change the provider to :
- </para>
- <programlisting role="XML"><![CDATA[<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>]]></programlisting>
- </listitem>
- <listitem>
- <para> Next you need to 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>The other properties in the file are
- hibernate specific and are not used by
- <literal>openJPA</literal> but can be
- left in.</para>
- </listitem>
- </itemizedlist>
+ <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>Deploying the Application</title>
- <para>There are some changes needed to the build script and then we
- can attempt to deploy the app.</para>
-
+ <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>
+ <literal>build.xml</literal>
</term>
<listitem>
- <para> Weblogic does not ship with a default JSF
- implementation so we need to add the JSF libraries to
- the WAR. Add the following to the
- <literal>build.xml</literal> and this will add the
- needed jars. 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/jsf-api.jar" />
- <include name="lib/jsf-impl.jar" />
+ <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>Now we can build the application by running <literal>ant
- archive</literal> at the base of the 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
- /home/jbalunas/bea/user_projects/domains/seam_examples/autodeploy</programlisting></para>
-
- <para>Here is where we see the <literal>varargs</literal> issue.
- In the console output you will some Kodo warnings, then
- exceptions and compile errors like the one below.
-
-
- <programlisting><![CDATA[
-<Error> <EJB> <BEA-012036> <Compiling generated EJB classes produced
- the following Java compiler error message:
-/home/jbalunas/bea/user_projects/domains/seam_examples/servers/AdminServer/cache/
-EJBCompilerCache/5yo5dk9ti3yo/org/jboss/seam/async/
-TimerServiceDispatcher_qzt5w2_LocalTimerServiceDispatcherImpl.java:32:
- modifier transient not allowed here
- public transient void scheduleTransactionSuccessEvent(java.lang.String arg0,
- java.lang.Object[] arg1)
- ^
-/home/jbalunas/bea/user_projects/domains/seam_examples/servers/AdminServer/cache/
-EJBCompilerCache/5yo5dk9ti3yo/org/jboss/seam/async/
-TimerServiceDispatcher_qzt5w2_LocalTimerServiceDispatcherImpl.java:113:
- modifier transient not allowed here
- public transient javax.ejb.Timer scheduleAsynchronousEvent(java.lang.String arg0,
- java.lang.Object[] arg1)
+ <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>
-...
-]]></programlisting></para>
-
- <para>This is as far as we can go with Weblogic using EJB's with seam
- until the <literal>varargs</literal> issue is
- resolved.</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>
@@ -558,63 +926,92 @@
<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>
-
+ <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 uses 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.
+
+ <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>
+ <para>
+ DataSource Name:
+ <literal>seam-jpa-ds</literal>
+ </para>
</listitem>
<listitem>
- <para>JNDI Name: <literal>seam-jpa-ds</literal>
- </para>
+ <para>
+ JNDI Name:
+ <literal>seam-jpa-ds</literal>
+ </para>
</listitem>
- </itemizedlist> </para>
+ </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 container specific distribution and exploded
- archive directories.</para>
+
+ <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
- /home/jbalunas/bea/user_projects/domains/seam_examples/autodeploy</programlisting>
-
- <para>Check out the application at the following
+
+ <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>
+ .
+ </para>
</section>
</section>
<section id="weblogic-jpa-diff">
@@ -642,31 +1039,39 @@
with an older version of the
<literal>ANTLR</literal> libraries that
Weblogic 10.x uses internally. OC4J have the same
- issue as well. </para>
+ 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"?>
+ <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 file make Weblogic use classes and
+ <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>
+ file. </para>
-
- <programlisting role="XML"><![CDATA[<property name="hibernate.query.factory_class"
- value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>]]></programlisting>
+ <programlisting role="XML"><![CDATA[
+<property name="hibernate.query.factory_class"
+ value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>]]>
+ </programlisting>
</listitem>
<listitem>
<para>
@@ -675,9 +1080,20 @@
transactions is enabled by adding:</para>
- <programlisting role="XML"><![CDATA[<transaction:entity-transaction entity-manager="#{em}"/>]]></programlisting>
-
+ <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>
@@ -688,24 +1104,20 @@
<listitem>
<para>
<literal>META-INF/persistence.xml</literal>
- — Except for datasource name the WebLogic
+ — 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>
+ <programlisting role="XML"><![CDATA[
+<property name="hibernate.transaction.manager_lookup_class"
+ value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>]]>
+ </programlisting>
</listitem>
<listitem>
- <para><literal>WEB-INF/jboss-web.xml</literal>
- — The JBoss version uses this instead of
- <literal>weblogic.xml</literal></para>
- </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,
- JSF-RI support and their dependencies.
+ and its dependencies.
</para>
<itemizedlist>
<listitem>
@@ -754,27 +1166,8 @@
</simpara>
</listitem>
</itemizedlist>
- </listitem>
+ </listitem>
<listitem>
- <para>Seam requires JSF 1.2 and these are
- jars needed for that. Weblogic 10.3.TP
- does not ship JSF libraries installed by
- default.
- </para>
- <itemizedlist>
- <listitem>
- <simpara>
- <literal>jsf-api.jar</literal>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <literal>jsf-impl.jar</literal>
- </simpara>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
<para>Various third party jars that
Weblogic needs:
</para>
@@ -837,16 +1230,10 @@
files, and adding dependent jars that Weblogic 10.x does not ship
with.</para>
- <para>We still need to live within the constraints imposed to us by
- Weblogic, and because of that this example will generate a
- <literal>WAR</literal> based application instead of an
- <literal>EAR</literal>. See <xref
- linkend="weblogic-ejb-blockers"/> for details.</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>
+ dataSource.</para>
<section>
<title>Running <literal>seam-gen</literal> setup</title>
@@ -857,7 +1244,6 @@
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
@@ -870,7 +1256,7 @@
/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
+/jboss/apps/jboss-4.2.2.GA
[input] Enter the project name [myproject] [myproject]
weblogic-example
[echo] Accepted project name as: weblogic_example
@@ -922,7 +1308,7 @@
[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 /home/jbalunas/jboss/jboss-4.2.2.GA/server/default/lib
+ [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>
@@ -949,10 +1335,11 @@
<itemizedlist>
<listitem>
<para>Change the default target to
- <literal>archive</literal>.
-
+ <literal>archive</literal>.
</para>
- <programlisting role="XML"><![CDATA[<project name="weblogic_example" default="archive" basedir=".">]]></programlisting>
+ <programlisting role="XML">
+<![CDATA[<project name="weblogic_example" default="archive" basedir=".">]]>
+ </programlisting>
</listitem>
</itemizedlist>
</listitem>
@@ -973,14 +1360,21 @@
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>
+ <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>
+ <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"
@@ -988,14 +1382,6 @@
]]></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:/weblogic_exampleEntityManagerFactory">]]></programlisting>
- </listitem>
- <listitem>
<para> You'll need to alter
<literal>persistence-prod.xml</literal>
as well if you want to deploy to Weblogic
@@ -1016,31 +1402,61 @@
</varlistentry>
<varlistentry>
<term>
- <literal>resource/WEB-INF/components.xml</literal>
+ <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>
+ <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>
+ <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>resources/WEB-INF/jboss-app.xml</literal>
+ <literal>resource/WEB-INF/web.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>
+ <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>
@@ -1063,23 +1479,18 @@
<itemizedlist>
<listitem>
- <para>Missing jars — There are two libraries that
+ <para>Missing jar — There is one library that
<literal>seam-gen</literal> does not provide by
- default. These need to be copied into your projects
- <literal>lib</literal> directory manually.
+ 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/jpa/lib</literal>
+ <literal>@SEAM_DIST/examples/wiki/lib</literal>
directory. </para>
</listitem>
- <listitem>
- <para>el-ri.jar — is also found in the
- <literal>@SEAM_DIST/examples/jpa/lib</literal>
- directory. </para>
- </listitem>
</itemizedlist>
</listitem>
<listitem>
@@ -1087,33 +1498,25 @@
<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}">
- <!--JSF implementation -->
- <include name="jsf-api.jar" />
- <include name="jsf-impl.jar" />
-
- <!-- 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" />
-
- <!-- Needed for Drools -->
- <include name="core.jar"/>
- </fileset>
- </copy>]]></programlisting>
+ <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>
@@ -1179,12 +1582,12 @@
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>
-
- <programlisting role="XML">cp ./dist/weblogic_example.war /home/jbalunas/bea/user_projects/domains/seam_examples/autodeploy</programlisting>
<para>Check out the application at the following
- <literal>http://localhost:7001/weblogic_example/</literal>
- .</para>
+ <literal>http://localhost:7001/weblogic_example/</literal>.
+ .</para>
</section>
</section>
</section>
Modified: branches/Seam_2_0/examples/jpa/build-weblogic10.xml
===================================================================
--- branches/Seam_2_0/examples/jpa/build-weblogic10.xml 2008-05-12 18:06:12 UTC (rev 8166)
+++ branches/Seam_2_0/examples/jpa/build-weblogic10.xml 2008-05-12 19:01:55 UTC (rev 8167)
@@ -32,9 +32,6 @@
<include name="lib/commons-digester.jar" />
<include name="lib/commons-collections.jar" />
<include name="lib/commons-logging.jar" />
- <!-- JSF (and related) implementation -->
- <include name="lib/jsf-api.jar" />
- <include name="lib/jsf-impl.jar" />
<!-- Hibernate and deps -->
<include name="lib/hibernate.jar" />
Modified: branches/Seam_2_0/examples/jpa/resources-weblogic10/WEB-INF/web.xml
===================================================================
--- branches/Seam_2_0/examples/jpa/resources-weblogic10/WEB-INF/web.xml 2008-05-12 18:06:12 UTC (rev 8166)
+++ branches/Seam_2_0/examples/jpa/resources-weblogic10/WEB-INF/web.xml 2008-05-12 19:01:55 UTC (rev 8167)
@@ -9,6 +9,10 @@
<listener>
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
</listener>
+
+ <listener>
+ <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+ </listener>
<filter>
<filter-name>Seam Filter</filter-name>
Modified: branches/Seam_2_0/examples/jpa/resources-weblogic10/WEB-INF/weblogic.xml
===================================================================
--- branches/Seam_2_0/examples/jpa/resources-weblogic10/WEB-INF/weblogic.xml 2008-05-12 18:06:12 UTC (rev 8166)
+++ branches/Seam_2_0/examples/jpa/resources-weblogic10/WEB-INF/weblogic.xml 2008-05-12 19:01:55 UTC (rev 8167)
@@ -1,10 +1,14 @@
<?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">
-
-<container-descriptor>
- <prefer-web-inf-classes>true</prefer-web-inf-classes>
-</container-descriptor>
+<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>
16 years, 6 months
Seam SVN: r8166 - branches/Seam_2_0/seam-gen/icefaces/view.
by seam-commits@lists.jboss.org
Author: jguglielmin
Date: 2008-05-12 14:06:12 -0400 (Mon, 12 May 2008)
New Revision: 8166
Modified:
branches/Seam_2_0/seam-gen/icefaces/view/home.xhtml
Log:
take out reference to version numbers of ICEfaces and Seam from home page
Modified: branches/Seam_2_0/seam-gen/icefaces/view/home.xhtml
===================================================================
--- branches/Seam_2_0/seam-gen/icefaces/view/home.xhtml 2008-05-12 18:05:19 UTC (rev 8165)
+++ branches/Seam_2_0/seam-gen/icefaces/view/home.xhtml 2008-05-12 18:06:12 UTC (rev 8166)
@@ -5,7 +5,7 @@
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
- xmlns:ice="http://www.icesoft.com/icefaces/component"
+ xmlns:ice="http://www.icesoft.com/icefaces/component"
template="layout/template.xhtml">
<ui:define name="body">
@@ -15,7 +15,7 @@
<ice:panelGrid id="homePanelGrid" columns="2" columnClasses="leftMenu,leftMenu">
<img src="img/ICEfaces-logo.gif" alt="Icefaces and Seam: framework demo"/>
<ice:panelGroup id="homePanelGroup">
- <p>This ICEfaces 1.6.1 + Seam 2.0.0 enabled Application includes:</p>
+ <p>This ICEfaces and Seam enabled Application includes:</p>
<ul>
<li>Ant build script</li>
<li>Deployment to JBoss AS (EAR or WAR)</li>
@@ -25,7 +25,7 @@
<li>JPA entity classes</li>
<li>A configurable DataSource and JPA EntityManager</li>
<li>Templated Facelets views</li>
- <li>ICEFaces panels and tables</li>
+ <li>ICEFaces panels and tables with resizable columns</li>
<li>Default CSS stylesheet</li>
<li>Internationalization support</li>
</ul>
16 years, 6 months
Seam SVN: r8165 - branches/Seam_2_0/seam-gen/icefaces/build-scripts.
by seam-commits@lists.jboss.org
Author: jguglielmin
Date: 2008-05-12 14:05:19 -0400 (Mon, 12 May 2008)
New Revision: 8165
Modified:
branches/Seam_2_0/seam-gen/icefaces/build-scripts/deployed-jars-ear.list
branches/Seam_2_0/seam-gen/icefaces/build-scripts/deployed-jars-war.list
Log:
JBSEAM-2936 ....updated lists to reflect mvel14.jar (was not done for the icefaces build)
Modified: branches/Seam_2_0/seam-gen/icefaces/build-scripts/deployed-jars-ear.list
===================================================================
--- branches/Seam_2_0/seam-gen/icefaces/build-scripts/deployed-jars-ear.list 2008-05-12 14:55:32 UTC (rev 8164)
+++ branches/Seam_2_0/seam-gen/icefaces/build-scripts/deployed-jars-ear.list 2008-05-12 18:05:19 UTC (rev 8165)
@@ -1,14 +1,14 @@
-antlr-runtime.jar
-backport-util-concurrent.jar
-commons-digester.jar
-commons-fileupload.jar
-core.jar
-drools-compiler.jar
-drools-core.jar
-icefaces.jar
-icefaces-comps.jar
-icefaces-facelets.jar
-janino.jar
-jboss-el.jar
-jbpm-jpdl.jar
-mvel.jar
+antlr-runtime.jar
+backport-util-concurrent.jar
+commons-digester.jar
+commons-fileupload.jar
+core.jar
+drools-compiler.jar
+drools-core.jar
+icefaces.jar
+icefaces-comps.jar
+icefaces-facelets.jar
+janino.jar
+jboss-el.jar
+jbpm-jpdl.jar
+mvel14.jar
Modified: branches/Seam_2_0/seam-gen/icefaces/build-scripts/deployed-jars-war.list
===================================================================
--- branches/Seam_2_0/seam-gen/icefaces/build-scripts/deployed-jars-war.list 2008-05-12 14:55:32 UTC (rev 8164)
+++ branches/Seam_2_0/seam-gen/icefaces/build-scripts/deployed-jars-war.list 2008-05-12 18:05:19 UTC (rev 8165)
@@ -1,17 +1,17 @@
-antlr-runtime.jar
-backport-util-concurrent.jar
-commons-beanutils.jar
-commons-digester.jar
-commons-fileupload.jar
-core.jar
-drools-compiler.jar
-drools-core.jar
-icefaces.jar
-icefaces-comps.jar
-icefaces-facelets.jar
-janino.jar
-jboss-el.jar
-jboss-seam.jar
-jboss-seam-*.jar
-jbpm-jpdl.jar
-mvel.jar
+antlr-runtime.jar
+backport-util-concurrent.jar
+commons-beanutils.jar
+commons-digester.jar
+commons-fileupload.jar
+core.jar
+drools-compiler.jar
+drools-core.jar
+icefaces.jar
+icefaces-comps.jar
+icefaces-facelets.jar
+janino.jar
+jboss-el.jar
+jboss-seam.jar
+jboss-seam-*.jar
+jbpm-jpdl.jar
+mvel14.jar
16 years, 6 months
Seam SVN: r8164 - trunk/examples/seamspace/src/org/jboss/seam/example/seamspace.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-05-12 10:55:32 -0400 (Mon, 12 May 2008)
New Revision: 8164
Modified:
trunk/examples/seamspace/src/org/jboss/seam/example/seamspace/PictureAction.java
Log:
fixed LIE
Modified: trunk/examples/seamspace/src/org/jboss/seam/example/seamspace/PictureAction.java
===================================================================
--- trunk/examples/seamspace/src/org/jboss/seam/example/seamspace/PictureAction.java 2008-05-12 14:39:34 UTC (rev 8163)
+++ trunk/examples/seamspace/src/org/jboss/seam/example/seamspace/PictureAction.java 2008-05-12 14:55:32 UTC (rev 8164)
@@ -25,11 +25,11 @@
public void uploadPicture()
{
memberImage = new MemberImage();
- memberImage.setMember(authenticatedMember);
}
public void savePicture()
{
+ memberImage.setMember(entityManager.find(Member.class, authenticatedMember.getMemberId()));
entityManager.persist(memberImage);
Conversation.instance().end();
}
16 years, 6 months
Seam SVN: r8163 - branches/Seam_2_0/examples/seambay/view.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-05-12 10:39:34 -0400 (Mon, 12 May 2008)
New Revision: 8163
Modified:
branches/Seam_2_0/examples/seambay/view/test.xhtml
Log:
JBSEAM-2957
Modified: branches/Seam_2_0/examples/seambay/view/test.xhtml
===================================================================
--- branches/Seam_2_0/examples/seambay/view/test.xhtml 2008-05-12 11:35:45 UTC (rev 8162)
+++ branches/Seam_2_0/examples/seambay/view/test.xhtml 2008-05-12 14:39:34 UTC (rev 8163)
@@ -30,7 +30,7 @@
<div>
Endpoint:
- <input id="endpoint" type="text" value="/AuctionServiceService/AuctionService" style="width:400px"/>
+ <input id="endpoint" type="text" value="/jboss-seam-bay-jboss-seam-bay/AuctionService" style="width:400px"/>
</div>
<div>
16 years, 6 months
Seam SVN: r8162 - trunk/doc/Seam_Reference_Guide/en-US and 1 other directory.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-05-12 07:35:45 -0400 (Mon, 12 May 2008)
New Revision: 8162
Modified:
branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/I18n.xml
trunk/doc/Seam_Reference_Guide/en-US/I18n.xml
Log:
Corrections for i8n chapter and port to trunk
Modified: branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/I18n.xml
===================================================================
--- branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/I18n.xml 2008-05-12 10:34:47 UTC (rev 8161)
+++ branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/I18n.xml 2008-05-12 11:35:45 UTC (rev 8162)
@@ -2,106 +2,127 @@
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
<chapter id="i18n">
- <title>Internationalization, localization and themes</title>
+ <title>Internationalization, localization and themes</title>
- <para>Seam makes it easy to build internationalized applications. First,
- let's walk through all the stages needed to internationalize and localize
- your app. Then we'll take a look at the components Seam bundles.</para>
+ <para>
+ Seam makes it easy to build internationalized applications. First, let's
+ walk through all the stages needed to internationalize and localize your
+ app. Then we'll take a look at the components Seam bundles.
+ </para>
- <section>
- <title>Internationalizing your app</title>
+ <section>
+ <title>Internationalizing your app</title>
- <para>JEE application is consisting from many components and all can break
- the whole view on the localizated target.</para>
+ <para>
+ A JEE application consists of many components and all of them must be
+ configured properly for your application to be localized.
+ </para>
- <para>Starting at the bottom, the first step is to ensure that your
- database server and client is using the correct character encoding for
- your locale. Normally you'll want to use UTF-8. How to do this is outside
- the scope of this tutorial.</para>
+ <para>
+ Starting at the bottom, the first step is to ensure that your database
+ server and client is using the correct character encoding for your
+ locale. Normally you'll want to use UTF-8. How to do this is outside
+ the scope of this tutorial.
+ </para>
- <section>
- <title>Application server configuration</title>
+ <section>
+ <title>Application server configuration</title>
- <para>To ensure that application server receive correct parameters
- attributes from client requests you have to adapt the configuration of
- tomcat connector. If you use Tomcat or JBOSS AS, add attribute
- <code>URIEncoding="UTF-8"</code> into connector configuration. In case
- JBOSS AS 4.2.2 change
- <code>${JBOSS_HOME}/server/(default)/deploy/jboss-web.deployer/server.xml</code>
- configuration file like the following:</para>
+ <para>
+ To ensure that the application server receives the request
+ parameters in the correct encoding from client requests you have to
+ configure the tomcat connector. If you use Tomcat or JBoss AS, add
+ the <literal>URIEncoding="UTF-8"</literal> attribute to the
+ connector configuration. For JBoss AS 4.2 change
+ <literal>${JBOSS_HOME}/server/(default)/deploy/jboss-web.deployer/server.xml</literal>:
+ </para>
- <programlisting><Connector port="8080" URIEncoding="UTF-8"/></programlisting>
+ <programlisting role="XML"><Connector port="8080" URIEncoding="UTF-8"/></programlisting>
- <para>There is also another configuration atribute
- <code>useBodyEncodingForURI</code>, which is logically better for use,
- because it says that encoding for URI will be taken from setting of web
- page body. In other words the encoding of the parameters in URL will be
- same as the content of the web page. Example of configuration is the
- following:</para>
+ <para>
+ There is alternative which is probably better. You can tell JBoss AS
+ that the encoding for the request parameters will be taken from the
+ request:
+ </para>
- <programlisting><Connector port="8080" useBodyEncodingForURI="true"/></programlisting>
- </section>
+ <programlisting role="XML"><Connector port="8080" useBodyEncodingForURI="true"/></programlisting>
+ </section>
- <section>
- <title>Translated application strings</title>
+ <section>
+ <title>Translated application strings</title>
- <para>Correct localized application uses for all static texts in JSF
- pages labels, which can be translated and loaded from resource bundles
- with defined labels. First you need to ensure that your resource bundle
- is encoded using the desired character encoding. By default it uses
- ISO-8859-1. Although ISO-8859-1 supports many languages, it doesn't
- represent everything. So if you want to translate in another langugage,
- which uses characters outside the standard ASCII set, you need to use
- encoding which covers all these non-ascii characters.</para>
+ <para>
+ You'll also need localized strings for all the <emphasis>messages</emphasis>
+ in your application (for example field labels on your views). First
+ you need to ensure that your resource bundle is encoded using the
+ desired character encoding. By default ASCII is used. Although ASCII
+ is enough for many languages, it doesn't provide characters for all
+ languages.
+ </para>
- <para>You'll need to understand another caveat regarding property
- bundles; you must create them in ASCII, or use Unicode escape codes to
- represent Unicode characters. Since you don't compile a property file to
- byte codes, there is no way to tell the JVM which character set to use.
- So you must explicitly use ASCII characters or use the escape sequences.
- You can represent a Unicode character in any Java file using \uXXXX,
- where XXXX is the hexidecimal representation of the character. Write
- your translation of labels (see below section <link
- linkend="labels">Labels</link>) to file and then you have to convert the
- content of file into escaped format through the java command tool
- native2ascii provided in the JDK. This tool will convert a file written
- in your native encoding to one that represents non-ASCII characters as
- Unicode escape sequences.</para>
+ <para>
+ Resource bundles must be created in ASCII, or use Unicode escape
+ codes to represent Unicode characters. Since you don't compile a
+ property file to byte code, there is no way to tell the JVM which
+ character set to use. So you must use either ASCII characters or
+ escape characters not in the ASCII character set.
+ You can represent a Unicode character in any Java file using \uXXXX,
+ where XXXX is the hexidecimal representation of the character.
+ </para>
+
+ <para>
+ You can write your translation of labels
+ (<xlink linkend="labels">Labels</xlink>) to your messages resource
+ bundle in the native encoding and then convert the content of the
+ file into the escaped format through the tool <literal>native2ascii</literal>
+ provided in the JDK. This tool will convert a file written in your
+ native encoding to one that represents non-ASCII characters as
+ Unicode escape sequences.
+ </para>
- <para>Usage of this tool is described at <ulink
- url="http://java.sun.com/j2se/1.5.0/docs/tooldocs/index.html#intl">http://java.sun.com/j2se/1.5.0/docs/tooldocs/index.html#intl</ulink>
- for Java 5 or at <ulink
- url="http://java.sun.com/javase/6/docs/technotes/tools/#intl">http://java.sun.com/javase/6/docs/technotes/tools/#intl</ulink>
- for Java 6, but briefly, on command line write:<programlisting><code><prompt>$ native2ascii -encoding UTF-8 messages_cs.properties > messages_cs_escaped.properties</prompt></code></programlisting>Then
- converted file can be used in application as resource bundle with a
- proper locale code (see <link linkend="labels">Labels</link>).</para>
- </section>
+ <para>
+ Usage of this tool is described
+ <ulink url="http://java.sun.com/j2se/1.5.0/docs/tooldocs/index.html#intl">here for Java 5</ulink>
+ or
+ <ulink url="http://java.sun.com/javase/6/docs/technotes/tools/#intl">here for Java 6</ulink>.
+ For example, to convert a file from UTF-8:
+ </para>
+
+ <programlisting><prompt>$ native2ascii -encoding UTF-8 messages_cs.properties > messages_cs_escaped.properties</prompt></programlisting>
+
+ </section>
- <section>
- <title>Other encoding settings</title>
+ <section>
+ <title>Other encoding settings</title>
- <para>We need to make sure that the view (JSF, JSP or XHTML) displays
- your correct localized data and messages using the correct character set
- and also any data submitted uses the correct encoding.</para>
+ <para>
+ We need to make sure that the view displays your localized data and
+ messages using the correct character set and also any data submitted
+ uses the correct encoding.
+ </para>
- <para>To set the display character encoding, you need to use the
- <literal><f:view locale="cs_CZ"/></literal> tag for example to use
- Czech locale in Java Server Faces technology. You may want to change the
- encoding of the xml document itself if you want to embed localized
- strings in the xml. To do this alter the encoding attribute in xml
- declaration <literal><?xml version="1.0"
- encoding="UTF-8"?></literal> as required.</para>
+ <para>
+ To set the display character encoding, you need to use the
+ <literal><f:view locale="cs_CZ"/></literal> tag (here we tell
+ JSF to use the Czech locale). You may want to change the encoding of
+ the xml document itself if you want to embed localized strings in the
+ xml. To do this alter the encoding attribute in xml declaration
+ <literal><?xml version="1.0" encoding="UTF-8"?></literal> as
+ required.
+ </para>
- <para>Also JSF/Facelets should submit any requests in the desired
- character, but to make sure any requests that don't specify an encoding
- you can use a Servlet filter to set it in Seam components.xml
- configuration file:</para>
+ <para>
+ Also JSF/Facelets should submit any requests using the specified
+ character encoding, but to make sure any requests that don't specify
+ an encoding you can force the request encoding using a servlet
+ filter. Configure this in <literal>components.xml</literal>:
+ </para>
- <programlisting role="XML"><web:character-encoding-filter encoding="UTF-8"
+ <programlisting role="XML"><![CDATA[<web:character-encoding-filter encoding="UTF-8"
override-client="true"
- url-pattern="*.seam"/></programlisting>
- </section>
- </section>
+ url-pattern="*.seam" />]]></programlisting>
+ </section>
+ </section>
<section>
<title>Locales<anchor id="locales" /></title>
Modified: trunk/doc/Seam_Reference_Guide/en-US/I18n.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/I18n.xml 2008-05-12 10:34:47 UTC (rev 8161)
+++ trunk/doc/Seam_Reference_Guide/en-US/I18n.xml 2008-05-12 11:35:45 UTC (rev 8162)
@@ -1,201 +1,287 @@
<?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">
-
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
<chapter id="i18n">
- <title>Internationalization and themes</title>
- <para>
- Seam makes it easy to build internationalized applications by
- providing several built-in components for handling multi-language
- UI messages.
- </para>
-
- <section>
- <title>Locales</title>
- <para>
- Each user login session has an associated instance of
- <literal>java.util.Locale</literal> (available to the
- application as a component named
- <literal>locale</literal>). Under normal circumstances,
- you won't need to do any special configuration to set
- the locale. Seam just delegates to JSF to determine
- the active locale:
- </para>
-
- <itemizedlist>
- <listitem>
- <para>If there is a locale associated with the HTTP request
- (the browser locale), and that locale is in the list
- of supported locales from <literal>faces-config.xml</literal>,
- use that locale for the rest of the session.</para>
- </listitem>
- <listitem>
- <para>Otherwise, if a default locale was specified in the
- <literal>faces-config.xml</literal>, use that locale
- for the rest of the session.</para>
- </listitem>
- <listitem>
- <para>Otherwise, use the default locale of the server.</para>
- </listitem>
- </itemizedlist>
-
- <para>
- It is <emphasis>possible</emphasis> to set the locale
- manually via the Seam configuration properties
- <literal>org.jboss.seam.international.localeSelector.language</literal>,
- <literal>org.jboss.seam.international.localeSelector.country</literal> and
- <literal>org.jboss.seam.international.localeSelector.variant</literal>, but
- we can't think of any good reason to ever do this.
- </para>
-
- <para>
- It is, however, useful to allow the user to set the
- locale manually via the application user interface.
- Seam provides built-in functionality for overriding
- the locale determined by the algorithm above. All
- you have to do is add the following fragment to a
- form in your JSP or Facelets page:
- </para>
-
-<programlisting role="XHTML"><![CDATA[<h:selectOneMenu value="#{localeSelector.language}">
- <f:selectItem itemLabel="English" itemValue="en"/>
- <f:selectItem itemLabel="Deutsch" itemValue="de"/>
- <f:selectItem itemLabel="Francais" itemValue="fr"/>
-</h:selectOneMenu>
-<h:commandButton action="#{localeSelector.select}" value="#{messages['ChangeLanguage']}"/>]]></programlisting>
+ <title>Internationalization, localization and themes</title>
- <para>
- Or, if you want a list of all supported locales from
- <literal>faces-config.xml</literal>, just use:
- </para>
+ <para>
+ Seam makes it easy to build internationalized applications. First, let's
+ walk through all the stages needed to internationalize and localize your
+ app. Then we'll take a look at the components Seam bundles.
+ </para>
- <programlisting role="XHTML"><![CDATA[<h:selectOneMenu value="#{localeSelector.localeString}">
- <f:selectItems value="#{localeSelector.supportedLocales}"/>
-</h:selectOneMenu>
-<h:commandButton action="#{localeSelector.select}" value="#{messages['ChangeLanguage']}"/>]]></programlisting>
+ <section>
+ <title>Internationalizing your app</title>
- <para>
- When this use selects an item from the drop-down, and
- clicks the button, the Seam and JSF locales will be
- overridden for the rest of the session.
- </para>
-
- </section>
-
+ <para>
+ A JEE application consists of many components and all of them must be
+ configured properly for your application to be localized.
+ </para>
+
+ <para>
+ Starting at the bottom, the first step is to ensure that your database
+ server and client is using the correct character encoding for your
+ locale. Normally you'll want to use UTF-8. How to do this is outside
+ the scope of this tutorial.
+ </para>
+
+ <section>
+ <title>Application server configuration</title>
+
+ <para>
+ To ensure that the application server receives the request
+ parameters in the correct encoding from client requests you have to
+ configure the tomcat connector. If you use Tomcat or JBoss AS, add
+ the <literal>URIEncoding="UTF-8"</literal> attribute to the
+ connector configuration. For JBoss AS 4.2 change
+ <literal>${JBOSS_HOME}/server/(default)/deploy/jboss-web.deployer/server.xml</literal>:
+ </para>
+
+ <programlisting role="XML"><Connector port="8080" URIEncoding="UTF-8"/></programlisting>
+
+ <para>
+ There is alternative which is probably better. You can tell JBoss AS
+ that the encoding for the request parameters will be taken from the
+ request:
+ </para>
+
+ <programlisting role="XML"><Connector port="8080" useBodyEncodingForURI="true"/></programlisting>
+ </section>
+
+ <section>
+ <title>Translated application strings</title>
+
+ <para>
+ You'll also need localized strings for all the <emphasis>messages</emphasis>
+ in your application (for example field labels on your views). First
+ you need to ensure that your resource bundle is encoded using the
+ desired character encoding. By default ASCII is used. Although ASCII
+ is enough for many languages, it doesn't provide characters for all
+ languages.
+ </para>
+
+ <para>
+ Resource bundles must be created in ASCII, or use Unicode escape
+ codes to represent Unicode characters. Since you don't compile a
+ property file to byte code, there is no way to tell the JVM which
+ character set to use. So you must use either ASCII characters or
+ escape characters not in the ASCII character set.
+ You can represent a Unicode character in any Java file using \uXXXX,
+ where XXXX is the hexidecimal representation of the character.
+ </para>
+
+ <para>
+ You can write your translation of labels
+ (<xlink linkend="labels">Labels</xlink>) to your messages resource
+ bundle in the native encoding and then convert the content of the
+ file into the escaped format through the tool <literal>native2ascii</literal>
+ provided in the JDK. This tool will convert a file written in your
+ native encoding to one that represents non-ASCII characters as
+ Unicode escape sequences.
+ </para>
+
+ <para>
+ Usage of this tool is described
+ <ulink url="http://java.sun.com/j2se/1.5.0/docs/tooldocs/index.html#intl">here for Java 5</ulink>
+ or
+ <ulink url="http://java.sun.com/javase/6/docs/technotes/tools/#intl">here for Java 6</ulink>.
+ For example, to convert a file from UTF-8:
+ </para>
+
+ <programlisting><prompt>$ native2ascii -encoding UTF-8 messages_cs.properties > messages_cs_escaped.properties</prompt></programlisting>
+
+ </section>
+
+ <section>
+ <title>Other encoding settings</title>
+
+ <para>
+ We need to make sure that the view displays your localized data and
+ messages using the correct character set and also any data submitted
+ uses the correct encoding.
+ </para>
+
+ <para>
+ To set the display character encoding, you need to use the
+ <literal><f:view locale="cs_CZ"/></literal> tag (here we tell
+ JSF to use the Czech locale). You may want to change the encoding of
+ the xml document itself if you want to embed localized strings in the
+ xml. To do this alter the encoding attribute in xml declaration
+ <literal><?xml version="1.0" encoding="UTF-8"?></literal> as
+ required.
+ </para>
+
+ <para>
+ Also JSF/Facelets should submit any requests using the specified
+ character encoding, but to make sure any requests that don't specify
+ an encoding you can force the request encoding using a servlet
+ filter. Configure this in <literal>components.xml</literal>:
+ </para>
+
+ <programlisting role="XML"><![CDATA[<web:character-encoding-filter encoding="UTF-8"
+ override-client="true"
+ url-pattern="*.seam" />]]></programlisting>
+ </section>
+ </section>
+
+ <section>
+ <title>Locales<anchor id="locales" /></title>
+
+ <para>Each user login session has an associated instance of
+ <literal>java.util.Locale</literal> (available to the application as a
+ component named <literal>locale</literal>). Under normal circumstances,
+ you won't need to do any special configuration to set the locale. Seam
+ just delegates to JSF to determine the active locale:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>If there is a locale associated with the HTTP request (the
+ browser locale), and that locale is in the list of supported locales
+ from <literal>faces-config.xml</literal>, use that locale for the rest
+ of the session.</para>
+ </listitem>
+
+ <listitem>
+ <para>Otherwise, if a default locale was specified in the
+ <literal>faces-config.xml</literal>, use that locale for the rest of
+ the session.</para>
+ </listitem>
+
+ <listitem>
+ <para>Otherwise, use the default locale of the server.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>It is <emphasis>possible</emphasis> to set the locale manually via
+ the Seam configuration properties <literal>
+ org.jboss.seam.international.localeSelector.language</literal>, <literal>
+ org.jboss.seam.international.localeSelector.country</literal> and
+ <literal> org.jboss.seam.international.localeSelector.variant</literal>,
+ but we can't think of any good reason to ever do this.</para>
+
+ <para>It is, however, useful to allow the user to set the locale manually
+ via the application user interface. Seam provides built-in functionality
+ for overriding the locale determined by the algorithm above. All you have
+ to do is add the following fragment to a form in your JSP or Facelets
+ page:</para>
+
+ <programlisting role="XHTML"><h:selectOneMenu value="#{localeSelector.language}">
+ <f:selectItem itemLabel="English" itemValue="en"/>
+ <f:selectItem itemLabel="Deutsch" itemValue="de"/>
+ <f:selectItem itemLabel="Francais" itemValue="fr"/>
+</h:selectOneMenu>
+<h:commandButton action="#{localeSelector.select}" value="#{messages['ChangeLanguage']}"/></programlisting>
+
+ <para>Or, if you want a list of all supported locales from <literal>
+ faces-config.xml</literal>, just use:</para>
+
+ <programlisting role="XHTML"><h:selectOneMenu value="#{localeSelector.localeString}">
+ <f:selectItems value="#{localeSelector.supportedLocales}"/>
+</h:selectOneMenu>
+<h:commandButton action="#{localeSelector.select}" value="#{messages['ChangeLanguage']}"/></programlisting>
+
+ <para>When this use selects an item from the drop-down, and clicks the
+ button, the Seam and JSF locales will be overridden for the rest of the
+ session.</para>
+ </section>
+
+ <section>
+ <title>Labels<anchor id="labels" /></title>
+
+ <para>JSF supports internationalization of user interface labels and
+ descriptive text via the use of <literal><f:loadBundle /></literal>.
+ You can use this approach in Seam applications. Alternatively, you can
+ take advantage of the Seam <literal> messages</literal> component to
+ display templated labels with embedded EL expressions.</para>
+
<section>
- <title>Labels</title>
- <para>
- JSF supports internationalization of user interface labels and
- descriptive text via the use of <literal><f:loadBundle /></literal>.
- You can use this approach in Seam applications. Alternatively, you can
- take advantage of the Seam <literal>messages</literal> component to
- display templated labels with embedded EL expressions.
- </para>
-
- <section>
- <title>Defining labels</title>
- <para>
- Seam provides a <literal>java.util.ResourceBundle</literal> (available
- to the application as a <literal>org.jboss.seam.core.resourceBundle</literal>).
- You'll need to make your internationalized labels available via this special
- resource bundle. By default, the resource bundle used by Seam is named
- <literal>messages</literal> and so you'll need to define your labels
- in files named <literal>messages.properties</literal>,
- <literal>messages_en.properties</literal>,
- <literal>messages_en_AU.properties</literal>, etc. These
- files usually belong in the <literal>WEB-INF/classes</literal>
- directory.
- </para>
-
- <para>
- So, in <literal>messages_en.properties</literal>:
- </para>
-
- <programlisting><![CDATA[Hello=Hello]]></programlisting>
+ <title>Defining labels</title>
- <para>
- And in <literal>messages_en_AU.properties</literal>:
- </para>
-
- <programlisting><![CDATA[Hello=G'day]]></programlisting>
-
- <para>
- You can select a different name for the resource bundle by setting
- the Seam configuration property named
- <literal>org.jboss.seam.core.resourceLoader.bundleNames</literal>. You can even specify
- a list of resource bundle names to be searched (depth first) for
- messages.
- </para>
+ <para>Seam provides a <literal>java.util.ResourceBundle</literal>
+ (available to the application as a <literal>
+ org.jboss.seam.core.resourceBundle</literal>). You'll need to make your
+ internationalized labels available via this special resource bundle. By
+ default, the resource bundle used by Seam is named
+ <literal>messages</literal> and so you'll need to define your labels in
+ files named <literal> messages.properties</literal>, <literal>
+ messages_en.properties</literal>, <literal>
+ messages_en_AU.properties</literal>, etc. These files usually belong in
+ the <literal>WEB-INF/classes</literal> directory.</para>
- <programlisting role="XML"><![CDATA[<core:resource-loader>
- <core:bundle-names>
- <value>mycompany_messages</value>
- <value>standard_messages</value>
- </core:bundle-names>
-</core:resource-loader>]]></programlisting>
+ <para>So, in <literal>messages_en.properties</literal>:</para>
- <para>
- If you want to define a message just for a particular page, you
- can specify it in a resource bundle with the same name as the
- JSF view id, with the leading <literal>/</literal> and trailing
- file extension removed. So we could put our message in
- <literal>welcome/hello_en.properties</literal> if we only needed
- to display the message on <literal>/welcome/hello.jsp</literal>.
- </para>
-
- <para>
- You can even specify an explicit bundle name in <literal>pages.xml</literal>:
- </para>
-
- <programlisting role="XML"><![CDATA[<page view-id="/welcome/hello.jsp" bundle="HelloMessages"/>]]></programlisting>
-
- <para>
- Then we could use messages defined in <literal>HelloMessages.properties</literal>
- on <literal>/welcome/hello.jsp</literal>.
- </para>
+ <programlisting>Hello=Hello</programlisting>
+
+ <para>And in <literal>messages_en_AU.properties</literal>:</para>
+
+ <programlisting>Hello=G'day</programlisting>
+
+ <para>You can select a different name for the resource bundle by setting
+ the Seam configuration property named <literal>
+ org.jboss.seam.core.resourceLoader.bundleNames</literal>. You can even
+ specify a list of resource bundle names to be searched (depth first) for
+ messages.</para>
+
+ <programlisting role="XML"><core:resource-loader>
+ <core:bundle-names>
+ <value>mycompany_messages</value>
+ <value>standard_messages</value>
+ </core:bundle-names>
+</core:resource-loader></programlisting>
+
+ <para>If you want to define a message just for a particular page, you
+ can specify it in a resource bundle with the same name as the JSF view
+ id, with the leading <literal>/</literal> and trailing file extension
+ removed. So we could put our message in <literal>
+ welcome/hello_en.properties</literal> if we only needed to display the
+ message on <literal> /welcome/hello.jsp</literal>.</para>
+
+ <para>You can even specify an explicit bundle name in <literal>
+ pages.xml</literal>:</para>
+
+ <programlisting role="XML"><page view-id="/welcome/hello.jsp" bundle="HelloMessages"/></programlisting>
+
+ <para>Then we could use messages defined in <literal>
+ HelloMessages.properties</literal> on <literal>
+ /welcome/hello.jsp</literal>.</para>
</section>
-
+
<section>
- <title>Displaying labels</title>
+ <title>Displaying labels</title>
- <para>
- If you define your labels using the Seam resource bundle, you'll
- be able to use them without having to type <literal><f:loadBundle ... /></literal>
- on every page. Instead, you can simply type:
- </para>
-
- <programlisting role="XHTML"><![CDATA[<h:outputText value="#{messages['Hello']}"/>]]></programlisting>
-
- <para>
- or:
- </para>
-
- <programlisting role="XHTML"><![CDATA[<h:outputText value="#{messages.Hello}"/>]]></programlisting>
-
- <para>
- Even better, the messages themselves may contain EL expressions:
- </para>
+ <para>If you define your labels using the Seam resource bundle, you'll
+ be able to use them without having to type <literal> <f:loadBundle
+ ... /></literal> on every page. Instead, you can simply type:</para>
- <programlisting><![CDATA[Hello=Hello, #{user.firstName} #{user.lastName}]]></programlisting>
- <programlisting><![CDATA[Hello=G'day, #{user.firstName}]]></programlisting>
-
- <para>
- You can even use the messages in your code:
- </para>
+ <programlisting role="XHTML"><h:outputText value="#{messages['Hello']}"/></programlisting>
- <programlisting role="JAVA"><![CDATA[@In private Map<String, String> messages;]]></programlisting>
- <programlisting role="JAVA"><![CDATA[@In("#{messages['Hello']}") private String helloMessage;]]></programlisting>
+ <para>or:</para>
+ <programlisting role="XHTML"><h:outputText value="#{messages.Hello}"/></programlisting>
+
+ <para>Even better, the messages themselves may contain EL
+ expressions:</para>
+
+ <programlisting>Hello=Hello, #{user.firstName} #{user.lastName}</programlisting>
+
+ <programlisting>Hello=G'day, #{user.firstName}</programlisting>
+
+ <para>You can even use the messages in your code:</para>
+
+ <programlisting role="JAVA">@In private Map<String, String> messages;</programlisting>
+
+ <programlisting role="JAVA">@In("#{messages['Hello']}") private String helloMessage;</programlisting>
</section>
-
+
<section>
- <title>Faces messages</title>
- <para>
- The <literal>facesMessages</literal> component is a super-convenient
- way to display success or failure messages to the user. The functionality
- we just described also works for faces messages:
- </para>
+ <title>Faces messages</title>
- <programlisting role="JAVA"><![CDATA[@Name("hello")
+ <para>The <literal>facesMessages</literal> component is a
+ super-convenient way to display success or failure messages to the user.
+ The functionality we just described also works for faces
+ messages:</para>
+
+ <programlisting role="JAVA">@Name("hello")
@Stateless
public class HelloBean implements Hello {
@In FacesMessages facesMessages;
@@ -203,126 +289,110 @@
public String sayIt() {
facesMessages.addFromResourceBundle("Hello");
}
-}]]></programlisting>
+}</programlisting>
- <para>
- This will display <literal>Hello, Gavin King</literal> or <literal>G'day, Gavin</literal>,
- depending upon the user's locale.
- </para>
-
+ <para>This will display <literal>Hello, Gavin King</literal> or
+ <literal>G'day, Gavin</literal>, depending upon the user's
+ locale.</para>
</section>
- </section>
-
- <section>
- <title>Timezones</title>
- <para>
- There is also a session-scoped instance of <literal>java.util.Timezone</literal>,
- named <literal>org.jboss.seam.international.timezone</literal>, and a Seam component for changing
- the timezone named <literal>org.jboss.seam.international.timezoneSelector</literal>. By default,
- the timezone is the default timezone of the server. Unfortunately, the JSF specification
- says that all dates and times should be assumed to be UTC, and displayed as UTC, unless
- a timezone is explicitly specified using <literal><f:convertDateTime></literal>.
- This is an extremely inconvenient default behavior.
- </para>
- <para>
- Seam overrides this behavior, and defaults all dates and times to the Seam timezone.
- In addition, Seam provides the <literal><s:convertDateTime></literal> tag which
- always performs conversions in the Seam timezone.
- </para>
- </section>
-
- <section>
- <title>Themes</title>
- <para>
- Seam applications are also very easily skinnable. The theme API is very
- similar to the localization API, but of course these two concerns are
- orthogonal, and some applications support both localization and themes.
- </para>
-
- <para>
- First, configure the set of supported themes:
- </para>
-
- <programlisting role="XML"><![CDATA[<theme:theme-selector cookie-enabled="true">
- <theme:available-themes>
- <value>default</value>
- <value>accessible</value>
- <value>printable</value>
- </theme:available-themes>
-</theme:theme-selector>]]></programlisting>
-
- <para>
- Note that the first theme listed is the default theme.
- </para>
+ </section>
- <para>
- Themes are defined in a properties file with the same name as the theme.
- For example, the <literal>default</literal> theme is defined as a set of
- entries in <literal>default.properties</literal>. For example,
- <literal>default.properties</literal> might define:
- </para>
-
-<programlisting><![CDATA[css ../screen.css
-template /template.xhtml]]></programlisting>
+ <section>
+ <title>Timezones</title>
- <para>
- Usually the entries in a theme resource bundle will be paths to CSS styles
- or images and names of facelets templates (unlike localization resource
- bundles which are usually text).
- </para>
-
- <para>
- Now we can use these entries in our JSP or facelets pages. For example,
- to theme the stylesheet in a facelets page:
- </para>
-
- <programlisting role="XHTML"><![CDATA[<link href="#{theme.css}" rel="stylesheet" type="text/css" />]]></programlisting>
-
- <para>Or, when the page definition resides in a subdirectory:</para>
-
- <programlisting role="XHTML"><![CDATA[<link href="#{facesContext.externalContext.requestContextPath}#{theme.css}"
- rel="stylesheet" type="text/css" />]]></programlisting>
-
- <para>
- Most powerfully, facelets lets us theme the template used by a <literal><ui:composition></literal>:
- </para>
+ <para>There is also a session-scoped instance of <literal>
+ java.util.Timezone</literal>, named <literal>
+ org.jboss.seam.international.timezone</literal>, and a Seam component for
+ changing the timezone named <literal>
+ org.jboss.seam.international.timezoneSelector</literal>. By default, the
+ timezone is the default timezone of the server. Unfortunately, the JSF
+ specification says that all dates and times should be assumed to be UTC,
+ and displayed as UTC, unless a timezone is explicitly specified using
+ <literal> <f:convertDateTime></literal>. This is an extremely
+ inconvenient default behavior.</para>
- <programlisting role="XHTML"><![CDATA[<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ <para>Seam overrides this behavior, and defaults all dates and times to
+ the Seam timezone. In addition, Seam provides the <literal>
+ <s:convertDateTime></literal> tag which always performs conversions
+ in the Seam timezone.</para>
+ </section>
+
+ <section>
+ <title>Themes</title>
+
+ <para>Seam applications are also very easily skinnable. The theme API is
+ very similar to the localization API, but of course these two concerns are
+ orthogonal, and some applications support both localization and
+ themes.</para>
+
+ <para>First, configure the set of supported themes:</para>
+
+ <programlisting role="XML"><theme:theme-selector cookie-enabled="true">
+ <theme:available-themes>
+ <value>default</value>
+ <value>accessible</value>
+ <value>printable</value>
+ </theme:available-themes>
+</theme:theme-selector></programlisting>
+
+ <para>Note that the first theme listed is the default theme.</para>
+
+ <para>Themes are defined in a properties file with the same name as the
+ theme. For example, the <literal>default</literal> theme is defined as a
+ set of entries in <literal> default.properties</literal>. For example,
+ <literal> default.properties</literal> might define:</para>
+
+ <programlisting>css ../screen.css
+template /template.xhtml</programlisting>
+
+ <para>Usually the entries in a theme resource bundle will be paths to CSS
+ styles or images and names of facelets templates (unlike localization
+ resource bundles which are usually text).</para>
+
+ <para>Now we can use these entries in our JSP or facelets pages. For
+ example, to theme the stylesheet in a facelets page:</para>
+
+ <programlisting role="XHTML"><link href="#{theme.css}" rel="stylesheet" type="text/css" /></programlisting>
+
+ <para>Or, when the page definition resides in a subdirectory:</para>
+
+ <programlisting role="XHTML"><link href="#{facesContext.externalContext.requestContextPath}#{theme.css}"
+ rel="stylesheet" type="text/css" /></programlisting>
+
+ <para>Most powerfully, facelets lets us theme the template used by a
+ <literal><ui:composition></literal>:</para>
+
+ <programlisting role="XHTML"><ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
- template="#{theme.template}">]]></programlisting>
-
- <para>
- Just like the locale selector, there is a built-in theme selector to allow
- the user to freely switch themes:
- </para>
+ template="#{theme.template}"></programlisting>
- <programlisting role="XHTML"><![CDATA[<h:selectOneMenu value="#{themeSelector.theme}">
- <f:selectItems value="#{themeSelector.themes}"/>
-</h:selectOneMenu>
-<h:commandButton action="#{themeSelector.select}" value="Select Theme"/>]]></programlisting>
+ <para>Just like the locale selector, there is a built-in theme selector to
+ allow the user to freely switch themes:</para>
- </section>
-
- <section>
- <title>Persisting locale and theme preferences via cookies</title>
- <para>
- The locale selector, theme selector and timezone selector all support
- persistence of locale and theme preference to a cookie. Simply set the
- <literal>cookie-enabled</literal> property in <literal>components.xml</literal>:
- </para>
-
- <programlisting role="XML"><![CDATA[<theme:theme-selector cookie-enabled="true">
- <theme:available-themes>
- <value>default</value>
- <value>accessible</value>
- <value>printable</value>
- </theme:available-themes>
-</theme:theme-selector>
+ <programlisting role="XHTML"><h:selectOneMenu value="#{themeSelector.theme}">
+ <f:selectItems value="#{themeSelector.themes}"/>
+</h:selectOneMenu>
+<h:commandButton action="#{themeSelector.select}" value="Select Theme"/></programlisting>
+ </section>
-<international:locale-selector cookie-enabled="true"/>]]></programlisting>
+ <section>
+ <title>Persisting locale and theme preferences via cookies</title>
- </section>
-
-</chapter>
+ <para>The locale selector, theme selector and timezone selector all
+ support persistence of locale and theme preference to a cookie. Simply set
+ the <literal>cookie-enabled</literal> property in
+ <literal>components.xml</literal>:</para>
+
+ <programlisting role="XML"><theme:theme-selector cookie-enabled="true">
+ <theme:available-themes>
+ <value>default</value>
+ <value>accessible</value>
+ <value>printable</value>
+ </theme:available-themes>
+</theme:theme-selector>
+
+<international:locale-selector cookie-enabled="true"/></programlisting>
+ </section>
+</chapter>
\ No newline at end of file
16 years, 6 months
Seam SVN: r8161 - branches/Seam_2_0/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2008-05-12 06:34:47 -0400 (Mon, 12 May 2008)
New Revision: 8161
Modified:
branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/I18n.xml
Log:
JBSEAM-2712
Modified: branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/I18n.xml
===================================================================
--- branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/I18n.xml 2008-05-12 10:28:43 UTC (rev 8160)
+++ branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/I18n.xml 2008-05-12 10:34:47 UTC (rev 8161)
@@ -1,201 +1,266 @@
<?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">
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
+<chapter id="i18n">
+ <title>Internationalization, localization and themes</title>
-<chapter id="i18n">
- <title>Internationalization and themes</title>
- <para>
- Seam makes it easy to build internationalized applications by
- providing several built-in components for handling multi-language
- UI messages.
- </para>
-
+ <para>Seam makes it easy to build internationalized applications. First,
+ let's walk through all the stages needed to internationalize and localize
+ your app. Then we'll take a look at the components Seam bundles.</para>
+
+ <section>
+ <title>Internationalizing your app</title>
+
+ <para>JEE application is consisting from many components and all can break
+ the whole view on the localizated target.</para>
+
+ <para>Starting at the bottom, the first step is to ensure that your
+ database server and client is using the correct character encoding for
+ your locale. Normally you'll want to use UTF-8. How to do this is outside
+ the scope of this tutorial.</para>
+
<section>
- <title>Locales</title>
- <para>
- Each user login session has an associated instance of
- <literal>java.util.Locale</literal> (available to the
- application as a component named
- <literal>locale</literal>). Under normal circumstances,
- you won't need to do any special configuration to set
- the locale. Seam just delegates to JSF to determine
- the active locale:
- </para>
-
- <itemizedlist>
- <listitem>
- <para>If there is a locale associated with the HTTP request
- (the browser locale), and that locale is in the list
- of supported locales from <literal>faces-config.xml</literal>,
- use that locale for the rest of the session.</para>
- </listitem>
- <listitem>
- <para>Otherwise, if a default locale was specified in the
- <literal>faces-config.xml</literal>, use that locale
- for the rest of the session.</para>
- </listitem>
- <listitem>
- <para>Otherwise, use the default locale of the server.</para>
- </listitem>
- </itemizedlist>
-
- <para>
- It is <emphasis>possible</emphasis> to set the locale
- manually via the Seam configuration properties
- <literal>org.jboss.seam.international.localeSelector.language</literal>,
- <literal>org.jboss.seam.international.localeSelector.country</literal> and
- <literal>org.jboss.seam.international.localeSelector.variant</literal>, but
- we can't think of any good reason to ever do this.
- </para>
-
- <para>
- It is, however, useful to allow the user to set the
- locale manually via the application user interface.
- Seam provides built-in functionality for overriding
- the locale determined by the algorithm above. All
- you have to do is add the following fragment to a
- form in your JSP or Facelets page:
- </para>
-
-<programlisting role="XHTML"><![CDATA[<h:selectOneMenu value="#{localeSelector.language}">
- <f:selectItem itemLabel="English" itemValue="en"/>
- <f:selectItem itemLabel="Deutsch" itemValue="de"/>
- <f:selectItem itemLabel="Francais" itemValue="fr"/>
-</h:selectOneMenu>
-<h:commandButton action="#{localeSelector.select}" value="#{messages['ChangeLanguage']}"/>]]></programlisting>
+ <title>Application server configuration</title>
- <para>
- Or, if you want a list of all supported locales from
- <literal>faces-config.xml</literal>, just use:
- </para>
+ <para>To ensure that application server receive correct parameters
+ attributes from client requests you have to adapt the configuration of
+ tomcat connector. If you use Tomcat or JBOSS AS, add attribute
+ <code>URIEncoding="UTF-8"</code> into connector configuration. In case
+ JBOSS AS 4.2.2 change
+ <code>${JBOSS_HOME}/server/(default)/deploy/jboss-web.deployer/server.xml</code>
+ configuration file like the following:</para>
- <programlisting role="XHTML"><![CDATA[<h:selectOneMenu value="#{localeSelector.localeString}">
- <f:selectItems value="#{localeSelector.supportedLocales}"/>
-</h:selectOneMenu>
-<h:commandButton action="#{localeSelector.select}" value="#{messages['ChangeLanguage']}"/>]]></programlisting>
+ <programlisting><Connector port="8080" URIEncoding="UTF-8"/></programlisting>
- <para>
- When this use selects an item from the drop-down, and
- clicks the button, the Seam and JSF locales will be
- overridden for the rest of the session.
- </para>
-
+ <para>There is also another configuration atribute
+ <code>useBodyEncodingForURI</code>, which is logically better for use,
+ because it says that encoding for URI will be taken from setting of web
+ page body. In other words the encoding of the parameters in URL will be
+ same as the content of the web page. Example of configuration is the
+ following:</para>
+
+ <programlisting><Connector port="8080" useBodyEncodingForURI="true"/></programlisting>
</section>
-
+
<section>
- <title>Labels</title>
- <para>
- JSF supports internationalization of user interface labels and
- descriptive text via the use of <literal><f:loadBundle /></literal>.
- You can use this approach in Seam applications. Alternatively, you can
- take advantage of the Seam <literal>messages</literal> component to
- display templated labels with embedded EL expressions.
- </para>
-
+ <title>Translated application strings</title>
+
+ <para>Correct localized application uses for all static texts in JSF
+ pages labels, which can be translated and loaded from resource bundles
+ with defined labels. First you need to ensure that your resource bundle
+ is encoded using the desired character encoding. By default it uses
+ ISO-8859-1. Although ISO-8859-1 supports many languages, it doesn't
+ represent everything. So if you want to translate in another langugage,
+ which uses characters outside the standard ASCII set, you need to use
+ encoding which covers all these non-ascii characters.</para>
+
+ <para>You'll need to understand another caveat regarding property
+ bundles; you must create them in ASCII, or use Unicode escape codes to
+ represent Unicode characters. Since you don't compile a property file to
+ byte codes, there is no way to tell the JVM which character set to use.
+ So you must explicitly use ASCII characters or use the escape sequences.
+ You can represent a Unicode character in any Java file using \uXXXX,
+ where XXXX is the hexidecimal representation of the character. Write
+ your translation of labels (see below section <link
+ linkend="labels">Labels</link>) to file and then you have to convert the
+ content of file into escaped format through the java command tool
+ native2ascii provided in the JDK. This tool will convert a file written
+ in your native encoding to one that represents non-ASCII characters as
+ Unicode escape sequences.</para>
+
+ <para>Usage of this tool is described at <ulink
+ url="http://java.sun.com/j2se/1.5.0/docs/tooldocs/index.html#intl">http://java.sun.com/j2se/1.5.0/docs/tooldocs/index.html#intl</ulink>
+ for Java 5 or at <ulink
+ url="http://java.sun.com/javase/6/docs/technotes/tools/#intl">http://java.sun.com/javase/6/docs/technotes/tools/#intl</ulink>
+ for Java 6, but briefly, on command line write:<programlisting><code><prompt>$ native2ascii -encoding UTF-8 messages_cs.properties > messages_cs_escaped.properties</prompt></code></programlisting>Then
+ converted file can be used in application as resource bundle with a
+ proper locale code (see <link linkend="labels">Labels</link>).</para>
+ </section>
+
<section>
- <title>Defining labels</title>
- <para>
- Seam provides a <literal>java.util.ResourceBundle</literal> (available
- to the application as a <literal>org.jboss.seam.core.resourceBundle</literal>).
- You'll need to make your internationalized labels available via this special
- resource bundle. By default, the resource bundle used by Seam is named
- <literal>messages</literal> and so you'll need to define your labels
- in files named <literal>messages.properties</literal>,
- <literal>messages_en.properties</literal>,
- <literal>messages_en_AU.properties</literal>, etc. These
- files usually belong in the <literal>WEB-INF/classes</literal>
- directory.
- </para>
-
- <para>
- So, in <literal>messages_en.properties</literal>:
- </para>
-
- <programlisting><![CDATA[Hello=Hello]]></programlisting>
+ <title>Other encoding settings</title>
- <para>
- And in <literal>messages_en_AU.properties</literal>:
- </para>
-
- <programlisting><![CDATA[Hello=G'day]]></programlisting>
-
- <para>
- You can select a different name for the resource bundle by setting
- the Seam configuration property named
- <literal>org.jboss.seam.core.resourceLoader.bundleNames</literal>. You can even specify
- a list of resource bundle names to be searched (depth first) for
- messages.
- </para>
+ <para>We need to make sure that the view (JSF, JSP or XHTML) displays
+ your correct localized data and messages using the correct character set
+ and also any data submitted uses the correct encoding.</para>
- <programlisting role="XML"><![CDATA[<core:resource-loader>
- <core:bundle-names>
- <value>mycompany_messages</value>
- <value>standard_messages</value>
- </core:bundle-names>
-</core:resource-loader>]]></programlisting>
+ <para>To set the display character encoding, you need to use the
+ <literal><f:view locale="cs_CZ"/></literal> tag for example to use
+ Czech locale in Java Server Faces technology. You may want to change the
+ encoding of the xml document itself if you want to embed localized
+ strings in the xml. To do this alter the encoding attribute in xml
+ declaration <literal><?xml version="1.0"
+ encoding="UTF-8"?></literal> as required.</para>
- <para>
- If you want to define a message just for a particular page, you
- can specify it in a resource bundle with the same name as the
- JSF view id, with the leading <literal>/</literal> and trailing
- file extension removed. So we could put our message in
- <literal>welcome/hello_en.properties</literal> if we only needed
- to display the message on <literal>/welcome/hello.jsp</literal>.
- </para>
-
- <para>
- You can even specify an explicit bundle name in <literal>pages.xml</literal>:
- </para>
-
- <programlisting role="XML"><![CDATA[<page view-id="/welcome/hello.jsp" bundle="HelloMessages"/>]]></programlisting>
-
- <para>
- Then we could use messages defined in <literal>HelloMessages.properties</literal>
- on <literal>/welcome/hello.jsp</literal>.
- </para>
+ <para>Also JSF/Facelets should submit any requests in the desired
+ character, but to make sure any requests that don't specify an encoding
+ you can use a Servlet filter to set it in Seam components.xml
+ configuration file:</para>
+
+ <programlisting role="XML"><web:character-encoding-filter encoding="UTF-8"
+ override-client="true"
+ url-pattern="*.seam"/></programlisting>
</section>
-
+ </section>
+
+ <section>
+ <title>Locales<anchor id="locales" /></title>
+
+ <para>Each user login session has an associated instance of
+ <literal>java.util.Locale</literal> (available to the application as a
+ component named <literal>locale</literal>). Under normal circumstances,
+ you won't need to do any special configuration to set the locale. Seam
+ just delegates to JSF to determine the active locale:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>If there is a locale associated with the HTTP request (the
+ browser locale), and that locale is in the list of supported locales
+ from <literal>faces-config.xml</literal>, use that locale for the rest
+ of the session.</para>
+ </listitem>
+
+ <listitem>
+ <para>Otherwise, if a default locale was specified in the
+ <literal>faces-config.xml</literal>, use that locale for the rest of
+ the session.</para>
+ </listitem>
+
+ <listitem>
+ <para>Otherwise, use the default locale of the server.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>It is <emphasis>possible</emphasis> to set the locale manually via
+ the Seam configuration properties <literal>
+ org.jboss.seam.international.localeSelector.language</literal>, <literal>
+ org.jboss.seam.international.localeSelector.country</literal> and
+ <literal> org.jboss.seam.international.localeSelector.variant</literal>,
+ but we can't think of any good reason to ever do this.</para>
+
+ <para>It is, however, useful to allow the user to set the locale manually
+ via the application user interface. Seam provides built-in functionality
+ for overriding the locale determined by the algorithm above. All you have
+ to do is add the following fragment to a form in your JSP or Facelets
+ page:</para>
+
+ <programlisting role="XHTML"><h:selectOneMenu value="#{localeSelector.language}">
+ <f:selectItem itemLabel="English" itemValue="en"/>
+ <f:selectItem itemLabel="Deutsch" itemValue="de"/>
+ <f:selectItem itemLabel="Francais" itemValue="fr"/>
+</h:selectOneMenu>
+<h:commandButton action="#{localeSelector.select}" value="#{messages['ChangeLanguage']}"/></programlisting>
+
+ <para>Or, if you want a list of all supported locales from <literal>
+ faces-config.xml</literal>, just use:</para>
+
+ <programlisting role="XHTML"><h:selectOneMenu value="#{localeSelector.localeString}">
+ <f:selectItems value="#{localeSelector.supportedLocales}"/>
+</h:selectOneMenu>
+<h:commandButton action="#{localeSelector.select}" value="#{messages['ChangeLanguage']}"/></programlisting>
+
+ <para>When this use selects an item from the drop-down, and clicks the
+ button, the Seam and JSF locales will be overridden for the rest of the
+ session.</para>
+ </section>
+
+ <section>
+ <title>Labels<anchor id="labels" /></title>
+
+ <para>JSF supports internationalization of user interface labels and
+ descriptive text via the use of <literal><f:loadBundle /></literal>.
+ You can use this approach in Seam applications. Alternatively, you can
+ take advantage of the Seam <literal> messages</literal> component to
+ display templated labels with embedded EL expressions.</para>
+
<section>
- <title>Displaying labels</title>
+ <title>Defining labels</title>
- <para>
- If you define your labels using the Seam resource bundle, you'll
- be able to use them without having to type <literal><f:loadBundle ... /></literal>
- on every page. Instead, you can simply type:
- </para>
-
- <programlisting role="XHTML"><![CDATA[<h:outputText value="#{messages['Hello']}"/>]]></programlisting>
-
- <para>
- or:
- </para>
-
- <programlisting role="XHTML"><![CDATA[<h:outputText value="#{messages.Hello}"/>]]></programlisting>
-
- <para>
- Even better, the messages themselves may contain EL expressions:
- </para>
+ <para>Seam provides a <literal>java.util.ResourceBundle</literal>
+ (available to the application as a <literal>
+ org.jboss.seam.core.resourceBundle</literal>). You'll need to make your
+ internationalized labels available via this special resource bundle. By
+ default, the resource bundle used by Seam is named
+ <literal>messages</literal> and so you'll need to define your labels in
+ files named <literal> messages.properties</literal>, <literal>
+ messages_en.properties</literal>, <literal>
+ messages_en_AU.properties</literal>, etc. These files usually belong in
+ the <literal>WEB-INF/classes</literal> directory.</para>
- <programlisting><![CDATA[Hello=Hello, #{user.firstName} #{user.lastName}]]></programlisting>
- <programlisting><![CDATA[Hello=G'day, #{user.firstName}]]></programlisting>
-
- <para>
- You can even use the messages in your code:
- </para>
+ <para>So, in <literal>messages_en.properties</literal>:</para>
- <programlisting role="JAVA"><![CDATA[@In private Map<String, String> messages;]]></programlisting>
- <programlisting role="JAVA"><![CDATA[@In("#{messages['Hello']}") private String helloMessage;]]></programlisting>
+ <programlisting>Hello=Hello</programlisting>
+ <para>And in <literal>messages_en_AU.properties</literal>:</para>
+
+ <programlisting>Hello=G'day</programlisting>
+
+ <para>You can select a different name for the resource bundle by setting
+ the Seam configuration property named <literal>
+ org.jboss.seam.core.resourceLoader.bundleNames</literal>. You can even
+ specify a list of resource bundle names to be searched (depth first) for
+ messages.</para>
+
+ <programlisting role="XML"><core:resource-loader>
+ <core:bundle-names>
+ <value>mycompany_messages</value>
+ <value>standard_messages</value>
+ </core:bundle-names>
+</core:resource-loader></programlisting>
+
+ <para>If you want to define a message just for a particular page, you
+ can specify it in a resource bundle with the same name as the JSF view
+ id, with the leading <literal>/</literal> and trailing file extension
+ removed. So we could put our message in <literal>
+ welcome/hello_en.properties</literal> if we only needed to display the
+ message on <literal> /welcome/hello.jsp</literal>.</para>
+
+ <para>You can even specify an explicit bundle name in <literal>
+ pages.xml</literal>:</para>
+
+ <programlisting role="XML"><page view-id="/welcome/hello.jsp" bundle="HelloMessages"/></programlisting>
+
+ <para>Then we could use messages defined in <literal>
+ HelloMessages.properties</literal> on <literal>
+ /welcome/hello.jsp</literal>.</para>
</section>
-
+
<section>
- <title>Faces messages</title>
- <para>
- The <literal>facesMessages</literal> component is a super-convenient
- way to display success or failure messages to the user. The functionality
- we just described also works for faces messages:
- </para>
+ <title>Displaying labels</title>
- <programlisting role="JAVA"><![CDATA[@Name("hello")
+ <para>If you define your labels using the Seam resource bundle, you'll
+ be able to use them without having to type <literal> <f:loadBundle
+ ... /></literal> on every page. Instead, you can simply type:</para>
+
+ <programlisting role="XHTML"><h:outputText value="#{messages['Hello']}"/></programlisting>
+
+ <para>or:</para>
+
+ <programlisting role="XHTML"><h:outputText value="#{messages.Hello}"/></programlisting>
+
+ <para>Even better, the messages themselves may contain EL
+ expressions:</para>
+
+ <programlisting>Hello=Hello, #{user.firstName} #{user.lastName}</programlisting>
+
+ <programlisting>Hello=G'day, #{user.firstName}</programlisting>
+
+ <para>You can even use the messages in your code:</para>
+
+ <programlisting role="JAVA">@In private Map<String, String> messages;</programlisting>
+
+ <programlisting role="JAVA">@In("#{messages['Hello']}") private String helloMessage;</programlisting>
+ </section>
+
+ <section>
+ <title>Faces messages</title>
+
+ <para>The <literal>facesMessages</literal> component is a
+ super-convenient way to display success or failure messages to the user.
+ The functionality we just described also works for faces
+ messages:</para>
+
+ <programlisting role="JAVA">@Name("hello")
@Stateless
public class HelloBean implements Hello {
@In FacesMessages facesMessages;
@@ -203,126 +268,110 @@
public String sayIt() {
facesMessages.addFromResourceBundle("Hello");
}
-}]]></programlisting>
+}</programlisting>
- <para>
- This will display <literal>Hello, Gavin King</literal> or <literal>G'day, Gavin</literal>,
- depending upon the user's locale.
- </para>
-
+ <para>This will display <literal>Hello, Gavin King</literal> or
+ <literal>G'day, Gavin</literal>, depending upon the user's
+ locale.</para>
</section>
- </section>
-
- <section>
- <title>Timezones</title>
- <para>
- There is also a session-scoped instance of <literal>java.util.Timezone</literal>,
- named <literal>org.jboss.seam.international.timezone</literal>, and a Seam component for changing
- the timezone named <literal>org.jboss.seam.international.timezoneSelector</literal>. By default,
- the timezone is the default timezone of the server. Unfortunately, the JSF specification
- says that all dates and times should be assumed to be UTC, and displayed as UTC, unless
- a timezone is explicitly specified using <literal><f:convertDateTime></literal>.
- This is an extremely inconvenient default behavior.
- </para>
- <para>
- Seam overrides this behavior, and defaults all dates and times to the Seam timezone.
- In addition, Seam provides the <literal><s:convertDateTime></literal> tag which
- always performs conversions in the Seam timezone.
- </para>
- </section>
-
- <section>
- <title>Themes</title>
- <para>
- Seam applications are also very easily skinnable. The theme API is very
- similar to the localization API, but of course these two concerns are
- orthogonal, and some applications support both localization and themes.
- </para>
-
- <para>
- First, configure the set of supported themes:
- </para>
-
- <programlisting role="XML"><![CDATA[<theme:theme-selector cookie-enabled="true">
- <theme:available-themes>
- <value>default</value>
- <value>accessible</value>
- <value>printable</value>
- </theme:available-themes>
-</theme:theme-selector>]]></programlisting>
-
- <para>
- Note that the first theme listed is the default theme.
- </para>
+ </section>
- <para>
- Themes are defined in a properties file with the same name as the theme.
- For example, the <literal>default</literal> theme is defined as a set of
- entries in <literal>default.properties</literal>. For example,
- <literal>default.properties</literal> might define:
- </para>
-
-<programlisting><![CDATA[css ../screen.css
-template /template.xhtml]]></programlisting>
+ <section>
+ <title>Timezones</title>
- <para>
- Usually the entries in a theme resource bundle will be paths to CSS styles
- or images and names of facelets templates (unlike localization resource
- bundles which are usually text).
- </para>
-
- <para>
- Now we can use these entries in our JSP or facelets pages. For example,
- to theme the stylesheet in a facelets page:
- </para>
-
- <programlisting role="XHTML"><![CDATA[<link href="#{theme.css}" rel="stylesheet" type="text/css" />]]></programlisting>
-
- <para>Or, when the page definition resides in a subdirectory:</para>
-
- <programlisting role="XHTML"><![CDATA[<link href="#{facesContext.externalContext.requestContextPath}#{theme.css}"
- rel="stylesheet" type="text/css" />]]></programlisting>
-
- <para>
- Most powerfully, facelets lets us theme the template used by a <literal><ui:composition></literal>:
- </para>
+ <para>There is also a session-scoped instance of <literal>
+ java.util.Timezone</literal>, named <literal>
+ org.jboss.seam.international.timezone</literal>, and a Seam component for
+ changing the timezone named <literal>
+ org.jboss.seam.international.timezoneSelector</literal>. By default, the
+ timezone is the default timezone of the server. Unfortunately, the JSF
+ specification says that all dates and times should be assumed to be UTC,
+ and displayed as UTC, unless a timezone is explicitly specified using
+ <literal> <f:convertDateTime></literal>. This is an extremely
+ inconvenient default behavior.</para>
- <programlisting role="XHTML"><![CDATA[<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ <para>Seam overrides this behavior, and defaults all dates and times to
+ the Seam timezone. In addition, Seam provides the <literal>
+ <s:convertDateTime></literal> tag which always performs conversions
+ in the Seam timezone.</para>
+ </section>
+
+ <section>
+ <title>Themes</title>
+
+ <para>Seam applications are also very easily skinnable. The theme API is
+ very similar to the localization API, but of course these two concerns are
+ orthogonal, and some applications support both localization and
+ themes.</para>
+
+ <para>First, configure the set of supported themes:</para>
+
+ <programlisting role="XML"><theme:theme-selector cookie-enabled="true">
+ <theme:available-themes>
+ <value>default</value>
+ <value>accessible</value>
+ <value>printable</value>
+ </theme:available-themes>
+</theme:theme-selector></programlisting>
+
+ <para>Note that the first theme listed is the default theme.</para>
+
+ <para>Themes are defined in a properties file with the same name as the
+ theme. For example, the <literal>default</literal> theme is defined as a
+ set of entries in <literal> default.properties</literal>. For example,
+ <literal> default.properties</literal> might define:</para>
+
+ <programlisting>css ../screen.css
+template /template.xhtml</programlisting>
+
+ <para>Usually the entries in a theme resource bundle will be paths to CSS
+ styles or images and names of facelets templates (unlike localization
+ resource bundles which are usually text).</para>
+
+ <para>Now we can use these entries in our JSP or facelets pages. For
+ example, to theme the stylesheet in a facelets page:</para>
+
+ <programlisting role="XHTML"><link href="#{theme.css}" rel="stylesheet" type="text/css" /></programlisting>
+
+ <para>Or, when the page definition resides in a subdirectory:</para>
+
+ <programlisting role="XHTML"><link href="#{facesContext.externalContext.requestContextPath}#{theme.css}"
+ rel="stylesheet" type="text/css" /></programlisting>
+
+ <para>Most powerfully, facelets lets us theme the template used by a
+ <literal><ui:composition></literal>:</para>
+
+ <programlisting role="XHTML"><ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
- template="#{theme.template}">]]></programlisting>
-
- <para>
- Just like the locale selector, there is a built-in theme selector to allow
- the user to freely switch themes:
- </para>
+ template="#{theme.template}"></programlisting>
- <programlisting role="XHTML"><![CDATA[<h:selectOneMenu value="#{themeSelector.theme}">
- <f:selectItems value="#{themeSelector.themes}"/>
-</h:selectOneMenu>
-<h:commandButton action="#{themeSelector.select}" value="Select Theme"/>]]></programlisting>
+ <para>Just like the locale selector, there is a built-in theme selector to
+ allow the user to freely switch themes:</para>
- </section>
-
- <section>
- <title>Persisting locale and theme preferences via cookies</title>
- <para>
- The locale selector, theme selector and timezone selector all support
- persistence of locale and theme preference to a cookie. Simply set the
- <literal>cookie-enabled</literal> property in <literal>components.xml</literal>:
- </para>
-
- <programlisting role="XML"><![CDATA[<theme:theme-selector cookie-enabled="true">
- <theme:available-themes>
- <value>default</value>
- <value>accessible</value>
- <value>printable</value>
- </theme:available-themes>
-</theme:theme-selector>
+ <programlisting role="XHTML"><h:selectOneMenu value="#{themeSelector.theme}">
+ <f:selectItems value="#{themeSelector.themes}"/>
+</h:selectOneMenu>
+<h:commandButton action="#{themeSelector.select}" value="Select Theme"/></programlisting>
+ </section>
-<international:locale-selector cookie-enabled="true"/>]]></programlisting>
+ <section>
+ <title>Persisting locale and theme preferences via cookies</title>
- </section>
-
-</chapter>
+ <para>The locale selector, theme selector and timezone selector all
+ support persistence of locale and theme preference to a cookie. Simply set
+ the <literal>cookie-enabled</literal> property in
+ <literal>components.xml</literal>:</para>
+
+ <programlisting role="XML"><theme:theme-selector cookie-enabled="true">
+ <theme:available-themes>
+ <value>default</value>
+ <value>accessible</value>
+ <value>printable</value>
+ </theme:available-themes>
+</theme:theme-selector>
+
+<international:locale-selector cookie-enabled="true"/></programlisting>
+ </section>
+</chapter>
\ No newline at end of file
16 years, 6 months