Search This Blog

Tuesday, November 13, 2018

How to Upgrade Mojarra (JSF) in WildFly

WildFly uses Mojarra as JSF reference implementation. WildFly 9.0.0 ships with Mojarra version 2.2.10. Sometimes you'd like to upgrade Mojarra in WildFly, because you need a bugfix which is only available in a newer version.
  1. Download the Mojarra version to your choice. You need 2 separate JAR files, one with the JSF API (the javax.faces.*classes) and another with the JSF impl (the com.sun.faces.* classes). Scroll to the bottom of the page to pick the newest version. 
  2. Make sure that WildFly is shutdown.
  3. Update JSF API in \wildfly-location\modules\system\layers\base\javax\faces\api\main:
    • Delete or backup the existing JAR file (do NOT keep it in the same folder, even not renamed!).
    • Put jsf-api-2.2.10.jar in there.
    • Open module.xml file for editing and edit the <resource-root> to specify the new file name as in<resource-root path="jsf-api-2.2.10.jar"/>
  4. Update JSF impl in \wildfly-location\modules\system\layers\base\com\sun\jsf-impl\main:
    • Delete or backup the existing JAR file (do NOT keep it in the same folder, even not renamed!).
    • Put jsf-impl-2.2.10.jar in there.
    • Open module.xml file for editing and edit the <resource-root> to specify the new file name as in<resource-root path="jsf-impl-2.2.10.jar"/>
  5. Cleanup WildFly cache/work data just to make sure that there's no old copy of the JARs from previous deployments hanging in there which would potentially only collide with the new JARs:
    • Trash all contents of \wildfly-location\standalone\data (expect of custom data folders like folder containing uploaded files, of course)
    • Trash all contents of \wildfly-location\standalone\deployments
    • Trash all contents of \wildfly-location\standalone\tmp
Done.