Bndtools Bundle Resolver

Hello Everybody

I am in the process of rebuilding my bndrun file from scratch an trying to understand the dependencies.

Does anybody know what the following lines mean exactly?
They are from the auto resolver in Eclipse → EdgeApp.bndrun → Resolve

⇒ osgi.identity: (osgi.identity=io.openems.edge.bridge.modbus)
          ⇒ [io.openems.edge.bridge.modbus version=1.0.0.202402191136]
              ⇒ osgi.wiring.package: (&(osgi.wiring.package=io.openems.edge.common.channel)(version>=1.0.0)(!(version>=2.0.0)))

Please no recommendations along the lines try using JavaSE-xx. I do want to understand what’s happening and which modules are actually missing.

Some background:

io.openems.edge.bridge.modbus
is in run-requirements.

osgi.wiring.package
is neither in run-requirements nor in run-modules, as I don’t know which package it is part of.

openems.edge.common
is in run-requirements

Thanks so much.
Sebastian

It is difficult to interpret sometimes. From what I see, you have a dependency problem with io.openems.edge.bridge.modbus. It looks like it can’t find io.openems.edge.common.channel. As there is no bundle io.openems.edge.common.channel you are missing the bundle io.openems.edge.common or the correct version number of the bundle or there is no package or an inconsistent package io.openems.edge.common.channel in it.

You can ignore the package osgi.wiring.package. I assume this is the package name of the package which dumps the error.

Update: Each bundle has a generated folder in it. You may look there, if you find the jar file (in your case io.openems.edge.common/generated/io.openems.edge.common.jar.
If the file exists, please have a look into the jar file. You can simply unzip it. Within the folder structure of the unzipped file there should be a package io.openems.edge.common.channel. Hope this helps.

That helps a lot already.
You are saying bridge-modbus is missing common.channel or the correct version of it.
And wiring.package is not the problem, but just issuing the error.

I will check the jar files and versions as you said and report back.

edge.common.channel is contained in io.openems.edge.common.jar.
version is 1.0.0. (according to manifest.mf).

This can also bee seen in Eclipse, although here, the version is indicated per package, not per bundle:

grafik

Including edge.common in run-requirements makes no difference.
So I removed all bundles depending on edge.common

Now the Resolver tells me this, which may be the root of the problem: osgi.cmpn

 [<<INITIAL>>]
      ⇒ osgi.identity: (osgi.identity=io.openems.edge.common)
    [osgi.cmpn version=7.0.0.201802012110]
      ⇒ osgi.unresolvable: (&(must.not.resolve=*)(!(must.not.resolve=*)))

Good to see that your sources are there. And now you should

  1. check if the compliled jar package is there. It should look like that:
    image

Please delete the file within your file explorer. Rebuild the project and check if the file is rebuild and if the timestamp was updated.

  1. check if the library is used by the modbus bridge
    image

If everything is there (above arrow points to the library, second arrow points to the channel package) and you do not have compiler errors in Eclipse, then the problem is within your EdgeApp.bndrun. I would suggest using the one from the official repository.

Also I see, that you are using Java 11. You should switch to Java 17 and rebuild everything. Note that Java 17 is the officially supporterd version.

1 Like

Thanks for getting back to me.

I am beginning to understand. Especially what you are saying about the rebuilding of ‘generated’ helps a lot.

Also I have been switching between Java 11 and 17 but that probably has led to inconsistent bundle/compiler versions.

I will follow your steps and report back.

I rebuilt edge.common.jar and also bridge.modbus.jar successfully.
But the usage as indicated by your red arrows was not shown.

Then I decided to clean the entire project and ended up with a bunch of red exclamation marks on all bundle icons. I thinks this is a build-path/dependency problem.

Now I cannot rebuild the project, the OSGI framework selection box is empty and the resolver is showing many more unresolved dependencies.

I hate bndtools and osgi very much now. Or maybe I’m hating eclipse - I don’t even know.

How can I even build a single bundle? is it F5/update?
20 years of experience as a programmer (not java) and I cannot even find out how to rebuild a single bundle in eclipse. What a terrible IDE.

Thanks a lot nevertheless :slight_smile:

This is well… a very common statement. I can leave you with some thoughts on it. First - an approach which works without IDE tooling and discussion about migrating away from Tycho (Eclipse PDE) within openHAB/Eclipse SmartHome projects. Fair - I took a part in both of these, so its a bit of self promotion (sorry!) but I understand your point very well. The worst thing might happen to developer is when tool doesn’t work and you are left in doubt how to fix it.

Bndtools is a lot better than Tycho but it still might face troubles under certain conditions. I don’t know them exactly but bndtools itself attempts to create its own workspace within Eclipse where it is able to compute everything and make sure that application will launch. Second recording I linked includes bndtools author and maintainer who understood issue OSGi brought to Eclipse SmartHome and openHAB as well.

Probably it does not solve your issue at all, but be sure that you are not alone with your feelings. :slight_smile:

3 Likes

What helped me sometimes is adding the .classpath file manually to the Path of every modue:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="con" path="aQute.bnd.classpath.container"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
	<classpathentry kind="src" output="bin" path="src"/>
	<classpathentry kind="src" output="bin_test" path="test">
		<attributes>
			<attribute name="test" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="output" path="bin"/>
</classpath>

This is not the best way but if worked for me sometimes…

Greetings

1 Like

Till now I have always been able to solve these kind of Eclipse IDE + bndtools problems with these steps:

If you add your own new bundle and are unsure about the Classpath files, etc., I recommend to run the tools/prepare-commit.sh script (e.g. in a Windows Subsystem for Linux environment).

1 Like