Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Each bundle is represented by a Maven project with its own POM file, and each project may implement zero or more services defined by Java interfaces. The dependencies for a bundle is are described by:

  • POM files -  interdependencies between various projects, used by Maven during the build process
  • annotations Annotations (e.g. @Reference) within the code - interdependencies between various services, used by Karaf to resolve module dependencies during system startup and when loading bundles at runtime

Notably, both prohibit circular references, and the POM file hierarchy, the cross-linking of projects not indicated to be dependencies. As such, the following result in various failure modes:

...

We focus on the case where the project builds, but does not load properly, as in case cases 2 and 4.

Runtime Symptoms

Unloaded modules may manifest as failures of certain commands from the Karaf command line, and/or the absence of bundles in the output of list. As a contrived example, for a system where DeviceService did not load due to a with a circular dependency between two services:

  • In DeviceManager.java:

    Code Block

...

  •     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
        protected MastershipService mastershipService;

...

  • In MastershipManager.java:

    Code Block

...

  •     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
        protected DeviceService devService;
    

One finds that the project builds without errors, but many CLI commands do not work:

...

Returning to the cyclic dependency example , while -- While onos-core-trivial appears as installed in the features page:

...

the interdependent services reveal unmet dependencies (each other) on the Components page.

MastershipManager:

 

Image Modified

DeviceManager:

Image Modified

 

A similar diagnosis can be used to detect other forms of unmet dependencies, such as a service referencing an implementing class. In the example below, part of the Intent Framework was referencing an implementing class (LinkResourceManager) instead of the LinkResourceService. After the codebase was refactored, the service could not be found:

Image Added

Summary

As demonstrated above, cross-referencing the bundles, features, and Components views of webconsole provides better hints about what is going on than the Karaf CLI.