Resolution failed. Capabilities satisfying the following requirements could not be found and how to read it!

Reading a failed Resolution Result or an unresolved OSGi requirement from the BND Resolver.

Before we start: The Resolver works with the Requirements and Capabilities of OSGi and I strongly suggest to have a look at them, if you work with the Resolver.

To give an Answer to the question above, we take the following example output:

Lets take it apart and look what it is telling us:

Surprise! Something went wrong and the line after [<<INITIAL>>] represents one requirement given in the -runrequires that is the root cause for the current issue.

Bundle added via drag and drop and sometimes their versions are translated in OSGi Requirement filters for the osgi.identity Namespace.

In between [] it will state the Bundle and Version found, that provides the requested osgi.identity.

The Bundle found is a Fragment and the Resolver thus found a Requirement for a Host Bundle.

It also found a Host Bundle.

The Host-Bundle uses DS or CDI and has a mandatory service reference of the given type, represented by the osgi.service Namepace.

A part like this is often the confusing one. The indentation tells you, that it has nothing todo with the last requirement stated. This part can be longer and have multiple entries, but they can usually be ignored for the time being.

The Important part was the last stated osgi.service Requirement. It tells us, that there is no bundle in your workspace or repositories, that states that it provides a service of the given type. This is the problem you need to work with and figure out why. The most common end in such a chain is osgi.identity if somebody uses Require-Bundle and the Bundle can't be found or osgi.wiring.package if no Bundle can be found providing such a package.

The most common cause for a missing service, is if you have a service referenced via DS or CDI, where BND automatically generates osgi.service Requirements for you. If the Service is registered via bundleContext.registerservice(...). In this case bnd is not picking this up and nobody provides such a requirement.

To solve this you have two choices:

If the Bundle registering the service manually is your own, add the following Annotation to the registering class:

This will add the necessary Capability for you.

If the service is registered by a third party Bundle, you can tell the resolver to ignore the osgi.service requirements. Please note, that this can cause problems at runtime, because there might be services missing, that you depend on. To do this add the -resolve.effective: active;skip:="osgi.service" instruction to your bndrun. For more details look here.

Fixing issues the resolver has, is a step by step process. Thus, after one issue is taken care of, you need to resolve again and tackle one problem at a time.