Skip to content

Update to Karaf v4.5.0 - #2920

Open
mattrpav wants to merge 4 commits into
apache:mainfrom
mattrpav:osgi-multi-release-manifests
Open

mattrpav wants to merge 4 commits into
apache:mainfrom
mattrpav:osgi-multi-release-manifests

Conversation

@mattrpav

@mattrpav mattrpav commented Dec 2, 2026

Copy link
Copy Markdown
Contributor
  • Add activemq-jetty feature to install our own jetty bundles and not rely on pax-web for transitive bundle wiring
  • Update the activemq-karaf-itest module to run under Java 21 to meet Karaf 4.5.0 requirement

- karaf-version 4.4.12 -> 4.5.0 (Karaf itests and the features verify)
- features verify resolves against javase 21: Karaf 4.5 requires Java 21
  and its etc/jre.properties has no jre-17 profile, so with javase 17 not
  even Karaf's own framework feature resolves (javax.xml.parsers missing)
- activemq-client feature: jakarta.activation-api 2.1.4 and
  jakarta.xml.bind-api 4.0.5, the versions the Karaf 4.5 framework feature
  installs. With 2.1.2/4.0.0 the deployer updates the framework's bundles
  in place, which the static verify cannot do (UnsupportedOperationException
  from StaticInstallSupport.updateBundle). Drops the duplicate
  jakarta.activation-api entry.
- activemq-karaf and activemq-karaf-itest build in a "karaf" profile
  activated on JDK 21+: the Karaf 4.5 jars and karaf-maven-plugin are Java 21
  class files, so on JDK 17 javac cannot read them (class file version 65)
- itests: configureBrokerStart() no longer replaces etc/activemq.xml with
  src/test/resources/.../activemq.xml, which was removed with LevelDB
  (AMQ-7502); the broker features install etc/activemq.xml themselves

Karaf 4.4.12 containers do not start on JDK 25. On 4.5.0 they do, and the
remaining itest failures are activemq-osgi not resolving there (mandatory
org.jspecify.annotations import from its Java 24 supplemental manifest),
fixed in the next commit.
Both bundles are multi-release, and bnd 7 (-jpms-multi-release on by default)
writes an OSGi supplemental manifest for each release directory
(META-INF/versions/N/OSGI-INF/MANIFEST.MF), which Felix applies on Java N+:

- activemq-osgi embedded the META-INF/versions/* entries of activemq-all,
  which reaches it through activemq-web: activemq-all is a shaded uber jar,
  so the org.apache.activemq Embed-Dependency clauses inlined spring-core's
  versioned classes (orphans: the bundle has no spring-core base classes).
  bnd analyzed them into the Java 24 supplemental manifest as mandatory
  imports of org.jspecify.annotations and org.springframework.core.*, so on
  Java 24+ activemq-osgi does not resolve without a jspecify bundle.
  activemq-all is now excluded; nothing else in the bundle changes apart
  from two META-INF/services files naming classes the bundle does not
  contain (SLF4JServiceProvider, BlockHound integration).
- with -noee, bnd writes the supplemental manifests with an empty
  "Require-Capability:" header, which Felix parses as a requirement with no
  namespace that nothing satisfies ("missing requirement ... ; (*)"), so the
  bundles do not resolve on Java 21+. Their Import-Package equals the main
  manifest's, so they are no longer generated (-jpms-multi-release: false);
  Multi-Release: true and the versioned classes stay.

Verified on Karaf 4.5.0 / JDK 25: the activemq* features verify, and
ActiveMQClientBundleTest and ActiveMQClientFactoryTest pass (both failed
with activemq-osgi unresolved).
…ocket transports

The broker starts its own Jetty server for the http and ws transports, so
it needs the Jetty bundles themselves, not pax-web. The activemq feature
depended on Karaf's http feature (AMQ-4903, from the Jetty 9 days), which
on Karaf 4.5 installs pax-web with Jetty ee10, while activemq-osgi uses
Jetty ee11. Its optional org.eclipse.jetty.ee11 imports stayed unwired and
the http/ws connectors could not start.

- new activemq-jetty feature: Jetty ${jetty-version} core, ee11 servlet,
  webapp and websocket, plus spifly (jetty-ee11-webapp and
  jetty-websocket-jetty-common require the serviceloader extender). The
  ee11 bundles import the core at [12.1.15,13), so the feature carries its
  own core rather than pax-web's. activemq depends on it instead of http;
  pax-web stays with activemq-web-console (war).
- XStream, the http transport's default wire format: upstream xstream
  ${xstream-version} and mxparser bundles replace the servicemix xstream
  1.4.17 wrap, which requires javax.activation. They are no longer
  dependency="true": activemq-osgi imports XStream optionally, so the
  resolver left them out and the http transport failed with
  NoClassDefFoundError com/thoughtworks/xstream/converters/Converter.
- features verify: add Karaf's specs repository (spifly), which Karaf
  registers by default

The http transport's start failure was not logged: the async broker start
stores it with setStartException and nothing reports it.
…Test

The test installs the activemq feature, which brings no broker config, and
used configureBrokerStart() for etc/activemq.xml with the amqp, http and ws
connectors. That file was removed with LevelDB (AMQ-7502); it is back with
KahaDB, and the test now names it explicitly.

Karaf 4.5 ships etc/users.properties without users, so the test adds the
karaf user (role admin) that the broker's JAAS authentication and
authorization map expect.

With the previous commit, all five connectors (openwire, http, amqp, ws,
mqtt) start in Karaf 4.5.0 on JDK 25. The original file's mqtt connector
used a ws:// URI; the restored one is an mqtt:// transport.
@mattrpav
mattrpav force-pushed the osgi-multi-release-manifests branch from 4b8e30e to a1c89f0 Compare December 2, 2026 17:54
@mattrpav mattrpav self-assigned this Dec 2, 2026
@mattrpav mattrpav moved this from Backlog to In progress in Apache ActiveMQ v6.5.0 Dec 3, 2026
@mattrpav mattrpav moved this from In progress to In review in Apache ActiveMQ v6.5.0 Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

1 participant