Thursday, July 12, 2007

JBoss Seam Configurations - JARs and Details

I've sucessfully implemented NetBeans 6.0 M10 and Netbeans 5.5.1 projects using the JBOSS Seam framework. I can successfully deploy these projects to both Glassfish V1, JBoss 4.2.0, and JBoss 4.1. This blog post is a log so that I can remember the specific JAR files and details required for each of these projects. I intend to add onto this blog as time goes on and I encounter more detailed information.

Seam 1.2.1 GA and Glassfish V1:
This project utilizes the Ajax4Jsf and RichFaces APIs. I have been unable to make this setup work with Glassfish V2 as yet. If you have figured that one out, please let me know.

Follow these steps in either NB 5.5.1 or NB 6.0 M10

1) Create new Enterprise Application, and also create the following libraries within the IDE:

jbpm-3.1.2.jar (If you plan to use JBpm...I have not tested as yet)


2) Add those two libraries to your ejb sub-project along with these others:
jsf-facelets.jar (unless you intend to add facelets support via the ide)

3) Add the following JARs to your war sub-project:
dom4j.jar (may not need this one...)

4) Add configuration files to your ejb sub-project:
a) Add ejb-jar.xml to src/conf
b) Create empty within src/conf
c) Create log4j.xml within src/conf
- Easiest configuration is to copy one of the log4j.xml files contained in the
example projects within the Seam 1.2.1 GA download.
d) Create persistence.xml within src/conf
- Use NetBeans to create persistence unit by right-clicking on the ejb sub-project
and then selecting New->Persistence Unit. Follow directions to create a unit
based upon one of the existing database connections you have defined in the IDE.
I use Toplink by default, but Hibernate works just as well.

5) Add configuration files to your war sub-project
a) Configure web.xml and faces-config.xml as suggested in Carol McDonald's Blog or Brian Leonard's Blog. It is also a good idea to take a look at the web.xml file from within one of the sample projects which comes with your Seam download. You will require a Seam filter, and Ajax4Jsf context-parameter if you plan to use that technology. I almost always use the same configuration contained within the sample project web.xml files, but also add the ejb references as discussed in the blog posts above.
b) Make sure the following additional xml files reside within your WEB-INF directory:
components.xml - Copy and use the one from the glassfish example in your Seam download. You will need to update it according to your ejb project name.
pages.xml - this one can be left blank
c) You may need to add META-INF to root of web pages and place application.xml within it.

I'll add the other configurations as time goes on, but this one will get you started with Seam application development on Glassfish V1.


  1. Anonymous3:30 PM


    So what is the big deal with seam then ?
    Full with my stuff which is J2EE 1.5 and going into EJB 3.0, using struts 1.2.x, catching up with Eclipse and Netbeans.

    writing this small CRM app for a friend with a small company, using struts and hibernate, but refactoring it now to use ejb 3.0 instead and struts ( that is what i know). do you think seam could help me out here ?

    regards, i

  2. So, if you are planning to use JSF for your application then I believe that SEAM may help you out. You should probably brush up on JSF first since it takes care of the front end code like Struts...and I feel that JSF is a more flexible framework than Struts (I will probably get in trouble for saying that). I do not know if SEAM works with Struts as it was created for use with JSF.

    There is significantly less management between the application code and the front end when using SEAM with JSF. SEAM helps to make the user interface work "seamlessly" with the back end business logic in various ways. There is no need to define each managed bean within the faces-config file, DataModel objects can be tied directly to a front end DataTable, and so forth.

    SEAM also includes logging and faces messaging out-of-the-box. There are also several front-end components that SEAM makes available to help assist in UI development.

    If you are using SEAM and JSF, then you should probably use Facelets as well. It is easy to pick up and it helps to lay out web pages more easily via it's "templating" solution. Similar to Struts tiles.


Please leave a comment...