The Jakarta JAXB migration adds a JAXB runtime to modules that create a JAXBContext - #1267
Merged
jkschneider merged 2 commits intoOct 4, 2026
Merged
Conversation
jkschneider
force-pushed
the
jakarta/jaxb-runtime-provider
branch
from
October 3, 2026 22:26
e7e14e2 to
d679785
Compare
jkschneider
added this pull request to stack #1284
October 4, 2026 09:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Java 8,
JAXBContext.newInstancefinds the JDK's built-in provider, which implements onlyjavax.xml.bind, so after the migration a standalone application compiles againstjakarta.xml.bindbut fails at runtime withClassNotFoundException: org.glassfish.jaxb.runtime.v2.ContextFactory. New scanning recipeAddJakartaXmlBindRuntime, run inJavaxXmlBindMigrationToJakartaXmlBindright after the API is added, findsJAXBContext.newInstancecalls, typed or matched through the import when the type is unresolved, and addsorg.glassfish.jaxb:jaxb-runtime:3.0.xto the nearest Maven module inruntimescope, ortestscope when only tests make the call. It skips modules that already have a provider (GlassFishjaxb-runtime, Sunjaxb-impl, EclipseLink MOXy), that declare a Java EE or Jakarta EE platform API asprovided, or that are packaged aswarorear, and modules that only use the JAXB annotations get nothing. #1257 has no counterpart to this: the Java 11 migration adds a runtime throughAddJaxbRuntime, and the Jakarta migration had none.Found by a team of coding agents reviewing a Moderne run of
org.openrewrite.java.migrate.jakarta.JavaxMigrationToJakartaover the 31 Arquillian repositories (run 20261003120559-YQoma). The issue isjaxb-runtime-missing-java8in the run'sio.moderne.RecipeIssuesdata table (2 rows), and the fix was discussed and reviewed on the run's message board. A row from the table, as a generalized example:Migrating Java 8 JAXB factory calls leaves standalone applications without a Jakarta JAXB provider. (
arquillian/arquillian-rusheye,rusheye-impl/pom.xml, recipeorg.openrewrite.java.migrate.jakarta.JavaxMigrationToJakarta)Before:
What the recipe produced:
Expected:
Stacked on #1266 (4 of 19); merge that one first.