From seam-commits at lists.jboss.org Tue Jan 29 11:17:05 2008 Content-Type: multipart/mixed; boundary="===============0747541869459193591==" MIME-Version: 1.0 From: seam-commits at lists.jboss.org To: seam-commits at lists.jboss.org Subject: [seam-commits] Seam SVN: r7288 - branches/Seam_2_0/doc/reference/en/modules. Date: Tue, 29 Jan 2008 11:17:05 -0500 Message-ID: --===============0747541869459193591== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: jbalunas(a)redhat.com Date: 2008-01-29 11:17:05 -0500 (Tue, 29 Jan 2008) New Revision: 7288 Modified: branches/Seam_2_0/doc/reference/en/modules/websphere.xml Log: added seam-gen section to chapter Modified: branches/Seam_2_0/doc/reference/en/modules/websphere.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/Seam_2_0/doc/reference/en/modules/websphere.xml 2008-01-29 15:= 35:53 UTC (rev 7287) +++ branches/Seam_2_0/doc/reference/en/modules/websphere.xml 2008-01-29 16:= 17:05 UTC (rev 7288) @@ -51,6 +51,13 @@ profile with the EJB3 feature pack enabled, or augment one of = your existing ones. This can also be done after the installation = by running the profile managment tool. + + A note about restarting the server + There are times that restarting the server will be required= after + deploying or changes the examples in this chapter. Its does no= t seem + like every change requires a restart. If you get errors or exc= eptions + after modifing a property or deploying an application try to r= estart + the server. =
@@ -940,4 +947,564 @@ =
= +
+ Deploying an application created using + <literal>seam-gen</literal> on Websphere 6.1.0.13 + = + seam-gen is a very useful tool for develope= rs + to quickly get an application up and running, and provides a foun= dation + to add your own functionality. Out of box seam-gen + will produce applications configured to run on JBoss AS. These + instructions will show the steps needed to get it to run on Websp= here. = + As stated above in the= re + are some tricky changes needed to get an EJB3 application running= . This + section will take you through the exact steps. + = + The first step is setting up seam-gen to + construct the base project. There are several choices made below, + specifically the datasource and hibernate values that we will adj= ust + once the project is created. + = + = + + = + Type ./seam new-project to create your + project and cd + /home/jbalunas/workspace/websphere_example to the + newly created structure. + = +
+
+ Changes needed for deployment to Websphere + We now need to make some changes to the generated project. +
+ Configuration file changes + + + + resources/META-INF/persistence-dev.xml + + + + + Alter the + jta-data-source to be + DefaultDatasource. We are + going to be using the integrated Websphere + DB. + + + Add or change the properties below. + These are described in detail at : + + = + + + + + +]]> + + + Remove the JBoss AS specific method of expo= sing + the EntityManagerFactory: + = + ]]> + + + You'll need to alter + persistence-prod.xml as + well if you want to deploy to Websphere using t= he + prod profile. + + + + + + + resources/GlassfishDerbyDialect.class + + + As with other examples we need to include this cla= ss for + DB support. It can be copied from the + jpa example into the + websphere_example/resources + directory. + = + + + + + + + resources/META-INF/jboss-app.xml + + + You can delete this file as we aren't deploying t= o JBoss + AS ( jboss-app.xml is used to enab= le + classloading isolation in JBoss AS) + + + + resources/*-ds.xml + + + You can delete these file as we aren't deploying = to + JBoss AS (these files define datasources in JBoss AS,= we + are using Websphere's default datasource) + + + + + resources/WEB-INF/components.xml + + + + + Enable container managed transaction + integration - add the + <transaction:ejb-transaction /> + component, and it's namespace + declaration + xmlns:transaction=3D"http://jboss.com/products/= seam/transaction" + + + + Alter the jndi-pattern + to + java:comp/env/websphere_example/#{ejbName} + + + + We do not need + managed-persistence-context + for this example and so can delete its + entry. + = + = + ]]> + + + + + + resources/WEB-INF/web.xml + + + Websphere does not support Servlet + 2.5, it required Servlet + 2.4. For this change we need to adjust the = top of + the web.xml file to look like the + following: + = + + + ]]> + = + As with the jee5/booking + example we need to add EJB references to the web.xml.= These + references require the empty + local-home to flag them for + Websphere to perform the proper binding. + = + = + = + websphere_example/AuthenticatorAction = = + Session = + + org.jboss.seam.tutorial.websphere.action.Authenticator = + + = + + websphere_example/EjbSynchronizations = + Session + + org.jboss.seam.transaction.LocalEjbSynchronizations + ]]> + + + +
+
+ Creating the <literal>AuthenticatorAction</literal> + EJB + We want to take the existing Authenticator + Seam POJO component and create an EJB3 out of it. + + + + + Rename the class to + AuthenticatorAction + + + Add the @Stateless + annotation to the new + AuthenticatorAction class. + + + + Create an interface called + Authenticator which + AuthenticatorAction + implements (EJB3 requires session beans to have a + local interface). Annotate the interface with + @Local , and add a single method + with same signature as the + authenticate in + AuthenticatorAction . + + + = + = + + = + = + + + + We've already added its reference to the + web.xml file so are good to go. + + +
+
+ Extra jar dependencies and other changes to the + <literal>build.xml</literal> + This application has similar requirements as the + jee5/booking example. + = + + + Change the default target to + archive (we aren't going to cover + automatic deployment to Websphere). + = + = + ]]><= /programlisting> + + + + Websphere looks for the drools + /security.drl file in the root of the + war file instead of the root of the + websphere_example.jar so we need + to have the build.xml move it to the + correct location at build time. The following must be ad= ded at + the top of the <target name=3D"war" + depends=3D"compile" description=3D"Build the distribution + .war file"> target. + = + + + + +]]> + + + We need to ge the + GlassfishDerbyDialect.class into + our application jar. To do that find the + jar task and modify the top of it so = that + it looks like this: + = + = + + + + + + + + +...]]> + + + + Next we need to get the + jboss-seam.jar into the base of the + EAR file. For deployment Websphere + requires this jar to be in both the /lib + directory and at the base of the EAR.= You + must add the following to the archive + task: + = + = + + +]]> + So that the whole archive task loo= ks + like: + = + = + + + + + + + + + + + + + +]]> + + + Now we need to get extra jars into the = + build.xml. Look for the = + <fileset dir=3D"${basedir}"> se= ction = + of the task below. Add the new includes at the bottom o= f = + the fileset. + + = + = + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + Hibernate dependencies + + + + + + + ]]> + + + JSF dependencies. You will need to copy the = + el-ri.jar from the = + $SEAM/examples/jpa/lib directory.<= /para> + + + + + ]]> + + + Third party dependencies. You will need to co= py the + jboss-archive-browsing.jar from th= e = + $SEAM/examples/jpa/lib directory i= nto the = + the projects /lib directory. You = will = + also need to acquire the concurrent.jar = + and place it in the same directory. You can get this= from = + any jboss distribution or just search for it. + + + + + + + + + + + ]]> + + + jboss-seam.jar - this is nee= ded in + both the ear base and = + /lib + directory. + + ]]> + + + = + You should end up with something like: + + + + + + + + + + = + + + + + + + + = + + + + + + = + + + + + + + + + + + + = + + + = +]]> + + + = +
+
+ Building and deploying the seam-gen'd application to Webs= phere + + = + = + + + Build your application by calling + ant in the base directory of your + project (ex. + /home/jbalunas/workspace/websphere_example + ). The target of the build will be + dist/websphere_example.ear . + + = + + To deploy the application follow the instructions her= e : = + but use refere= nces to + this project websphere_example instea= d of + jboss-seam-jee5. + + + Checkout the app at: + http://localhost:9080/websphere_example/index.html= + + + + = +
+
+ = --===============0747541869459193591==--