Apache Karaf runtime 4.4.0 has been released!

Apache Karaf runtime 4.4.0 has been released, and it's a new milestone on the Karaf runtime roadmap.

We change the major version numbering when significant changes and updates are including in a release. It's the case for 4.4.0, starting the 4.4.x series.

Let's take a quick tour on Karaf 4.4.x.


Karaf 4.4.x is now powered by OSGi R8 specification. It means that Felix Framework and Equinox have been upgraded to support this OSGi release:
  • Apache Felix Framework 7.0.3
  • Equinox 3.17.200

Karaf 4.4.x also doesn't use OSGi compendium artifact anymore: it now uses artifacts for each "atomic" service bundles. It's much more flexible, installing exactly the required bundle instead of having systematically the "uber" compendium bundle.

OSGi R8 core doesn't bring big changes in the Karaf context, but two additions are interesting though:
  • Condition service: in OSGi, a condition is simply a component, that registers the marker interface org.osgi.service.condition.Condition. DS, CDI and Blueprint will soon have an implicit mandatory reference on every component that can be directed against any condition you like. Thus a component will only become active if such a condition is available. The framework itself conveniently provide a default TRUE-Condition service registration. It's pretty similar to Karaf feature condition introduced while ago.
  • Connect: at the core, the idea is to have framework SPI hooks that allow a management agant to provide bundles whose content is not managed by the framework. More specifically, the idea is to introduce a new kind of bundle where the framework does not expect to have access to byte entries in an archive and instead allows another entity to manage entry access and more importantly bundle class loading.
OSGi R8 Compendium includes much more change, packaged in individual artifacts. The interesting parts in Karaf context are:
  • CDI integration is an alternative to Pax CDI, using Aries CDI implementation. It's already supported by Karaf and available as Karaf features. The purpose is to bring features and capabilities of CDI to OSGi and makes OSGi services available to CDI beans. You can use all CDI flavors in OSGi: lifecycle events, stateful objects, and dependency injection. You can register CDI beans as services and also use OSGi service "linked" to CDI beans.
  • Feature service specification is generic way to see Karaf features. Actually, we have different kind of features mechanism: Karaf features, Eclipse features, Apache Sling features, OSGi Subsystems, ... OSGi Features focus on architecting groups of bundles, configuration, and metadata, defining a mechanism to describe these groups. So, Karaf features could support OSGi Features spec in the future, but it's not planned yet, because Karaf features are "de factor" spec for features in Karaf (Karaf features exists since the beginning of Karaf, and a lot of other mechanisms mimic what is done in Karaf).

Pax Web 8.0.x

Anoher big change in Karaf 4.4.0 is the update to Pax Web 8.0.x, almost to full refactoring of Pax Web.

Pax Web 8.0.x supports OSGi R8 and dramatically improve Pax Web.

Pax Web 8.x, as other Pax Web releases, uses updated web container version:

  • Jetty 9.4.46.v20220331
  • Tomcat 9.0.58
  • Undertow 2.2.15

But, it's not just version update to include latest CVE fixes: Pax Web 8.x better uses web container internal APIs, in much cleaner way.

Pax Web 8.x also includes lot of improvements, especially:

  • Web-VirtualHosts and Web-Connectors headers are handled correctly in all runtimes (in Pax Web 7 only Jetty handled them)
  • for Jetty, full tracking of org.eclipse.jetty.server.Handler and org.eclipse.jetty.server.HttpConfiguration.Customizer OSGi services.
  • pax-web-undertow no longer uses JAXB to parse XML configuration
  • "skipped JARs" property (as in Tomcat) is handled, so it's possible to configure which WEB-INF/lib/*.jar (and reachable bundles) are scanned for TLDs, web-fragment.xmls and annotated web elements
  • Karaf commands are now provided by Pax Web itself providing much more information
  • EventAdmin notifications are added
  • there are three "bundles bundles" (all-in-one) - pax-web-jetty-bundle, pax-web-tomcat-bundle and pax-web-undertow-bundle
  • @ServletSecurity, @RunAs, @DeclareRoles annotations are now correctly handled

