FW: Package uses conflict: Import-Package: org.osgi.service.blueprint

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FW: Package uses conflict: Import-Package: org.osgi.service.blueprint

XiLai Dai

Hi, Freeman,

 

Please find the attachment which is a simple bundle with blueprint.

1.       Deploy geronimo-servlet_2.5_spec-1.1.2.jar into $Karaf2.2.4/deploy

2.       Deploy test-blueprint-0.1.jar into $Karaf2.2.4/deploy

 

The source project also attached.

 

   ID   State         Blueprint      Level  Name

[  50] [Active     ] [            ] [   60] geronimo-servlet_2.5_spec (1.1.2)

[  52] [Active     ] [Failure     ] [   60] test :: blueprint (0.1.0)

 

The blueprint still failure, and now got this exception in the karaf.log:

 

org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to find a matching constructor on class test.blueprint.UIAPIServlet for arguments [] when instanciating bean #recipe-1

         at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:272)[9:org.apache.aries.blueprint:0.3.1]

 

Thanks.

Xilai

From: Freeman Fang [mailto:[hidden email]]
Sent: Wednesday, November 23, 2011 6:30 PM
To: [hidden email]
Subject: Re: Package uses conflict: Import-Package: org.osgi.service.blueprint

 

Hi,

Is it possible that you append a src project which we can build and deploy to reproduce it?

Freeman

On Wed, Nov 23, 2011 at 3:53 PM, XiLai Dai <[hidden email]> wrote:

Thanks much!

But unfortunately, seems there is only Aries implementation for blueprint in my Karaf container  L

-----------------------------------------------

karaf@trun> packages:imports | grep org.osgi.service.blueprint

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint.container; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint.container; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint.reflect; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint.container; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint.reflect; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint.container; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint.container; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint.reflect; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint.container; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint.container; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint.reflect; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint.container; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint.container; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint.reflect; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint.container; version="1.0.1"

Apache Aries Blueprint Bundle (9): org.osgi.service.blueprint.reflect; version="1.0.1"

karaf@trun> packages:exports |grep org.osgi.service.blueprint

     9 org.osgi.service.blueprint; version="1.0.1"

     9 org.osgi.service.blueprint.container; version="1.0.1"

     9 org.osgi.service.blueprint.reflect; version="1.0.1"

----------------------------------------------------

 

Thanks.

Xilai

From: Freeman Fang [mailto:[hidden email]]
Sent: Wednesday, November 23, 2011 3:27 PM


To: [hidden email]
Subject: Re: Package uses conflict: Import-Package: org.osgi.service.blueprint

 

Hi,
I've run a quick test on a blueprint bundle.
The configuration like
         <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <configuration>
                    <instructions>
                        ...
                           <Import-Package>!org.osgi.service.blueprint</Import-Package>
                     </instructions>
                </configuration>
            </plugin>
works for me.

Notice in your configuration you just comment out the Import-Package, so that configuration won't take effect.

However, I don't think you should change this OSGi header of this bundle, as it's correct behavior to generate org.osgi.service.blueprint;version="[1.0.0,2.0.0)" header when it's a blueprint bundle. As I mentioned previously you need figure out other bundles which wrongly export/import other version of org.osgi.service.blueprint.
From karaf console
packages:imports |grep org.osgi.service.blueprint
or
packages:exports |grep org.osgi.service.blueprint
may give you more hints. I guess most likely you install other blueprint implementation other than the aries one.

Freeman

On Wed, Nov 23, 2011 at 2:36 PM, XiLai Dai <[hidden email]> wrote:

Hello,

There is no any osgi dependencies in the pom.xml file!  If OSGI-INF/blueprint/*.xml included into bundle, the “org.osgi.service.blueprint;version="[1.0.0,2.0.0)” will be generated; if remove OSGI-INF/blueprint/*.xml, then “org.osgi.service.blueprint;version="[1.0.0,2.0.0)” was gone.

 

How to control this meta info?

I’ve tried adding this into the pom.xml

<!--Import-Package>

!org.osgi.service.blueprint

          </Import-Package-->

But not works.

 

Thanks.

Xilai

From: Freeman Fang [mailto:[hidden email]]
Sent: Wednesday, November 23, 2011 1:37 PM


To: [hidden email]
Subject: Re: Package uses conflict: Import-Package: org.osgi.service.blueprint

 

Hi,

 

maven-bundle-plugin basically just analyze the dependency in pom.xml and generate OSGi meta-data header in MANIFEST.MF accordingly, you need check if your dependency introduce this package import.

Btw, you can configure the maven-bundle-plugin to totally control the OSGi meta-data header.

 

Freeman

 

On 2011-11-23, at 下午1:27, XiLai Dai wrote:

 

Thanks Freeman for your clear reply!

 

BTW, I’ve run another test with the same bundle which just removed the “org.osgi.service.blueprint;version="[1.0.0,2.0.0)” from MANIFEST.MF, then, it has been installed into Karaf successfully.

So, maybe it’s a problem from maven-bundle-plugin, it should not generate the unexpected “org.osgi.service.blueprint;version="[1.0.0,2.0.0)” into MANIFEST.MF.

 

Thanks.

Xilai

From: Freeman Fang [[hidden email]
Sent: Wednesday, November 23, 2011 11:52 AM
To: [hidden email]
Subject: Re: Package uses conflict: Import-Package: org.osgi.service.blueprint

 

Hi,

 

This kind of "Package uses conflict" comes from the scenario like, let's say, 

bundle A import-package org.osgi.service.blueprint; version="[1.0.0,2.0.0)", bundle A also import-package x.y.z

bunde B export-package  x.y.z with "use" directive like uses:="org.osgi.service.blueprint; version="[2.0.0,3.0.0)"" 

Let's say bundle B already get resolved and started.

When resolve bundle A, it will use export-package x.y.z from bundle B, but  as bundle B export-package  x.y.z uses:="oorg.osgi.service.blueprint; version="[2.0.0,3.0.0)" and bundle B get resolved to import org.osgi.service.blueprint; version="[2.0.0,3.0.0), so it's not meet bundle A's restriction which need org.osgi.service.blueprint; version="[1.0.0,2.0.0)(notice the version mismatch between the two), then you see such exception.

 

The root cause is that you install some bundles which need different org.osgi.service.blueprint versions, also those bundles has dependency with each other, you need figure it out from your bundles and fix it.

 

Freeman

On 2011-11-23, at 上午11:36, XiLai Dai wrote:

 

Hello,

We have a bundle with blueprint (OSGI-INF/blueprint/xxx.xml) and build with maven-bundle-plugin. 
The META-INF/ MANIFEST.MF contains: 
......
Import-Package: ...,org.osgi.service.blueprint;version="[1.0.0,2.0.0)",...

When install this bundle into Karaf 2.2.4, got error: 
Reason: Package uses conflict: Im port-Package: org.osgi.service.blueprint; version="[1.0.0,2.0.0)"

Why it complains there has conflict? 

Thanks.
Xilai

 

---------------------------------------------

Freeman Fang

 

FuseSource

Twitter: freemanfang

 

 

 

 

 

 

 

 

 

 

---------------------------------------------

Freeman Fang

 

FuseSource

Twitter: freemanfang

 

 

 

 

 

 

 

 

 

 

 


test_blueprint.zip (3K) Download Attachment
deploy.zip (87K) Download Attachment