felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard S. Hall" <he...@ungoverned.org>
Subject Re: Preventing package to be exposed from system bndle
Date Fri, 07 Jun 2013 03:02:04 GMT
On 6/6/13 18:20 , Reto Bachmann-Gmür wrote:
> Hello,
>
> I'm using a bundle that requires
> (package=javax.annotation)(version>=1.1.0)(!(version>=2.0.0)).
> Unfortunately the version exposed by the system bundle on my system is only
> 0.0.0.1_007_JavaSE.
>
> I have a bundle that exposes the requested package at a matching version
> (mvn:javax.annotation/javax.annotation-api/1.2-b04) however when I add this
> bundle I get errors like the following:
>
>   [java] ERROR: Bundle org.glassfish.jersey.core.jersey-common [44]: Error
> starting
> slinginstall:C:\Users\Reto\projects\apache\commons-ng\launchers\mini\target\stanbol\startup\24\jersey-common-2.0.jar
> (org.osgi.framework.BundleException: Constraint violation for package
> 'javax.annotation' when resolving module 44.0 between existing import
> 35.0.javax.annotation BLAMED ON [[44.0] package;
> (&(package=javax.annotation)(version>=1.1.0)(!(version>=2.0.0)))] and uses
> constraint 0.javax.annotation BLAMED ON [[44.0] package; (&(package=
> com.google.common.net)(version>=14.0.0)(!(version>=15.0.0))), [9.0]
> package; (package=javax.annotation)])
>
> Can I prevent the system bundle from exportingthis package?

Yes, you can. You have to completely overwrite the 
org.osgi.framework.system.packages property. The default value comes 
from the default.properties file inside the felix.jar file. You can copy 
copy the value to your conf/config.properties. Note that it uses 
property expansion in default.properties, so you'll have to expand the 
properties by hand.

> Or is there an other solutions?

Not really. It looks like you have one bundle using the correct imported 
version range and one not and unfortunately the system bundle export has 
priority in a lot of cases since it is resolved first. The only other 
approach is to make sure the higher version of javax.annotation is 
resolved before resolving any other bundles, so that it will become the 
highest priority since it has the highest version.

But I think modifying the system bundle export is the all around safer 
way to go.

-> richard

>
> Cheers,
> Reto
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message