I wanted to start an EAR project with Seam 2 and my other favorite technologies: JSF 2 and PrimeFaces 2, but I discovered that it can’t be done. So here are a bunch of notes and considerations on the subject.

  1. JBoss Tools has the Maven integration, which generates nice “Mavenized” projects. However, the application.xml that is automatically generated is invalid and the EAR won’t deploy (at least in JBoss AS 6). That’s because of the ‘/’ at the beginning of the modules. Removing the ‘/’ manually should solve the issue, I thought. But…
  2. application.xml keeps getting regenerated (wrong) at every build/republish! That’s annoying. I read on stackoverflow that it’s M2Eclipse’s fault, rather than Maven’s, and that the problem can be worked around this way (which does not work):
  3. <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ear-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
            <version>5</version>
            <!-- The following line should do the trick: -->
            <earSourceExcludes>**/application.xml</earSourceExcludes>
            <generateApplicationXml>true</generateApplicationXml>
        </configuration>
    </plugin>
    

    This workaround does not work. Setting <generateApplicationXml> to false seems to work instead.

  4. JSF 2 does NOT work with Seam 2. No way. Forget it. Some Seam 2 developers say it works. They lie! JSF 2 may be supported in Seam 2.3, which is supposed to come out in Q2 2011. JSF 2 is supported by Seam 3 though. So, we stick with JSF 1.2
  5. PrimeFaces 2.x does NOT work with JSF 1.2. If you want use PrimeFaces in your JSF 1.2 project, then you must use PrimeFaces 1.1, which can be downloaded here.
  6. But, wait! There’s no documentation nor showcase nor support of PrimeFaces 1.1 anymore, so we have to use RichFaces.
  7. But it’s not over yet! RichFaces 4 does NOT work with JSF 1.2! If you are using JSF 1.2, stick to RichFaces 3.3.3.Final instead.
  8. If you are using JSF 1.2, when you add tomahawk’s dependency, look for tomahawk12!
  9. tomahawk does not work with Mojarra, which is the default JSF implementation used by JBoss. Here it says that to override this behaviour, you have to modify your web.xml:
  10. <context-param>
          <param-name>org.jboss.jbossfaces.JSF_CONFIG_NAME</param-name>
          <param-value>MyFaces-2.0</param-value>
     </context-param>
    

    Too bad your application won’t deploy because, as I said before, SEAM 2 DOES NOT WORK WITH JSF 2!!!

  11. Why the heck doesn’t JBoss AS 6 have MyFaces 1.2 ?!?!?!? It comes with all the other JSF implementations, but not that one…
  12. tomahawk12 may not work with Mojarra 1.2, which is the JSF 1.2 implementation used by JBoss AS 6. I have to test this. Anyway, if you want to use tomahawk just for the fileUpload and inputDate, RichFaces 3.3.3. Final already has those components. ;)
  13. RichFaces 3.3.3 is designed to work with JSF 1.2. It can work with JSF 2, but it requires some adjustment in your projects. Se here for details.

Why not use Seam 3, then? Because JBoss Tools doesn’t support Seam 3 yet. Don’t you love when a framework comes out but there are no tools to leverage it for at least 1 year?  -_-

To wrap up:

  • To use Seam 2, you must use JSF 1.2.
  • That forces your to use RichFaces 3.3.3
  • To use tomahawk, you must use the MyFaces implementation.
  • You have to stick to MyFaces 1.2 and you think that your problems are over. NOT!
  • JBoss doesn’t bundle the MyFaces 1.2 implementation!
  • So, you must bundle MyFaces 1.2 in your WAR as explained here.

In conclusion, the technology stack to use:

  • JBoss AS 6,
  • Seam 2.2.2.Final,
  • RichFaces 3.3.3.Final / PrimeFaces 1.1,
  • tomahawk12 (optional),
  • MyFaces 1.2 bundled in your WAR. (if you want tomahawk12)

The projects for a Seam project for the aformentioned stack can be downloaded from:

http://www.filesonic.com/file/1062906121/seam-basic-project.zip

To import the project:

File –> Import –> General –> Archive File

The requirements for the project to work are as follows:

  • Eclipse 3.6
  • JBoss Tools with JBoss Maven Integration
  • M2Eclipse

(Everything must be updated to the latest version)

 

Leave a Reply