[SOLVED] Bndtools error: cannot find binding on launch

I wanted to change the name of the binding I am currently developing due to @J-N-K’s review comment. After eclipse crashed during refactor/rename I modified the files from the console and restarted eclipse.

After some minor tweaks, the new binding code compiles, but when I try to launch the debugger (Debug OSGi on the app.bndrun) I get the following errors and I have no clue how I should tackle that.

Status ERROR: bndtools.core code=0 Cannot find /error/org.openhab.binding.heliosventilation;version=[2.5.0,2.5.1) Not found in [bndtools.m2e.MavenImplicitProjectRepository@dabead7, bnd-cache [/home/r/.bnd/default-ws/cnf/cache/4.2.0/bnd-cache r/w=false]] null
Status ERROR: bndtools.core code=0 org.openhab.binding.heliosventilation;version=[2.5.0,2.5.1) Not found in [bndtools.m2e.MavenImplicitProjectRepository@dabead7, bnd-cache [/home/r/.bnd/default-ws/cnf/cache/4.2.0/bnd-cache r/w=false]] null

any idea?

I think there are commands to clear the cache in the Karaf console.

But the error messages are given by eclipse before OH even starts. So I don’t yet have a karaf console, do I?

Pressing “Resolve” in the app.bndrun window fails with

Resolution failed. Capabilities satisfying the following requirements could not be found:
    [<<INITIAL>>]
      ⇒ osgi.identity: (osgi.identity=org.openhab.binding.heliosventilation)
    [org.openhab.transform.bin2json version=2.5.0.201907150430]
      ⇒ osgi.wiring.package: (&(osgi.wiring.package=com.igormaznitsa.jbbp)(&(version>=1.4.0)(!(version>=2.0.0))))
    [org.apache.aries.jpa.container version=2.7.0]
      ⇒ osgi.service: (objectClass=javax.persistence.spi.PersistenceProvider)
    [net.minidev.accessors-smart version=1.2.0]
      ⇒ osgi.wiring.package: (&(osgi.wiring.package=org.objectweb.asm)(&(version>=5.0.0)(!(version>=6.0.0))))
    [org.openhab.binding.smartmeter version=2.5.0.201907150423]
      ⇒ osgi.wiring.package: (&(osgi.wiring.package=io.reactivex)(&(version>=2.2.0)(!(version>=3.0.0))))
    [org.openhab.core.test version=2.5.0.201907160659]
      ⇒ osgi.wiring.package: (&(osgi.wiring.package=org.junit))
    [org.openhab.transform.jinja version=2.5.0.201907150430]
      ⇒ osgi.wiring.package: (&(osgi.wiring.package=com.hubspot.jinjava)(&(version>=2.5.0)(!(version>=3.0.0))))
    [org.openhab.binding.harmonyhub version=2.5.0.201907150411]
      ⇒ osgi.wiring.package: (&(osgi.wiring.package=com.digitaldan.harmony)(&(version>=1.1.0)(!(version>=2.0.0))))

and “resolve” succeeds after I removed my binding from the run requirements. But still: I cannot debug my binding.

In this thread I found a trick to run

mvn -DskipChecks -DskipTests clean install -U
in openhab2-addons folder, which brings the missing binding to the list selectable in “Browse Repos” and the Resolve and Debug succeeds :slight_smile:
That took only about 5 hours and I still don’t understand what I did.

1 Like

So for whatever reason I had to redo this again. I tried in the binding subdirectory, but this didn’t solve it. So I really had to do it in the openhab2-addons root folder which takes ridiculous long.

And also these days just launching the debugger with Debug OSGi on the app.bndrun pauses at 31% for maybe 3-4 minutes and afterwards suddenly jumps to starting. Any idea how to find out what exactly is soo slow?

You should be able to build the binding from root by adding -pl :<binding module name> -am to the maven command above.

1 Like

Great thanks. I’ll try it next time I run into the situation.

mvn -DskipChecks -DskipTests clean install -U -pl :org.openhab.binding.heliosventilation -am

produced only

Feature resolution failed for [openhab-binding-heliosventilation/2.5.0.SNAPSHOT] [ERROR] Message: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-binding-heliosventilation; type=karaf.feature; version=2.5.0.SNAPSHOT; filter:="(&(osgi.identity=openhab-binding-heliosventilation)(type=karaf.feature)(version>=2.5.0.SNAPSHOT))" [caused by: Unable to resolve openhab-binding-heliosventilation/2.5.0.SNAPSHOT: missing requirement [openhab-binding-heliosventilation/2.5.0.SNAPSHOT] osgi.identity; osgi.identity=openhab-runtime-base; type=karaf.feature [caused by: Unable to resolve openhab-runtime-base/2.5.0.SNAPSHOT: missing requirement [openhab-runtime-base/2.5.0.SNAPSHOT] osgi.identity; osgi.identity=openhab-core-io-rest-sitemap; type=karaf.feature [caused by: Unable to resolve openhab-core-io-rest-sitemap/2.5.0.SNAPSHOT: missing requirement [openhab-core-io-rest-sitemap/2.5.0.SNAPSHOT] osgi.identity; osgi.identity=openhab-core-ui; type=karaf.feature [caused by: Unable to resolve openhab-core-ui/2.5.0.SNAPSHOT: missing requirement [openhab-core-ui/2.5.0.SNAPSHOT] osgi.identity; osgi.identity=org.openhab.core.ui; type=osgi.bundle; version="[2.5.0.201907230313,2.5.0.201907230313]"; resolution:=mandatory [caused by: Unable to resolve org.openhab.core.ui/2.5.0.201907230313: missing requirement [org.openhab.core.ui/2.5.0.201907230313] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.eclipse.jetty.proxy)(version>=9.3.0)(!(version>=10.0.0)))" [caused by: Unable to resolve org.eclipse.jetty.proxy/9.4.18.v20190429: missing requirement [org.eclipse.jetty.proxy/9.4.18.v20190429] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.eclipse.jetty.server)(version>=9.4.18)(!(version>=10.0.0)))"]]]]]]

Not sure how long it will take until maven (and whatever else is involved in the openhab toolchain) will become my friend…

Looks like you’re a little unlucky with the version of the code you have. So you need to rebase the code to some newer version of the openhab2-addons master code. If you haven’t added upstream, first do:

git remote add upstream git@github.com:openhab/openhab2-addons.git
git fetch upstream

Than you need to rebase on your branch on it. So on your branch rebase:

git rebase upstream/master

Thanks, this helped. I didn’t try to pull upstream changes, because it worked before and in earlier times I had also trouble the other way round, such that after pulling upstream changes it stopped compiling.

Now it works again - even though still with the long hang at 31% on launching the bndapp thingy…

Another thing I have to document here is - thanks to @hilbrand - that I had to add the dependency to my binding in the pom of the demo app (copy dependency for the binding from openhab2-addons/bom/openhab-addons/pom.xml to openhab-distro/launch/app/pom.xml) to make it work this time.

It even compiles/start significantly faster.