Uploaded image for project: 'Opencast'
  1. MH-12905

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


    • Type: Task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed and reviewed
    • Affects versions: 5.0
    • Fix versions: 5.0
    • Components: Build System


      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.

      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:

      # 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).


      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.

        TestRail: Results




              • Assignee:
                karen_dolan Karen Dolan
              • Watchers:
                2 Start watching this issue


                • Created:

                  TestRail: Cases