Upgrade to Java 21, Jetty 12 EE10, and Jakarta EE 10#9
Open
devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
Open
Upgrade to Java 21, Jetty 12 EE10, and Jakarta EE 10#9devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
Conversation
Co-Authored-By: Travis Myers <travis.myers@cognition.ai>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
…e10-cdi, fix XML DTD/refid/ClassMatcher
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.
Summary
Upgrades the
java8-examplesrepo from Java 8 / Jetty 9 /javax.*to Java 21 / Jetty 12 (EE10) / Jakarta EE 10 (jakarta.*).Parent
pom.xmlmaven.compiler.source/target=1.8withmaven.compiler.release=21.pluginManagementpinningmaven-compiler-pluginto3.13.0(Maven 3.6's default compiler plugin is 3.1, which does not understand thereleaseproperty 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.xmljavax.servlet:javax.servlet-api:3.1.0→jakarta.servlet:jakarta.servlet-api:6.0.0.javax.enterprise:cdi-api:1.2(withjavax.elexclusion,providedscope) →jakarta.enterprise:jakarta.enterprise.cdi-api:4.0.1at compile scope. Theprovidedscope was dropped because Jetty 12 is not a full Jakarta EE container — the webapp classloader needsjakarta.enterprise.inject.spi.BeanManageron its classpath so Jetty can resolve the<resource-env-ref-type>inweb-overwrite.xml.maven-war-plugin2.5 → 3.4.0.org.eclipse.jetty:jetty-maven-plugin:9.2.5.v20141112→org.eclipse.jetty.ee10:jetty-ee10-maven-plugin:12.0.14.weld-servlet:2.2.7.Final→weld-servlet-shaded:5.1.5.Final. Task instructions specified5.1.2.Final, but 5.1.2 fails at startup withNoClassDefFoundError: org.eclipse.jetty.server.handler.ContextHandler$Contextbecause itsLegacyWeldDecoratorstill 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).org.eclipse.jetty.ee10:jetty-ee10-cdi:12.0.14to the Jetty plugin dependencies so theCdiDecoratingListener/CdiSpiDecoratorclasses are available.XML configs
web.xmlandweb-overwrite.xml: namespace updated fromhttp://java.sun.com/xml/ns/javaee+web-app_3_0.xsdtohttps://jakarta.ee/xml/ns/jakartaee+web-app_6_0.xsd, version 3.0 → 6.0.web-overwrite.xml:resource-env-ref-typeupdated tojakarta.enterprise.inject.spi.BeanManager.jetty-env.xmlandjetty-context.xml: DTD updated tohttps://jetty.org/configure_10_0.dtdwith public id-//Jetty//Configure//EN(the task-suggestedhttp://www.eclipse.org/jetty/configure_10.dtd301-redirects and fails SAX parsing).org.eclipse.jetty.webapp.WebAppContext→org.eclipse.jetty.ee10.webapp.WebAppContext;org.eclipse.jetty.servlet.ServletContextHandler.Decorator→org.eclipse.jetty.ee10.servlet.ServletContextHandler.Decorator.BeanManagerJNDI class arg updated tojakarta.enterprise.inject.spi.BeanManager.javax.naming.Referencekept as-is (JDK, not Jakarta EE).jetty-env.xml:<Ref id="wac" />→<Ref refid="wac" />(required by the Jetty 10 DTD; reusingidon a reference violates the DTD's ID-uniqueness rule and causes a SAX parse error).jetty-context.xml: theserverClassessetter no longer exists in Jetty 12. Converted to the newgetHiddenClassMatcher().add(...)API. Also addedsetAttribute("org.eclipse.jetty.cdi", "CdiDecoratingListener")so Jetty installs its CDI decorator during context startup (required for Weld's Jetty integration in EE10).beans.xml: the file was previously 0 bytes, which Weld 5.x rejects withWELD-ENV-000028: Weld initialization skipped - no bean archive found. Added a minimal CDI 4.0beans.xmlwithbean-discovery-mode="all"soDefaultGreetingandMainServletare discovered.Java sources (the task description said there were none — there were three)
MainServlet.java,DefaultGreeting.java: alljavax.servlet.*,javax.inject.*,javax.enterprise.*,javax.annotation.PostConstructimports migrated tojakarta.*.javax.naming.*left alone (JDK).README.md
Review & Testing Checklist for Human
mvn clean packagesucceeds andmvn jetty:runstarts the server on :8080, but the webapp context fails to deploy withWELD-001408: Unsatisfied dependencies for type BeanManager with qualifiers @DefaultatDefaultGreeting.bmandUnsatisfied dependencies for type Event<String> with qualifiers @DefaultatMainServlet.event— soGET /returns HTTP 503.BeanManagerandEvent<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.NoClassDefFoundError: org.eclipse.jetty.server.handler.ContextHandler$Context). Please confirm this deviation is acceptable.provided→ compile). This bundlesjakarta.enterprise.cdi-apiinto 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-pluginpinning in the parent POM — required for Maven ≤3.8 to build withrelease=21. Confirm this is acceptable or let me know if you'd rather enforce a newer Maven version.beans.xmlwithbean-discovery-mode="all". The file existed but was empty. Jakarta CDI 4.0 treats an empty file as annotated-mode, but Weld 5.x loggedno bean archive foundfor the zero-byte file. Populating it is required for bean discovery; please confirm the discovery mode is appropriate.Suggested test plan for the human
mvn clean packageat the repo root and insidejetty-maven-cdi/— both should succeed (verified).cd jetty-maven-cdi && mvn jetty:run.curl http://localhost:8080/— expectedHello web-overwrite.xml!withBeanManager injection succeededandBeanManager JNDI lookup succeededin the server logs. Currently returns 503 due to the WeldWELD-001408errors above; this is the blocker to resolve.Notes
pom.xmlhas no<modules>entry, somvn clean installat the root only installs the parent POM and does not buildjetty-maven-cdi. The WAR is built by running Maven insidejetty-maven-cdi/directly. Not changed here, but worth knowing when reviewing CI/build scripts.nbactions.xmlintentionally not changed (thejetty:rungoal name continues to work under the renamed plugin).WELD-001408failure, 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