Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-2359

DirectoryWatcher for "deploy" directory should be configured to wait until framework start level reaches 60

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.2.11
    • 2.2.12, 2.3.2, 2.4.0, 3.0.0
    • karaf
    • None
    • ServiceMix 4.4.2 and 4.5.1

    Description

      Problem :

      By default, the DirectoryWatcher of Felix scans for new files very early in the start process. If a new application bundle is added to the "deploy" directory, it might be detected and started while the framework start level is still at 30, although the application bundle start should be postponed until level 60 is reached.

      If not, a typical problem will be that Camel-core is deployed after the application bundle, thereby not using the OSGi-aware CamelContext, causing some Camel components not to be found, with errors such as the following :
      Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: sql://SELECT 1 from DUAL?dataSourceRef=myDS due to: No component found with scheme: sql
      A hint to the root cause of the problem can be found in the logs :
      CamelNamespaceHandler | OSGi environment not detected.

      By default, the property "felix.fileinstall.start.level" in file "org.apache.felix.fileinstall-deploy.cfg" is unconfigured, resulting in the default "0" level being used. Although this means that the new bundle's start level will be configured at level 60 (as configured in the "karaf.startlevel.bundle" property), another unwanted side effect is also observed : there is no wait in method "DirectoryWatcher:run()".

      Solutions :

      To avoid such race conditions between the starting of Camel-core bundle and an application bundle, it would be safer to explicitly configure the property "felix.fileinstall.start.level" to 60 in Felix 3.1.x, or property "felix.fileinstall.active.level" to 60 in Felix 3.2.x, or change the code of DirectoryWatcher to retrieve the default start level, in case it is unspecified in the properties.

      Attachments

        Activity

          People

            jbonofre Jean-Baptiste Onofré
            metatech metatech
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: