Monthly Archives: December 2009

Jboss 5.1 and Seam 2 Redeployment issue workaround

When trying to work with Seam 2.2 applications in JBoss 5.1 you might have come across a very annoying redeploy cycle of your application. I will document the issue and workaround here.
Beginning with Seam 2.2 and JBoss 5.1 is pretty straight forward. But you could soon run into issues if you don’t pay attention to the details.

The Journey

  1. I had decided to give Seam a try after having dig into some seam docs. The first thing was to try out the examples that come bundled with seam.
  2. Seam is pretty easy to start off with. You just need to get a copy of JBoss 5.1 and Seam 2.2 (the latest during this post). Then as mentioned in the Running Seam in Jboss Just do the below two steps:
    1. Edit build.properties in your Seam directory and configure the jboss.home property to be your JBoss AS installation directory.
    2. In the jboss-seam/examples/booking directory, type ant deploy. (Here booking is one example you can do it with any other)
  3. ant deploy command will generate the (War/Ear/Ejb) artifacts and dump it into the deploy folder of JBoss AS.
  4. If JBoss is running you should see the console output showing the deployment taking place.
  5. Just point your browser to the deployed apps URL and voila.

When you start building your own application using either the seam commands or Jboss Tools plugin for Eclipse, you will notice quite a few artifacts getting generated (Not all are needed).

When you deploy your project and find that none of the @Name annotated classes are getting found. Check for seam.properties file this must be in your classpath. It’s an empty file but acts like a marker which triggers the scanning of your seam components. Without that file you will need to register each component in your components.xml file.

This should solve your problem, but under JBoss 5.1 you might run into another issue of constant undeploy/deploy of your project without any details as to why in the logs. If you look in the Seam documentation WhatHappensWhenYouDeploySeamAppInJBoss5 and couple of other JBoss JIRA pages you will find that mostly this happens due to IDE generated files getting placed under WEB-INF check for these and delete them. The files get generated when you open the pages.xml or web.xml kind of files in Visual Editor.

Even after following the simple & complex advice the problem sometimes just won’t go. What i noticed was that the presence of seam.properties file under WEB-INF/classes will also trigger the dreadful redeployment of your application. If you look in the seam reference docs for possible locations of seam.properties, you will find that it needs to be in your classes/ root or META-INF directory of a JAR. So an easier solutions is to just “move the seam.properties from WEB-INF/classes to WEB-INF/classes/META-INF” and voila the problem should be solved without any fancy modification to your JBoss AS.

I hope this helps you to get on with building your Seam applications.