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:
- Download jsf-impl-2.2.0-m12.jar and copy it to modules/com/sun/jsf-impl/main/ inside your JBoss 7.1 folder.
- Download jsf-api-2.2.0-m12.jar and copy it to modules/javax/faces/api/main/ inside your JBoss 7.1 folder.
- 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”/>).
- 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:
- Enjoy JSF 2.2 on JBoss 7.1.