4 Replies Latest reply on Oct 18, 2012 8:19 PM by ffang

    bundle revisions has two dependency chains

    ranajitjana

      I am getting a error which i am not able to resolve.

      actually both the dependent and original bundle needs commons lang api.

      -


      com.mycomp.service \[290.0\] because it is exposed to package 'org.apache.commons.lang' from bundle revisions org.apache.commons.lang \[178.0\] and org.

      apache.servicemix.bundles.commons-lang \[46.0\] via two dependency chains.

      -


      Both 178 and 46 is loaded by Karaf so I cannot delete one of them as there may be consequences in other bundles loaded by system.

       

      the error is exactly as described in the link below

       

      http://njbartlett.name/2011/03/31/uses-constraints-in-felix.html

       

      I am hoping this issue is resolved by somebody but not getting much help by googling.

       

      Regards,

      Ranajit

        • 1. Re: bundle revisions has two dependency chains
          ranajitjana

          I have noticed few things.

          I have to import specific version to resolve the issue

          -


          <Import-Package>org.apache.commons.lang;version="\[2.6,2.6\]",org.apache.commons.codec;version="\[1.6,1.6\]",org.apache.commons.codec.binary;version="\[1.6,1.6\]",*</Import-Package>

           

          -


           

          Most of the errors were gone but one error which was related to a old util jar used by company kept cropping up. When I did a bnd and replace this jar after my features deployment the same started working. This cannot be used for production deployment but for now I can continue with development.

          -


          Is it a good idea to attach version in Import ?

          Any other suggestions ?

           

          Regards

          • 2. Re: bundle revisions has two dependency chains
            ffang

            Hi,

             

            Yeah, specify the version range always a good practice in OSGi world, especially when you have same bundle with multiple versions in the OSGi container. Specify the version range can clearly tell which bundle should be loaded, hence can avoid such issues you run into.

             

            Freeman

            • 3. Re: bundle revisions has two dependency chains
              ranajitjana

              Most of the conflict got resolved by mention of the version number but last bundle in the chain was not fully resolved but it got resolved by a hack(not solution).

               

              after all the deployment when i get the dependency chain error, I go to the .m2 repo of last in the chain and replace the jar with bnd jar called .bar and rename it to jar. server reloads the file with correct bundle(or same bundle as dependent bundle). It somehow resolves the dependency chain. Though not a solution but it may help somebody thus posted.

              • 4. Re: bundle revisions has two dependency chains
                ffang

                Hi,

                 

                FYI, actually using bnd/maven-bundle-plugin to make jars OSGi-fied is a general way in OSGi world, SMX provide a lot of bundle using this way.

                 

                Freeman