4 Replies Latest reply on Mar 4, 2013 10:57 PM by Li Wang

    OSGi uses constraint violation

    Li Wang Newbie

      I try to start my bundle created by Maven in FUSE ESB OSGi container. But I got error with its three dependencies:

      1. libthrift-0.7.0.jar

      2. httpclient-4.0.1.jar

      3. httpcore-4.0.1.jar

       

      Error executing command: Error starting bundles:

      Unable to start bundle 262: Uses constraint violation. Unable to resolve bundle

      revision file__opt_FuseESBEnterprise-7.1.0_deploy_libthrift-0.7.0.jar

      because it is exposed to package 'org.apache.http' from bundle revisions

      org.apache.httpcomponents.httpcore and org.apache.httpcomponents.httpclient    

      via two dependency chains.

       

      Chain 1:

      file__opt_FuseESBEnterprise-7.1.0_deploy_libthrift-0.7.0.jar

      import: (osgi.wiring.package=org.apache.http)

       

       

      export: osgi.wiring.package=org.apache.http

      org.apache.httpcomponents.httpcore

       

      Chain 2:

      file__opt_FuseESBEnterprise-7.1.0_deploy_libthrift-0.7.0.jar

      import: (osgi.wiring.package=org.apache.http.client)

       

      export: osgi.wiring.package=org.apache.http.client; uses:=org.apache.http

      export: osgi.wiring.package=org.apache.http

      org.apache.httpcomponents.httpclient

        • 1. Re: OSGi uses constraint violation
          Freeman(Yue) Fang Master

          Hi,

           

          Both httpclient-4.0.1.jar and httpcore-4.0.1.jar export package org.apache.http, this is split package issue in OSGi, which should be avoided.

           

          You need use httpcore-osgi and httpclient-osgi bundle instead, something like

          mvn:org.apache.httpcomponents/httpcore-osgi/4.1.4

          mvn:org.apache.httpcomponents/httpclient-osgi/4.1.3

           

          Freeman

          • 2. Re: OSGi uses constraint violation
            Li Wang Newbie

            Hi Freeman,

             

            Thanks for your help.

            The version I used for Httpclient and Httpcore is 4.0.1. So shall I also use exactly the same version 4.0.1 for httpcore-osgi? Or it does not matter if use 4.0.1 or 4.1.3?

            • 3. Re: OSGi uses constraint violation
              Freeman(Yue) Fang Master

              Hi,

               

              Not sure if 4.0.1 OSGi bundle fixed this problem or not,  give it a shot anyway.

               

              Freeman

              • 4. Re: OSGi uses constraint violation
                Li Wang Newbie

                Thanks. I got another problem:

                 

                Error executing command: Error starting bundles:

                     Unable to start bundle 359: Uses constraint violation. Unable to resolve bundle revision slf4j.api because it exports package 'org.slf4j.spi' and is also exposed to it from bundle revision org.ops4j.pax.logging.pax-logging-api via the following dependency chain:

                 

                  slf4j.api

                    import: (&(osgi.wiring.package=org.slf4j.impl)(version>=1.6.0))

                      

                 

                    export: osgi.wiring.package=org.slf4j.impl; uses:=org.slf4j.spi

                  ch.qos.logback.classic

                    import: (&(osgi.wiring.package=org.slf4j.spi)(version>=1.6.0))

                 

                    export: osgi.wiring.package=org.slf4j.spi

                  org.ops4j.pax.logging.pax-logging-api

                 

                Is this a similar problem like the httpcore? Is there a osgi bundle for slf4j.api? I have been looking around and find out a bundle named osgi-over-slf4j under org.slf4j group.