How to use JSF 2.2 with JBoss AS 7.1

The JBoss Application Server 7.1 is shipped with Oracle Mojarra 2.1 in order to provide support for JSF 2.1. JSF 2.2 is only officially supported with the new WildFly 8, which is the successor of JBoss AS. As JSF 2.2 comes with a lot of new and interesting features such as HTML5 support and Faces Flow, I really wanted to get JSF 2.2 running.
First, I tried to get WildFly 8 up and running to make use of JSF 2.2. However, at the time of writing, WildFly 8.0.0 Alpha 4 is the latest version available. This one is really unstable and doesn’t integrate into Eclipse very well (I used the latest JBoss Tools 4.1).

On the other side, the latest version of Mojarra (JSF 2.2.2 Stable at the time of writing) doesn’t work with JBoss 7.1. You will see the following error message when deploying a JSF application to the AS:

No active contexts for scope type javax.faces.flow.builder.FlowDefinition

The latest version of JSF 2.2 I could get running on JBoss 7.1 is Mojarra JSF 2.2.0 Milestone 12.
Here is how:

  1. Download jsf-impl-2.2.0-m12.jar and copy it to modules/com/sun/jsf-impl/main/ inside your JBoss 7.1 folder.
  2. Download jsf-api-2.2.0-m12.jar and copy it to modules/javax/faces/api/main/ inside your JBoss 7.1 folder.
  3. Edit modules/com/sun/jsf-impl/main/module.xml so that the resource-root element points to the jsf-impl-2.2.0-m12.jar (<resource-root path=”jsf-impl-2.2.0-m12.jar”/>).
  4. Edit javax/faces/api/main/module.xml so that the resource-root element points to the jsf-api-2.2.0-m12.jar (<resource-root path=”jsf-api-2.2.0-m12.jar”/>) and add the following line to the <dependencies> element:
    <module name=”com.sun.jsf-impl”/>
  5. Enjoy JSF 2.2 on JBoss 7.1.

One thought on “How to use JSF 2.2 with JBoss AS 7.1”

  1. After writing your example and trying to use inputFile (available from JSF 2.2), I received the following exception:
    Tag Library supports namespace: http://java.sun.com/jsf/html, but no tag was defined for name: inputfile: javax.faces.view.facelets.TagException: /upload.xhtml @16,48 Tag Library supports namespace: http://java.sun.com/jsf/html, but no tag was defined for name: inputfile
    at com.sun.faces.facelets.compiler.CompilationManager.pushTag(CompilationManager.java:310) [jsf-impl-2.2.0-m12.jar:2.2.0-m12-SNAPSHOT]

Comments are closed.