# Org.osgi.service.prefs unresolvable even though available

**URL:** <https://bnd.discourse.group/t/org-osgi-service-prefs-unresolvable-even-though-available/310>\
**Category:** GENERAL\
**Created:** [May 24, 2023, 11:28am UTC](https://bnd.discourse.group/t/org-osgi-service-prefs-unresolvable-even-though-available/310 "2023-05-24T11:28:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![A7exSchin](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/a7exschin/32/170_2.png) [@A7exSchin](https://bnd.discourse.group/u/A7exSchin)\
**Post date:** [May 24, 2023, 11:28am UTC](https://bnd.discourse.group/t/org-osgi-service-prefs-unresolvable-even-though-available/310/1 "2023-05-24T11:28:10Z")

</div>

Hello bnd community,

I am currently wondering about multiple very weird errors, while using bndtools 6.4.0 with Eclipse 2023-03.

First, when I try to create a new workspace in an empty folder I just created using the `bndtools/workspace` template I get this error:

 ![newBnDws](https://global.discourse-cdn.com/free1/uploads/bnd/original/1X/b459d03286976aec29d7c78e01957c8abbda4410.png)

The error persists over new Eclipse Installations. However, using the `bndtools/workspace.min` template works flawlessly (even creating the “conflicting” file `gradle.properties`.

The second error I am facing is the inability to resolve the package `org.osgi.service.prefs`. I created a minimal example and uploaded it. The workspace only includes the Eclipse 4.24 Repository, a simple empty project, based on the minimal workspace template, and a `.bndrun` file only requiring said bundle.  
[https://github.com/A7exSchin/bndtools.minimal.NonWorking](https://github.com/A7exSchin/bndtools.minimal.NonWorking)

All Eclipse Instances were installed using the Eclipse Installer. I am running Windows 11 with various available JDKs (8,11,17) where 17 is selected as target configuration.

The error is

```auto
Resolution failed. Capabilities satisfying the following requirements could not be found:
    [<<INITIAL>>]
      ⇒ osgi.identity: (osgi.identity=org.osgi.service.prefs)

```

An example project that is based on PDE works, but translating it to a bnd project results in this error. I am pretty sure the bundle itsself should be available, as it is included in the Eclipse Platform Repository.

I am not sure if this is the correct place to ask such questions, if it is not, I would greatly appreciate a pointer towards the right direction.

Any other input is also greatly appreciated. I am fairly new to bndtools, OSGi, and PDE as I am currently trying to develop a tool for my Bachelors thesis with said tooling.

Thanks!

Edit 1:  
There is a more complete setup, where I try to use the Oomph Projects Setup model, which has a dependency on `org.osgi.service.prefs` and can be found [here](https://github.com/A7exSchin/EclipseInstallationManager/tree/bugfix/cleanWorkspace)

Edit 2: Added bndtools version

---

<div class="post-metadata">

**Author:** ![A7exSchin](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/a7exschin/32/170_2.png) [@A7exSchin](https://bnd.discourse.group/u/A7exSchin)\
**Post date:** [May 31, 2023, 10:47am UTC](https://bnd.discourse.group/t/org-osgi-service-prefs-unresolvable-even-though-available/310/2 "2023-05-31T10:47:13Z")

</div>

I updated my minimal example, to not rely on the Eclipse PLatform, but only a local Repo, which contains the JAR. The resolution still fails with above error message.

Does bndtools by default exclude any imports from the `org.osgi` namespace?

Additionally, when using the filter expression given by the original error message in a bigger project to search it in the repositories view, it finds said bundle.

The filter expression is  
`(&(osgi.wiring.bundle=org.osgi.service.prefs)(bundle-version>=1.1.0)(!(bundle-version>=1.2.0)))`

---

<div class="post-metadata">

**Author:** ![A7exSchin](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/a7exschin/32/170_2.png) [@A7exSchin](https://bnd.discourse.group/u/A7exSchin)\
**Post date:** [June 5, 2023, 4:54pm UTC](https://bnd.discourse.group/t/org-osgi-service-prefs-unresolvable-even-though-available/310/3 "2023-06-05T16:54:24Z")

</div>

I started some debugging with Eclipse and I think I found the culprit, although I don’t seem to understand, where it is coming from.

When starting a ResolutionJob, the model includes a property `-runblacklist.enroute`. The property value is

```auto
osgi.identity;filter:='(osgi.identity=osgi.enroute.base.api)',
osgi.identity;filter:='(osgi.identity=osgi.cmpn)',
osgi.identity;filter:='(osgi.identity=osgi.core)',
osgi.identity;filter:='(osgi.identity=biz.aQute.junit)',
osgi.identity;filter:='(osgi.identity=biz.aQute.launcher)',
osgi.identity;filter:='(osgi.identity=biz.aQute.remote.launcher)',
osgi.identity;filter:='(osgi.identity=org.osgi.service.*)',
osgi.identity;filter:='(osgi.identity=slf4j.*)', 

```

So effectively the Bundle Namespace I require, `org.osgi.service.prefs` is explicitely excluded from resolution.

But where does it come from? Searching the bndtools Github repository for `-runblacklist.enroute` gives me [this](https://github.com/bndtools/bnd/blob/8ede38c919d8350f7308a7993a067159ec1a9fc4/biz.aQute.repository/testresources/pomrepo/augments.bndrun#L4) file. But it does not include said exclusion…

Next step is to dig deeper and find out where the `model` comes from, and where it gets the properties from…

---

<div class="post-metadata">

**Author:** ![A7exSchin](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/a7exschin/32/170_2.png) [@A7exSchin](https://bnd.discourse.group/u/A7exSchin)\
**Post date:** [June 7, 2023, 7:51am UTC](https://bnd.discourse.group/t/org-osgi-service-prefs-unresolvable-even-though-available/310/4 "2023-06-07T07:51:04Z")

</div>

After remote Debugging what bndtools actually specifically does during resolution (looks like magic form the outside), I figured where above property came from:

My workspace configuration. The `bndtools.workspace.min` template includes the file `cnf/ext/defaults.bnd` where said exclusion is existent.

Like my boss likes to say: the problem often is in front of the monitor.

Consider this to be a PSA in the form of “check whats inside your workspace configuration”.

Edit: Consider this closed 🙂

---

<div class="post-metadata">

**Author:** ![pkriens](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/pkriens/32/3_2.png) [@pkriens](https://bnd.discourse.group/u/pkriens)\
**Post date:** [June 8, 2023, 2:19pm UTC](https://bnd.discourse.group/t/org-osgi-service-prefs-unresolvable-even-though-available/310/5 "2023-06-08T14:19:52Z")

</div>

Sorry I missed it 🙂 I guess it was during my vacation this started.

Anyway, alls well ends well
