Skip to content

Running the SEAM Booking demo on Glassfish & Netbeans

July 5, 2006

For those of you interested in playing with JBoss
on Glassfish, here are some tips which will hopefully get
you going.

Disclaimer: I got this working, but I don‘t claim that my
hacks are the right solution. There seem to be a few quirks/bugs in
the booking demo that are problematic on Glassfish.

Before proceeding you will want to read Brian
and Roger’s
blogs on the subject.

Here are the modifications that I made to the demo (note, no
modifications to SEAM 1.0.1. are required):

Create a Netbeans enterprise project

You might want to use Brian‘s Netbeans project as a starting
point, or alternatively (the route I chose) – create a Netbeans
enterprise project and import the SEAM booking demo code into the

Update ejb-jar.xml

The ejb-jar from the example contained the binding declaration,
but was missing the interceptor definition (I gather JBoss App Server
does not require this). This is what my modified ejb-jar.xml looks

<!– use other elements as per your requirement–>
<!– define other interceptors here–>

Update web.xml

The web.xml setup is esentially as per the SEAM documentation with
the caveat that Glassfish requires you to declare local ref‘s
to your session beans (There is probably a good reason for this –
but JBoss seems to get away without these declarations). Here is the
modified web.xml (note that I named my project “reservit”
and this is reflected in the ejb local ref‘s. You will need to
update this to match your project deployment descriptor).

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="" xmlns:xsi="" xsi:schemaLocation="">
<!– Seam –>
<!– Propagate conversations across redirects –>
<filter-name>Seam Redirect Filter</filter-name>
<filter-name>Seam Redirect Filter</filter-name>
<!– JSF –>
<!– Todo: this is already provided in the init code – not sure if it is needed
<servlet-name>Faces Servlet</servlet-name>
<!– Faces Servlet Mapping –>
<servlet-name>Faces Servlet</servlet-name>

Update the JPQL queries.

I found the booking example queries would not parse correctly with
the Glassfish/Toplink persistence manager [note: you need to update
the persistence.xml file to use Glassfish/Toplink]. I presume this is
a standard‘s thing – but I don‘t know which
implementation is correct. You will need to change queries of the

bookings = em.createQuery("from Booking b
where b.user.username = :username order by b.checkinDate")

To this:

bookings = em.createQuery("select b
from Booking b where b.user.username = :username order by

Fix the s:link tags

I found that the linkStyle=“button” attribute of the
SEAM link tag causes XML parsing errors. This could be a facelets
and/or JSF 1.2 bug? (suggestions welcome). I removed this attribute –
which fixes the XML parsing error at the expense of not rendering the
link as a button. Change this:

<s:link value="Cancel" action="login" linkStyle="button" buttonClass="button"/>

To this:

<s:link value="Cancel" action="login" buttonClass="button"/>

Fix XML parsing wierdness.

This falls into the not-really-sure-what-I-am-doing category. I
found a lot of parsing errors with the facelet .xhtml files. In

  1. I found the DOCTYPE header on most
    of the .xhtml files caused problems. This appears to be related to
    the facelets templating mechanism. Getting rid of the header made
    this problem go away.

  2. Non breaking spaces such as
    amp;nbsp; or amp;#160; caused parsing problems. Once again –
    this looks like some kind of templating problem.

  3. Beware of comments. While experimenting I would often put
    suspect code in XML comments. That is, until I realized the comments
    are parsed by the facelets template engine, causing runtime parsing

If you have suggestions please leave a comment!

One Comment
  1. Asaf permalink
    July 6, 2006 4:19 am

    Looks good,
    I was wondering, did you manage to port the ‘selectItems’ dataBinder registration sample?
    It only works for Jboss, in glassfish it fails, I was happy to see this working, many components are dependent on the ‘selectItems’ option….
    here’s the link for the app, just in case 🙂


Comments are closed.

%d bloggers like this: