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

blueprint deployer: redeploy untouched blueprint xml in deploy folder after restart

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.8, 2.2.11
    • 2.2.12, 2.4.0, 3.0.2, 2.3.6, 4.0.0.M3
    • karaf
    • None
    • Karaf 2.2.11
      JNDI feature installed
      HSQLDB 2.3.0

    Description

      Preparation
      1) Start clean Karaf instance
      2) Install Aries JNDI and HSQLDB via:

      karaf@root> bundle:install -s mvn:org.hsqldb/hsqldb
      karaf@root> feature:install jndi
      

      3) Copy attached blueprint Datasource service description into deploy/ folder and check if the blueprint deployer creates a bundle (datasource.xml bundle).
      4) Deploy a blueprint service bundle use Datasource internally via JNDI lookup via KAR file (consumer bundle)
      5) Stop Karaf instance
      6) Start Karaf

      Problem
      If a blueprint service bundle is installed depending on the Datasource service. This bundle may or may not start depending of the Datasource service state. It's a timing issue and difficult to reproduce with a simple test case.

      The datasource.xml bundle will start up and Aries JNDI setup the InitialContext and exports the javax.sql.Datasource service.

      FINE

      The dependency for the Datasource service (incl. filter on the datasource name (osgi.jndi.service.name=jdbc/hsqlds)) is resolvable and the consumer bundle is starting up.
      Within the #activate(...) method of the service implementation (created and exported via blueprint service on consumer bundle) the code is trying to get the Datasource reference via JNDI lookup.

      BUT

      At the same time the fileinstall get two file references from deploy/ folder. It is the KAR file (contains the blueprint consumer bundle) and the KAR deployer don't redeploying it if timestamp of the file was not changed. The other file is the datasource.xml file. The blueprint deployer redeploy this file.
      It seems that the Datasource service reference for the consumer bundle was resolved before redeploying the datasource.xml but the JNDI lookup starts after deregistering the Datasource service from JNDI during the redeploy of the datasource.xml.
      The start of the consumer bundle failed.

      I tried the configuration org.apache.aries.blueprint.synchronous=true but it doesn't help either.

      temp. Solution
      1) Stop Karaf
      2) Remove blueprint xml file from deploy/
      3) Start Karaf

      possible Solution
      a) Create .timestamp file for blueprint service xml files and don't redeploy the xml if these files wasn't touch. Like the KAR deployer does.

      b) Use bundle version with file specific content like the modification timestamp (0.0.0.20130731071830100) instead of the default bundle version (0.0.0) and check version number before reinstall the generated bundle.

      c) ???

      Attachments

        1. datasource.xml
          1 kB
          Uwe Barthel

        Issue Links

          Activity

            People

              Unassigned Unassigned
              barthel Uwe Barthel
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: