openhab/openhab-core

Resolver error introduced with Karaf upgrade to 4.4.5

Closed this issue · 12 comments

@florian-h05: I'm getting these error messages on my openHAB dev machine (latest snapshot) since this PR:

 org.apache.felix.resolver.reason.ReasonException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=kar; type=karaf.feature; version="[4.4.5,4.4.5]"; filter:="(&(osgi.identity=kar)(type=karaf.feature)(version>=4.4.5)(version<=4.4.5))" [caused by: Unable to resolve kar/4.4.5: missing requirement [kar/4.4.5] osgi.identity; osgi.identity=org.apache.karaf.kar.core; type=osgi.bundle; version="[4.4.5,4.4.5]"; resolution:=mandatory [caused by: Unable to resolve org.apache.karaf.kar.core/4.4.5: missing requirement [org.apache.karaf.kar.core/4.4.5] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.osgi.framework)(version>=1.0.0)(!(version>=3.0.0)))" [caused by: Unable to resolve org.eclipse.osgi/3.18.0.v20220516-2155: missing requirement [org.eclipse.osgi/3.18.0.v20220516-2155] osgi.ee; filter:="(| (&(osgi.ee=JavaSE)(version=1.8)) (&(osgi.ee=JavaSE/compact1)(version=1.8)) )"]]]
        at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1341)
        at org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:433)
        at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:420)
        at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:374)
        at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:256)
        at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:399)
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1069)
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:1004)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:840)

@kaikreuzer Is there anything that needs to be uploaded to our Maven repo?

Originally posted by @florian-h05 in #4133 (comment)

@J-N-K: I see the same issue:

17:23:38.379 [ERROR] [.core.karaf.internal.FeatureInstaller] - Failed to refresh bundles after processing config update
org.apache.felix.resolver.reason.ReasonException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=shell; type=karaf.feature; version="[4.4.5,4.4.5]"; filter:="(&(osgi.identity=shell)(type=karaf.feature)(version>=4.4.5)(version<=4.4.5))" [caused by: Unable to resolve shell/4.4.5: missing requirement [shell/4.4.5] osgi.identity; osgi.identity=org.apache.karaf.shell.core; type=osgi.bundle; version="[4.4.5,4.4.5]"; resolution:=mandatory [caused by: Unable to resolve org.apache.karaf.shell.core/4.4.5: missing requirement [org.apache.karaf.shell.core/4.4.5] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.osgi.framework)(version>=1.0.0)(!(version>=3.0.0)))" [caused by: Unable to resolve org.eclipse.osgi/3.18.0.v20220516-2155: missing requirement [org.eclipse.osgi/3.18.0.v20220516-2155] osgi.ee; filter:="(| (&(osgi.ee=JavaSE)(version=1.8)) (&(osgi.ee=JavaSE/compact1)(version=1.8)) )"]]]
	at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1341) ~[org.eclipse.osgi-3.18.0.jar:?]
	at org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:433) ~[org.eclipse.osgi-3.18.0.jar:?]
	at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:420) ~[org.eclipse.osgi-3.18.0.jar:?]
	at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:374) ~[org.eclipse.osgi-3.18.0.jar:?]
	at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:256) ~[?:?]
	at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:399) ~[?:?]
	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1069) ~[?:?]
	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:1004) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:840) [?:?]
Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to resolve shell/4.4.5: missing requirement [shell/4.4.5] osgi.identity; osgi.identity=org.apache.karaf.shell.core; type=osgi.bundle; version="[4.4.5,4.4.5]"; resolution:=mandatory [caused by: Unable to resolve org.apache.karaf.shell.core/4.4.5: missing requirement [org.apache.karaf.shell.core/4.4.5] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.osgi.framework)(version>=1.0.0)(!(version>=3.0.0)))" [caused by: Unable to resolve org.eclipse.osgi/3.18.0.v20220516-2155: missing requirement [org.eclipse.osgi/3.18.0.v20220516-2155] osgi.ee; filter:="(| (&(osgi.ee=JavaSE)(version=1.8)) (&(osgi.ee=JavaSE/compact1)(version=1.8)) )"]]
	at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1341) ~[org.eclipse.osgi-3.18.0.jar:?]
	... 12 more
Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to resolve org.apache.karaf.shell.core/4.4.5: missing requirement [org.apache.karaf.shell.core/4.4.5] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.osgi.framework)(version>=1.0.0)(!(version>=3.0.0)))" [caused by: Unable to resolve org.eclipse.osgi/3.18.0.v20220516-2155: missing requirement [org.eclipse.osgi/3.18.0.v20220516-2155] osgi.ee; filter:="(| (&(osgi.ee=JavaSE)(version=1.8)) (&(osgi.ee=JavaSE/compact1)(version=1.8)) )"]
	at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1341) ~[org.eclipse.osgi-3.18.0.jar:?]
	at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1341) ~[org.eclipse.osgi-3.18.0.jar:?]
	... 12 more
Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to resolve org.eclipse.osgi/3.18.0.v20220516-2155: missing requirement [org.eclipse.osgi/3.18.0.v20220516-2155] osgi.ee; filter:="(| (&(osgi.ee=JavaSE)(version=1.8)) (&(osgi.ee=JavaSE/compact1)(version=1.8)) )"
	at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1341) ~[org.eclipse.osgi-3.18.0.jar:?]
	at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1341) ~[org.eclipse.osgi-3.18.0.jar:?]
	at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1341) ~[org.eclipse.osgi-3.18.0.jar:?]
	... 12 more

