Skip to content

Upgrade to Java 21, Jetty 12 EE10, and Jakarta EE 10#9

Open
devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
devin/1776901882-java21-upgrade
Open

Upgrade to Java 21, Jetty 12 EE10, and Jakarta EE 10#9
devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
devin/1776901882-java21-upgrade

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented Apr 22, 2026

Summary

Upgrades the java8-examples repo from Java 8 / Jetty 9 / javax.* to Java 21 / Jetty 12 (EE10) / Jakarta EE 10 (jakarta.*).

Parent pom.xml

  • Renamed to "Example Java 21 Projects".
  • Replaced maven.compiler.source/target=1.8 with maven.compiler.release=21.
  • Added pluginManagement pinning maven-compiler-plugin to 3.13.0 (Maven 3.6's default compiler plugin is 3.1, which does not understand the release property and fails with "Source option 5 is no longer supported"). This was not in the original task instructions but was necessary to make the build actually compile.

jetty-maven-cdi/pom.xml

  • javax.servlet:javax.servlet-api:3.1.0jakarta.servlet:jakarta.servlet-api:6.0.0.
  • javax.enterprise:cdi-api:1.2 (with javax.el exclusion, provided scope) → jakarta.enterprise:jakarta.enterprise.cdi-api:4.0.1 at compile scope. The provided scope was dropped because Jetty 12 is not a full Jakarta EE container — the webapp classloader needs jakarta.enterprise.inject.spi.BeanManager on its classpath so Jetty can resolve the <resource-env-ref-type> in web-overwrite.xml.
  • maven-war-plugin 2.5 → 3.4.0.
  • org.eclipse.jetty:jetty-maven-plugin:9.2.5.v20141112org.eclipse.jetty.ee10:jetty-ee10-maven-plugin:12.0.14.
  • weld-servlet:2.2.7.Finalweld-servlet-shaded:5.1.5.Final. Task instructions specified 5.1.2.Final, but 5.1.2 fails at startup with NoClassDefFoundError: org.eclipse.jetty.server.handler.ContextHandler$Context because its LegacyWeldDecorator still references a Jetty 9/10/11 inner class that does not exist in Jetty 12. 5.1.3+ adds Jetty 12 detection (WELD-ENV-001213: Jetty CDI SPI support detected).
  • Added org.eclipse.jetty.ee10:jetty-ee10-cdi:12.0.14 to the Jetty plugin dependencies so the CdiDecoratingListener/CdiSpiDecorator classes are available.

XML configs

  • web.xml and web-overwrite.xml: namespace updated from http://java.sun.com/xml/ns/javaee + web-app_3_0.xsd to https://jakarta.ee/xml/ns/jakartaee + web-app_6_0.xsd, version 3.0 → 6.0.
  • web-overwrite.xml: resource-env-ref-type updated to jakarta.enterprise.inject.spi.BeanManager.
  • jetty-env.xml and jetty-context.xml: DTD updated to https://jetty.org/configure_10_0.dtd with public id -//Jetty//Configure//EN (the task-suggested http://www.eclipse.org/jetty/configure_10.dtd 301-redirects and fails SAX parsing). org.eclipse.jetty.webapp.WebAppContextorg.eclipse.jetty.ee10.webapp.WebAppContext; org.eclipse.jetty.servlet.ServletContextHandler.Decoratororg.eclipse.jetty.ee10.servlet.ServletContextHandler.Decorator. BeanManager JNDI class arg updated to jakarta.enterprise.inject.spi.BeanManager. javax.naming.Reference kept as-is (JDK, not Jakarta EE).
  • jetty-env.xml: <Ref id="wac" /><Ref refid="wac" /> (required by the Jetty 10 DTD; reusing id on a reference violates the DTD's ID-uniqueness rule and causes a SAX parse error).
  • jetty-context.xml: the serverClasses setter no longer exists in Jetty 12. Converted to the new getHiddenClassMatcher().add(...) API. Also added setAttribute("org.eclipse.jetty.cdi", "CdiDecoratingListener") so Jetty installs its CDI decorator during context startup (required for Weld's Jetty integration in EE10).
  • New beans.xml: the file was previously 0 bytes, which Weld 5.x rejects with WELD-ENV-000028: Weld initialization skipped - no bean archive found. Added a minimal CDI 4.0 beans.xml with bean-discovery-mode="all" so DefaultGreeting and MainServlet are discovered.

Java sources (the task description said there were none — there were three)

  • MainServlet.java, DefaultGreeting.java: all javax.servlet.*, javax.inject.*, javax.enterprise.*, javax.annotation.PostConstruct imports migrated to jakarta.*. javax.naming.* left alone (JDK).

README.md

  • Updated stack to Ubuntu 24.04 LTS / OpenJDK 21 / Maven 3.9.x. Removed the NetBeans reference.

Review & Testing Checklist for Human

  • Runtime CDI injection is still broken at HEAD. mvn clean package succeeds and mvn jetty:run starts the server on :8080, but the webapp context fails to deploy with WELD-001408: Unsatisfied dependencies for type BeanManager with qualifiers @Default at DefaultGreeting.bm and Unsatisfied dependencies for type Event<String> with qualifiers @Default at MainServlet.event — so GET / returns HTTP 503. BeanManager and Event<T> are built-in beans that should always be available, so this looks like a Weld-Jetty 12 bootstrap ordering issue rather than a missing dependency. This needs to be resolved before this PR is production-ready. The three other working states (package builds, server listens, Weld detects the Jetty CDI SPI) are all real but are not sufficient.
  • Weld 5.1.5 vs. task-specified 5.1.2. I bumped this against the instructions because 5.1.2 is provably incompatible with Jetty 12 (throws NoClassDefFoundError: org.eclipse.jetty.server.handler.ContextHandler$Context). Please confirm this deviation is acceptable.
  • CDI API scope change (provided → compile). This bundles jakarta.enterprise.cdi-api into the WAR. This is necessary because Jetty 12 doesn't provide the Jakarta CDI API from the container, but if this module is ever deployed to a real Jakarta EE 10 server, the bundled API may conflict with the server's.
  • maven-compiler-plugin pinning in the parent POM — required for Maven ≤3.8 to build with release=21. Confirm this is acceptable or let me know if you'd rather enforce a newer Maven version.
  • New beans.xml with bean-discovery-mode="all". The file existed but was empty. Jakarta CDI 4.0 treats an empty file as annotated-mode, but Weld 5.x logged no bean archive found for the zero-byte file. Populating it is required for bean discovery; please confirm the discovery mode is appropriate.

Suggested test plan for the human

  1. mvn clean package at the repo root and inside jetty-maven-cdi/ — both should succeed (verified).
  2. cd jetty-maven-cdi && mvn jetty:run.
  3. curl http://localhost:8080/ — expected Hello web-overwrite.xml! with BeanManager injection succeeded and BeanManager JNDI lookup succeeded in the server logs. Currently returns 503 due to the Weld WELD-001408 errors above; this is the blocker to resolve.

Notes

  • The parent pom.xml has no <modules> entry, so mvn clean install at the root only installs the parent POM and does not build jetty-maven-cdi. The WAR is built by running Maven inside jetty-maven-cdi/ directly. Not changed here, but worth knowing when reviewing CI/build scripts.
  • nbactions.xml intentionally not changed (the jetty:run goal name continues to work under the renamed plugin).
  • Weld 6.0.2.Final was also tried but produced the same WELD-001408 failure, so I stayed on Weld 5.1.5.Final (still CDI 4.0) to match the Jakarta EE 10 target.

Link to Devin session: https://app.devin.ai/sessions/2ef2259e1f88440c9456e85bf516080d
Requested by: @travismyers-png

Co-Authored-By: Travis Myers <travis.myers@cognition.ai>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants