We're updating the issue view to help you get more done. 

Karaf assembly omits extra system packages ( javax.annotation two dependency chains)

Description

An occasional (race condition) Karaf assembly causes missing javax.annotation lines in the generated config.properties. This results in a dual dependency chain error when Opencast modules are loaded at startup.

Workaround: Rebuild the assembly again and check the generated config.properties for the missing lines.

Long Term: Karaf 4.2 has a different assembly strategy and may avoid this issue (OC currently on Karaf 4.0.10). KARAF-4996 appears to track this issue.

The error from the logs (message-broker-api is the first to load with the dependency on javax.annotation). This causes modules with a dependency on message-broker to not load.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ERROR | (?:?) - FrameworkEvent ERROR - opencast-engage-theodul-core org.osgi.framework.BundleException: Uses constraint violation. Unable to resolve resource opencast-message-broker-api [opencast-message-broker-api [71 ](R 71.0)] because it is exposed to package 'javax.annotation' from resources javax.annotation-api [javax.annotation-api [27](R 27.0)] and org.apache. felix.framework [org.apache.felix.framework [0](R 0)] via two dependency chains. Chain 1: opencast-message-broker-api [opencast-message-broker-api [71](R 71.0)] import: (&(osgi.wiring.package=javax.annotation)(version>=1.2.0)(!(version>=2.0.0))) | export: osgi.wiring.package: javax.annotation javax.annotation-api [javax.annotation-api [27](R 27.0)] Chain 2: opencast-message-broker-api [opencast-message-broker-api [71](R 71.0)] import: (&(osgi.wiring.package=org.opencastproject.mediapackage)(version>=5.0.0)(!(version>=6.0.0))) | export: osgi.wiring.package=org.opencastproject.mediapackage; uses:=javax.annotation opencast-common [opencast-common [44](R 44.0)] import: (osgi.wiring.package=javax.annotation) | export: osgi.wiring.package: javax.annotation org.apache.felix.framework [org.apache.felix.framework [0](R 0)] Unresolved requirements: [[opencast-message-broker-api [71](R 71.0)] osgi.wiring.pa

One can provoke the error on the worker or the presentation node when the following lines are deleted in the correct config.properties.

Missing extra system packages from Karaf assembled etc/config.properties file:

1 2 3 4 5 6 7 8 9 10 # # Extra packages appended after standard packages # org.osgi.framework.system.packages.extra = # These lines appear in a good assembly and cause the dual dependency chain when not present: ... javax.annotation;version=1.2, \ javax.annotation.security;version=1.2, \ javax.annotation.sql;version=1.2, \ ...

The 7 javax.annotation-api class dependencies in Opencast modules (another project in github implemented a different Null check class to avoid the annotation-api all together because of this issue).

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 javax.annotation.ParametersAreNonnullByDefault; ./modules/message-broker-api ./modules/asset-manager-api ./modules/asset-manager-impl ./modules/common ./modules/dublincore javax.annotation.concurrent.Immutable; ./modules/asset-manager-api ./modules/asset-manager-impl ./modules/common ./modules/dublincore javax.annotation.Nonnull; ./modules/asset-manager-api ./modules/common javax.annotation.Nullable; ./modules/asset-manager-impl ./modules/dublincore javax.annotation.Nullable; ./modules/common ./modules/oaipmh-persistence javax.annotation.Generated; ./modules/asset-manager-impl javax.annotation.concurrent.ThreadSafe; ./modules/scheduler-api

I believe this ticket tracks the issue: https://issues.apache.org/jira/browse/KARAF-4996.

KARAF-4996 was thought to be solved in Karaf 4.1.1, but the ticket has been re-opened. An older ticket partially solved the original issue and is probably related to the current issue: https://issues.apache.org/jira/browse/KARAF-3722. The karaf tooling is reworked in Karaf 4.2.0 and may avoid race conditions in building the "org.osgi.framework.system.packages.extra" listing in the generated config.properties.

Steps to reproduce

None

Status

Assignee

Unassigned

Reporter

Karen Dolan

Criticality

None

Tags (folksonomy)

None

Components

Fix versions

Affects versions

5.0

Priority

Major