Java EE SDK Runs Seam
content="text/html; charset=ISO-8859-1">
I am happy to report that Seam
(the JBoss application framework that unifies JSF and EJB 3.0) runs on href="https://glassfish.dev.java.net/">GlassFish, the Open Source
Application Server from which the Java EE SDK is built. This
required some modifications and rebuilding of Seam source code, mainly
because of the repackaging of EJB classes in accordance to the latest
EJB specification implementation. JBoss is making the required
changes, but for those of you who can't wait, I'll describe those
changes and setup necessary to get a Seam application up and running on
GlassFish. Also, I'd like to point out, that these instructions
are for the Seam 1.0beta2 release. Recently JBoss has released a
later version, but the interceptor related packaging changes are not
there. First, let's install the
patches and get the Seam Booking application up and running.
Prerequisites:
- A working build environment with ant,
at least JDK 5,
and href="https://glassfish.dev.java.net/public/downloadsindex.html#Official_supported_builds">GlassFish
(build 43 or later). - For this application, you will also need to make sure you have
the compatable Hibernate libraries with GlassFish: - Download and install
href="http://sourceforge.net/project/showfiles.php?group_id=40712&package_id=127784&release_id=405151">Hibernate3
3.2cr1 or later. - Download and install
href="http://sourceforge.net/project/showfiles.php?group_id=40712&package_id=156160&release_id=405227">Hibernate
EntityManager 3.1 beta7 or later. - Copy the required hibernate jars into Glassfish lib dir.
The script href="http://blogs.sun.com/roller/resources/GlassFishPersistence/copyHibernateLibs.sh">here
contains the list of jars. - Edit the script to make sure it references your Glassfish and
Hibernate install directories. - Execute the script.
Seam Setup:
- Download and install the Seam 1.0beta2 release from
href="http://prdownloads.sourceforge.net/jboss/jboss-seam-1.0beta2.zip?download">here.
You should see a jboss-seam-1.0beta2 directory.
- Get the zip files:
href="http://weblogs.java.net/blog/rogerk/archive/seam-core-patch.zip">seam-core-patch.zip
and href="http://weblogs.java.net/blog/rogerk/archive/seam-booking-patch.zip">seam-booking-patch.zip
.
- Go to the jboss-seam-1.0beta2 directory and unzip
seam-core-patch.zip and seam-booking-patch.zip.
Compilation Procedure:
- Copy <glassfish install
dir>/lib/javaee.jar
to jboss-seam-1.0beta2/lib directory. - Copy jboss-seam-1.0beta2/lib/jboss-common.jar
style="font-style: italic;"><glassfish install dir>/lib
(needed for JBoss Logger)
- Compile Seam core classes:
- Create an empty jboss-seam-1.0beta2/src/test directory (the
build file is looking for this directory that is not there from the
seam zip file).
- Go to jboss-seam-1.0beta2 directory; ant;
- Compile Seam Booking Application:
- Copy jboss-seam-1.0beta2/jboss-seam-ui.jar to
jboss-seam-1.0beta2/examples/booking/resources/WEB-INF/lib - Go to jboss-seam-1.0beta2/examples/booking
- ant
Deploy and run the application:
- Start up Glassfish.
- Start the database: <glassfish
install dir>/bin/asadmin
start-database - Deploy
jboss-seam-1.0beta2/examples/booking/build/jboss-seam-booking.ear - Visit localhost:8080/seam-booking
Now, here is an explanation of changed modules. The current JBoss
Seam codebase is not up to date with the latest EJB specification (and
implementation - as in GlassFish). Seam classes still reference
EJB interceptor related classes in the
style="font-style: italic;">javax.ejb package, but these now
exist in the javax.interceptor
package. JBoss will be updating their source, but I am not clear
on when that will happen.
Core classes:
src/main/org/jboss/seam/Component.java
src/main/org/jboss/seam/ejb/SeamInterceptor.java
src/main/org/jboss/seam/interceptors/BijectionInterceptor.java
src/main/org/jboss/seam/interceptors/BusinessProcessInterceptor.java
src/main/org/jboss/seam/interceptors/ConversationInterceptor.java
src/main/org/jboss/seam/interceptors/Interceptor.java
src/main/org/jboss/seam/interceptors/JavaBeanInterceptor.java
src/main/org/jboss/seam/interceptors/OutcomeInterceptor.java
src/main/org/jboss/seam/interceptors/RemoveInterceptor.java
src/main/org/jboss/seam/interceptors/RollbackInterceptor.java
src/main/org/jboss/seam/interceptors/SeamInvocationContext.java
src/main/org/jboss/seam/interceptors/ValidationInterceptor.java
style="font-style: italic;">----> interceptor package changes
described above
src/main/org/jboss/seam/jsf/SeamPhaseListener.java
style="font-style: italic;">----> moved initilialization of
SeamVariableResolver, SeamNavigationHandler, SeamStateManager to
faces-config.xml, so they get created at startup.
src/main/org/jboss/seam/jsf/SeamStateManager.java
style="font-style: italic;">----> new class taken from
StateManagerInterceptor class in SeamPhaseListener
src/main/META-INF/faces-config.xml
---->
style="font-style: italic;">defines
style="font-style: italic;">SeamVariableResolver,
SeamNavigationHandler, SeamStateManager
---->
modified component definition for HtmlQueryTable
src/main/org/jboss/seam/mock/MockServletContext.java
style="font-style: italic;">----> stubbed in public String
getContextPath() method
Booking Application Modules:
examples/booking/resources/import.sql
examples/booking/resources/META-INF/persistence.xml
style="font-style: italic;">----> updated for application with
GlassFish
examples/booking/resources/WEB-INF/web.xml
style="font-style: italic;">----> reference 2.5 schema, etc..
style="font-style: italic;">
----> modified JNDI name pattern for EJB lookups
style="font-style: italic;">
----> disabled MyFaces StartupServletContextListener (not compatable
with JSF 1.2)
----> added <ejb-local-ref> elements for EJB modules
examples/booking/src/org/jboss/seam/example/booking/BookingListAction.java
examples/booking/src/org/jboss/seam/example/booking/ChangePasswordAction.java
examples/booking/src/org/jboss/seam/example/booking/HotelBookingAction.java
examples/booking/src/org/jboss/seam/example/booking/LoggedInInterceptor.java
examples/booking/src/org/jboss/seam/example/booking/LoggedIn.java
examples/booking/src/org/jboss/seam/example/booking/LoginAction.java
examples/booking/src/org/jboss/seam/example/booking/LogoutAction.java
examples/booking/src/org/jboss/seam/example/booking/RegisterAction.java
----> interceptor package changes described above
examples/booking/src/org/jboss/seam/example/booking/User.java
style="font-style: italic;">----> create "Users" table and
reference it as "user" (User is reserved in javaee5)
examples/booking/view/main.xhtml
examples/booking/view/template.xhtml
style="font-style: italic;">----> added missing JSF "form" tags
- Login or register to post comments
- Printer-friendly version
- rogerk's blog
- 1767 reads





