4 Replies Latest reply on Jun 29, 2011 2:37 PM by Shamik Bandopadhyay

    Problem with hot deploy

    Shamik Bandopadhyay Newbie

      Hi,

        I'm facing an issue with fuse hot deploy. Here's a sample scenario.

       

      I've a bundle foo-1.0.0.jar which exports bar-1.0.0.jar. Now, I added some changes in bar-1.0.0.jar and changed the version to bar-1.1.0.jar. I copied the updated bundle to the deploy folder and waited for a min (default polling rate is 1 sec). When I ran the test case, it showed results from bar-1.0.0 instead of the new version. The servicemix log also pointed to the fact that it was referring to bar-1.0.0.

       

      Now,I changed the version back to bar-1.0.0, build the jar and copied it to deploy folder. I ran the test case and was able to see the changes. So, it works fine if I've the same version.

       

      In foo-1.0.0 pom file, I've imported bar-1.0.0 as

      <Import-Package>com.bar;version=[1.0.0,2.0.0)"</Import-Package>,

      which gets reflected in the manifest as part of the import-package. Based on my understanding, the version range should allow foo to recognize bar 1.1.0 version.

       

      Not sure why the changes are not being incorporated as part of the hot deploy.

       

      Any pointers will be appreciated.

       

      - Thanks

        • 1. Re: Problem with hot deploy
          Freeman(Yue) Fang Master

          Hi,

           

          I believe this is the expected behavior per OSGi spec.

           

          You have installed bar-1.0.0.jar bundle, then you install bar-1.1.0.jar bundle, so the OSGi container now have two versions for bar, and the foo bundle already get resolved to pick up the bar-1.0.0, it won't re-resolve automatically to pick up the newer bar-1.1.0, unless you manually uninstall the old bar-1.0.0 and refresh the foo-1.0.0.

           

          Freeman

          • 2. Re: Problem with hot deploy
            Shamik Bandopadhyay Newbie

            Thanks for your reply Freeman. If I understand you correctly, here are the steps required to be followed for my scenario.

             

            1. Drop bar 1.1.0 in deploy folder

            2. Uninstall bar 1.1.0

            3. Refresh foo 1.0.0.

             

            Couple of questions, between uninstall of bar 1.0.0 and refresh of foo 1.0.0, what happens if a request is made to foo ? Since it has not been refreshed and older version of bar has been uninstalled, foo won't find a reference to bar. Will it cause an exception?

             

            Secondly, is there a way to call the install / refresh command without logging into the karaf console or through webconsole ?

            • 3. Re: Problem with hot deploy
              Freeman(Yue) Fang Master

              Hi,

               

              I guess there's a typo in your scenario.

              It should be

              1. Drop bar 1.1.0 in deploy folder

              2. Uninstall bar 1.0.0

              3. Refresh foo 1.0.0.

               

              IIRC, after you uninstall bar 1.0.0 and before you refresh foo 1.0.0, there should be a cache of bar 1.0.0  which foo 1.0.0 can still use as foo 1.0.0 already get resolved to pick up the bar 1.0.0. Anyway, you can get it a try and do a simple test here

               

              And I  think you can write a bundle which use OSGi api to install / refresh bundles, you may need google to get more details about how those api works.

               

              Freeman

              • 4. Re: Problem with hot deploy
                Shamik Bandopadhyay Newbie

                My bad, it was a typo indeed. As suggested, I verified the deploy steps by running a sample test. Uninstalling old bundle and refreshing the reference bundles made the new bundle visible.

                 

                As for the deployment, I'm looking into OSGi framework code. Thanks for the pointer.

                 

                Appreciate your help as always.