It only happens once for me after an update / cleaned cache.

Originally posted by @J-N-K in #4133 (comment)

I don't think there is something missing in our repo. For some reason org.eclipse.osgi/3.18.0.v20220516-2155 seems to require Java 8.

@J-N-K thanks for the feedback.

I still cannot reproduce on S3998 on RPI, OpenJDK 17.0.10.
Besides the addons from the kar, I have self-built addons installed, some compiled for 4.2 (Karaf 4.4.4), some for snapshot (Karaf 4.4.5). Clearing the cache did not make any difference for me.

Not sure what is different on my test system, i.e. why the problem does not show here.

@J-N-K What is the functional impact of the issue? Do addons fail to reload? Do you need to restart OH?

@wborn Any idea what is going wrong?

Which version of org.eclipse.osgi is installed in your system? I have just checked with an older openhab (locally compiled) which has the same version 3.18.0.v20220516-2155 installed. So the question is: why does it resolve for some but not for others and did resolve for everybody in the past.

@J-N-K how do you get those version numbers from? OH console?

I just double-checked mvn dependency:tree of core for suspicious dependencies. We have version 3.18 a few times, and this one referencing an older version.
bundles/org.openhab.core.io.console.eclipse/pom.xml: <version>3.13.100</version>
Probably this should be fixed, but seems unrelated to the issue here.

pom file of Karaf 4.4.5 uses 3.18.0.

Include -t 0 in the list command. There is a default start-level threshold (I don't remember, maybe 30), so the OSGI bundles are not included if you just call list. I usually also add -s to get the symbolic name instead of the name which is usually easier to identify.

Java Version on the affected system is

openjdk 17.0.10 2024-01-16
OpenJDK Runtime Environment Temurin-17.0.10+7 (build 17.0.10+7)
OpenJDK 64-Bit Server VM Temurin-17.0.10+7 (build 17.0.10+7, mixed mode, sharing)

My not affected development system has

openjdk 17.0.7 2023-04-18
OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7)
OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode)

But I don't think that makes a difference.

@kaikreuzer Is there anything that needs to be uploaded to our Maven repo?

No, the Karaf bundles should always be present in the distribution itself.
I just tried the latest snapshot and cannot see any issues (with a fresh install):

                           _   _     _     ____
   ___   ___   ___   ___  | | | |   / \   | __ )
  / _ \ / _ \ / _ \ / _ \ | |_| |  / _ \  |  _ \
 | (_) | (_) |  __/| | | ||  _  | / ___ \ | |_) )
  \___/|  __/ \___/|_| |_||_| |_|/_/   \_\|____/
       |_|       4.2.0-SNAPSHOT - Build #4000

Use '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
To exit, use '<ctrl-d>' or 'logout'.

openhab> list -t 0 | grep Karaf
  1 │ Resolved │   1 │ 4.4.5                 │ Apache Karaf :: Features :: Extension, Hosts: 0
  2 │ Active   │   5 │ 4.4.5                 │ Apache Karaf :: OSGi Services :: EventAdmin
 17 │ Active   │  11 │ 4.4.5                 │ Apache Karaf :: ConfigAdmin :: Core
 19 │ Active   │  15 │ 4.4.5                 │ Apache Karaf :: Features :: Core
 20 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: JAAS :: Command
 21 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: JAAS :: Config
 22 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: JAAS :: Modules
 23 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: Shell :: Various Commands
 24 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: Shell :: Core
 25 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: Wrapper :: Core
 76 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: Bundle :: Core
 77 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: ConfigAdmin :: Command
 78 │ Active   │  26 │ 4.4.5                 │ Apache Karaf :: Deployer :: Features
 79 │ Active   │  24 │ 4.4.5                 │ Apache Karaf :: Deployer :: Karaf Archive (.kar)
 80 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: Diagnostic :: Core
 81 │ Active   │  80 │ 4.4.5                 │ Apache Karaf :: OSGi Services :: Event
 82 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: Features :: Command
 83 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: Instance :: Core
 84 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: KAR :: Core
 85 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: Log :: Core
 86 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: Package :: Core
 87 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: SCR :: Bundle State
 88 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: Service :: Core
 89 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: Shell :: SSH
 90 │ Active   │  30 │ 4.4.5                 │ Apache Karaf :: System :: Core
160 │ Active   │  80 │ 4.2.0.202403180312    │ openHAB Core :: Bundles :: Community Marketplace Add-on Service :: Karaf
178 │ Active   │  80 │ 4.2.0.202403180308    │ openHAB Core :: Bundles :: Console for OSGi runtime Karaf
197 │ Resolved │  80 │ 4.2.0.202403180308    │ openHAB Core :: Bundles :: Karaf Integration

My system (not affected) runs on S3998,

openjdk version "17.0.10" 2024-01-16
OpenJDK Runtime Environment (build 17.0.10+7-Raspbian-1deb12u1rpt1)
OpenJDK Client VM (build 17.0.10+7-Raspbian-1deb12u1rpt1, mixed mode, emulated-client)

Karaf bundles look similar as in the post above.

org.eclipse.osgi is same as yours, 3.18.0.v20220516-2155.

I tried to stop the service, do a openhab-cli clean-cache, restart. No issue.
I tried to stop the service, do a openhab-cli clean-cache, upgrade to latest S4000, restart. No issue.

I also don't experience the issue anymore with snapshot 4000 on

openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment (Red_Hat-17.0.9.0.9-4) (build 17.0.9+9)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.9.0.9-4) (build 17.0.9+9, mixed mode, sharing)

On snapshot 4004 the issue is back, restarting openHAB several times and cleaning cache several times did not solve the issue. However did re-installing the Z-Wave binding do the trick and fix the issue.
Not sure if anything needs to be updated at the Z-Wave or ZigBee repos ...

I believe I got this error when, I started snapshot 4064. Does not occur after a restart.

I have tried to analyze this a bit further, as it looks like it is impacting add-on installation, including the installation of the add-on finders on a random basis.

The problem always appears when the following line is called:

featuresService.refreshFeatures(EnumSet.noneOf(FeaturesService.Option.class));

I changed the code here:

featuresService.installFeatures(addons, EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles,

removing FeaturesService.Option.NoAutoRefreshBundles and commented line:
featuresService.refreshFeatures(EnumSet.noneOf(FeaturesService.Option.class));

This should refresh the features immediately after install instead of a delayed refresh.

I didn't see the error anymore, in my tests and didn't see any negative consequence. However, I know this was introduced by @J-N-K in #3049. Reading through the comments it looks like there were good reasons for that, but I don't know enough about Karaf to be the judge on this.

Likely this is resolved by #4224 (and a duplicate of #4222).
I will close it for now, please reopen if you see the issue again.
@florian-h05