It's almost transparent for users: nothing change for your applications and the different options you can have to deploy WAB or servlet. The only "visible" part is the Karaf shell commands.

Now, the web related commands are provided by Pax Web, not Karaf itself (only the http:proxy* commands stay in Karaf for now). The web:* commands are largely more detailed than the previuous commands: they provide a lot of details about the web container and the web content deployed. To get these commands, you just have to install pax-web-karaf feature.

web:context-list lists the web contexts. A context is a kind of generic term as a context can be:

  • an implementation of javax.servlet.ServletContext
  • an implementation of org.osgi.service.http.HttpContext
  • instances of org.ops4j.pax.web.service.spi.model.OsgiContextModel

A "classic" web:context-list command output looks like:

karaf@root()> web:context-list
Bundle ID │ Symbolic Name                       │ Context Path │ Context Name      │ Rank │ Service ID │ Type        │ Scope   │ Registration Properties
74        │ org.apache.karaf.webconsole.console │ /            │ default           │ MAX  │ 0          │ HttpService │ static* │ httpContext.id=default
          │                                     │              │                   │      │            │             │         │ httpContext.path=/
          │                                     │              │                   │      │            │             │         │ osgi.http.whiteboard.context.httpservice=default
          │                                     │              │                   │      │            │             │         │ osgi.http.whiteboard.context.path=/
74        │ org.apache.karaf.webconsole.console │ /            │ context:389320098 │ MAX  │ 0          │ HttpService │ static* │ httpContext.id=context:389320098
          │                                     │              │                   │      │            │             │         │ httpContext.path=/
          │                                     │              │                   │      │            │             │         │ osgi.http.whiteboard.context.httpservice=context:389320098
          │                                     │              │                   │      │            │             │         │ osgi.http.whiteboard.context.path=/

*) This context is using ServletContextHelper/HttpContext without resolving an org.osgi.framework.ServiceReference.

You can see here lot of details for each context:

  • the ID and symbolic name are the one of the bundle which has registered the context
  • service rank and service ID allow you to "override" context definition
  • the type is the way the context has been created (via the HttpService, Whiteboard, ...)

A new available command is web:meta, allowing you to deep dive into contexts and web container.

For instance, you can count the binding of the HTTP service using web:meta --web-usage-count. The purpose of this command is to verify if the bundles properly get and unget Pax Web services, so we have no resource leaks.

karaf@root()> web:meta --web-usage-count
Registering Bundle: org.ops4j.pax.web.pax-web-runtime [69]
Service ID: 96
Service Scope: bundle

Usage Counts for bundles referencing the service:
Bundle ID │ Symbolic Name                       │ Service ID │ Scope     │ Service objectClass                                                                                                                                   │ Usage Count
53        │ org.apache.karaf.http.core          │ 16         │ bundle    │ [org.osgi.service.cm.ConfigurationAdmin]                                                                                                              │ 1
53        │ org.apache.karaf.http.core          │ 96         │ bundle    │ [org.osgi.service.http.HttpService, org.ops4j.pax.web.service.WebContainer]                                                                           │ 2
53        │ org.apache.karaf.http.core          │ 107        │ singleton │ [org.apache.karaf.http.core.ProxyService]                                                                                                             │ 1
74        │ org.apache.karaf.webconsole.console │ 2          │ singleton │ [org.osgi.service.packageadmin.PackageAdmin]                                                                                                          │ 1
74        │ org.apache.karaf.webconsole.console │ 109        │ singleton │ [org.apache.felix.webconsole.WebConsoleSecurityProvider, org.apache.felix.webconsole.WebConsoleSecurityProvider2, org.osgi.service.cm.ManagedService] │ 1
74        │ org.apache.karaf.webconsole.console │ 120        │ singleton │ [org.apache.felix.webconsole.bundleinfo.BundleInfoProvider]                                                                                           │ 1
74        │ org.apache.karaf.webconsole.console │ 121        │ singleton │ [org.apache.felix.webconsole.bundleinfo.BundleInfoProvider]                                                                                           │ 1
74        │ org.apache.karaf.webconsole.console │ 122        │ singleton │ [org.apache.felix.webconsole.bundleinfo.BundleInfoProvider]                                                                                           │ 1
74        │ org.apache.karaf.webconsole.console │ 96         │ bundle    │ [org.osgi.service.http.HttpService, org.ops4j.pax.web.service.WebContainer]                                                                           │ 1
74        │ org.apache.karaf.webconsole.console │ 128        │ singleton │ [org.apache.felix.webconsole.WebConsoleSecurityProvider]                                                                                              │ 1
77        │ org.apache.karaf.webconsole.http    │ 107        │ singleton │ [org.apache.karaf.http.core.ProxyService]                                                                                                             │ 1
77        │ org.apache.karaf.webconsole.http    │ 96         │ bundle    │ [org.osgi.service.http.HttpService, org.ops4j.pax.web.service.WebContainer]                                                                           │ 1
80        │ org.ops4j.pax.web.pax-web-karaf     │ 96         │ bundle    │ [org.osgi.service.http.HttpService, org.ops4j.pax.web.service.WebContainer]                                                                           │ 0
80        │ org.ops4j.pax.web.pax-web-karaf     │ 98         │ singleton │ [org.osgi.service.http.runtime.HttpServiceRuntime]                                                                                                    │ 0

web:meta --http-service-info command provides additional details on the Pax Web services:

karaf@root()> web:meta --http-service-info
Registering Bundle: org.ops4j.pax.web.pax-web-runtime [69]
Service ID: 96
Service Scope: bundle

Bundles referencing the service:
Bundle ID │ Symbolic Name                       │ Version │ Instance ID │ WebContainer
53        │ org.apache.karaf.http.core          │ 4.4.0   │ 0x162fce9e  │ Proxy for HttpService (enabled) for bundle org.apache.karaf.http.core [53]
74        │ org.apache.karaf.webconsole.console │ 4.4.0   │ 0x733123f6  │ Proxy for HttpService (enabled) for bundle org.apache.karaf.webconsole.console [74]
77        │ org.apache.karaf.webconsole.http    │ 4.4.0   │ 0x7ab3ec3d  │ Proxy for HttpService (enabled) for bundle org.apache.karaf.webconsole.http [77]

Pax Logging 2.1.x

Pax Logging 2.1.x doesn't bring huge change, but important updates.

Especially with the Log4shell vulnerability, people are very sensitive about log4j version. Pax Logging 2.1.x upgrades to log4j 2.17.1, logback 1.2.11 and so.

Pax URL 2.6.10

As Pax Logging 2.1.x, Pax URL 2.6.x is not a big bang, but it provides important improvements like bndlib 6.x update, allowing Java 17+ support.

As usual, bunch of dependency updates

As any Karaf release, Karaf 4.4.0 brings a lot of dependency updates (for good reasons ;)).

To have a much better Java18+ support, we upgraded:

  • ASM 9.3
  • XBean 4.21
  • ...

For security reason, we also provide Spring 5.3.18 support.

And for conveniance, we also upgraded almost all features: Hibernate, OpenJPA, Narayana, etc, etc

You can find all details on Release Notes.

What about Karaf runtime 4.2.x, 4.3.x ?

We always maintain two active branches at Karaf. Karaf 4.3.7 has been released.

Now, regarding 4.2.x series, before flagging 4.2.x as "Not Active", we gonna release 4.2.16 first. Then, 4.2.x will be set as "Not Active", and we will maintain only 4.3.x and 4.4.x series.

Enjoy Apache Karaf runtime 4.4.0 !

https://karaf.apache.org/download.html | https://karaf.apache.org/


Popular posts from this blog

Apache Karaf and log4j2 appenders

My first days at Huawei

What's new in Apache ActiveMQ 5.16.2 ?