Skip to content

Migrate Mojarra and Glassfish JSF dependencies to Jakarta Faces#1040

Merged
timtebeek merged 2 commits intomainfrom
tim/jsf-mojarra-jakarta-faces
Apr 2, 2026
Merged

Migrate Mojarra and Glassfish JSF dependencies to Jakarta Faces#1040
timtebeek merged 2 commits intomainfrom
tim/jsf-mojarra-jakarta-faces

Conversation

@timtebeek
Copy link
Copy Markdown
Member

@timtebeek timtebeek commented Apr 2, 2026

Summary

  • Add ChangeDependency rules for com.sun.faces:jsf-api and com.sun.faces:jsf-impl (Mojarra) to the Faces2xMigrationToJakartaFaces3x recipe chain
  • Add ChangeDependency rule for org.glassfish:javax.faces to the same chain
  • Add UpgradeDependencyVersion for org.glassfish:jakarta.faces in the Faces 4.x migration
  • Add test coverage for all three dependency migration paths

Context

Customers migrating JSF 2.x applications to Spring 6 encounter a ClassCastException at runtime:

java.lang.ClassCastException: class org.springframework.web.jsf.el.SpringBeanFacesELResolver
cannot be cast to class javax.el.ELResolver

This happens because Spring 6 uses Jakarta EE (jakarta.el.ELResolver), but the JSF runtime stays on javax.el when using Mojarra (com.sun.faces) or Glassfish (org.glassfish:javax.faces) artifacts — these were not covered by the existing UpdateJakartaFacesApi3 recipe which only handled javax.faces:javax.faces-api.

  • Fixes moderneinc/customer-requests#2160

Test plan

  • UpdateJakartaFacesApiTest.Faces3.migrateSunFacesJsfApi — verifies com.sun.faces:jsf-apijakarta.faces:jakarta.faces-api:3.0.x
  • UpdateJakartaFacesApiTest.Faces3.migrateSunFacesJsfImpl — verifies com.sun.faces:jsf-implorg.glassfish:jakarta.faces:3.0.x
  • UpdateJakartaFacesApiTest.Faces3.migrateGlassfishJavaxFaces — verifies org.glassfish:javax.facesorg.glassfish:jakarta.faces:3.0.x
  • UpdateJakartaFacesApiTest.Faces4.upgradeGlassfishJakartaFaces — verifies org.glassfish:jakarta.faces upgrade to 4.0.x

…arta Faces

The JSF 2.x to Jakarta Faces migration recipes only handled javax.faces:javax.faces-api,
missing the widely-used Mojarra (com.sun.faces:jsf-api, com.sun.faces:jsf-impl) and
Glassfish (org.glassfish:javax.faces) artifacts. This caused ClassCastException at runtime
when upgrading to Spring 6 because the JSF runtime stayed on javax.el while Spring 6
uses jakarta.el.

Adds ChangeDependency rules for com.sun.faces and org.glassfish:javax.faces in the
Faces 3.x migration, and UpgradeDependencyVersion for org.glassfish:jakarta.faces in
the Faces 4.x migration.

Fixes moderneinc/customer-requests#2160
@timtebeek timtebeek merged commit 2c285d5 into main Apr 2, 2026
1 check passed
@timtebeek timtebeek deleted the tim/jsf-mojarra-jakarta-faces branch April 2, 2026 18:08
@github-project-automation github-project-automation bot moved this from In Progress to Done in OpenRewrite Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant