Error while starting bundle file due to missing dependency after upgrading to OH 4.0.3

Hi, after upgrading to OH 4.0.3 I immediately noticed all my thermostats stop working due to the error:
HANDLER_MISSING_ERROR
Handler factory not found
In log I see the following error message:

2023-09-16 05:10:55.931 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/openhab/addons/org.openhab.binding.zmartmodbus-4.0.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.zmartmodbus [263]
  Unresolved requirement: Import-Package: org.openhab.core.io.transport.serial

	at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:445) ~[org.eclipse.osgi-3.18.0.jar:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) ~[?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) ~[?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) ~[?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) ~[?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) ~[?:?]

I install the jar manually in add-on folder and this worked for me since OH 2.X times. I suspect the during upgrade the tmp folder has been cleaned and somehow the dependency was removed:

Image and userdata versions differ! Starting an upgrade.
You can find backup of userdata in /openhab/userdata/backup/userdata-2023-09-16T03-05-14.tar

################################################
          openHAB Docker update script          
################################################

The script will attempt to update openHAB to version 4.0.3
Please read the following e[32mnotese[m and e[31mwarningse[m:

Replacing userdata system files with newer versions...
Clearing cache...

Starting JSON database update...
[main] INFO org.openhab.core.tools.internal.Upgrader - Already executed 'itemCopyUnitToMetadata' on 2023-08-11T19:24:40.761314307Z[Etc/UTC]. Use '--force'  to execute it again.
[main] INFO org.openhab.core.tools.internal.Upgrader - Already executed 'linkUpgradeJsProfile' on 2023-08-11T19:24:40.869795550Z[Etc/UTC]. Use '--force'  to execute it again.
JSON database updated successfully.
SUCCESS: openHAB updated from 4.0.2 to 4.0.3

The binding is made for OH 3.X but it’s out of maintenance so I’m not sure if that’s the issue, however it worked since OH 4.0.1. Any suggestion is appreciated!

UPDATE: I have now installed serial transport:

openhab-transport-serial                          │ 4.0.3            │ x        │ Started     │ distro-4.0.3             │ Serial Transport

Now the binding is stuck in waiting state:

315 │ Waiting  │  80 │ 4.0.0.202308121015     │ openHAB Add-ons :: Bundles :: ZmartModbus Binding

No trace in the log, how can I see why the binding is in waiting state?
Thank you!

Did you restart the bundle?
I also would try to remove the bundle, make sure serial-transport is installed and then copy the binding to the add-on folder.
Did you also check the permissions?

Thank you for your reply!
I did try to restart bundle, which changed to resolved state when stopped but still stuck in waiting after restart. Also tried to stop OpenHAB, remove the jar, start and add the jar back to addon folder without luck.
Last thing I tried is to clear the cache/tmp again, now after restart it complain cannot find dependency to core config (something like that), but after another restart it works magically.
After upgrading to OH4 I find the starting behaviour strangely, maybe that’s the cause.

That’s part of the cache cleaning to remove all non-required dependencies, in your case serial-transport.
Typically I would follow this sequence:

  • Delete jar file
  • Stop oh
  • Clean cache
  • Start oh
  • Install serial-transport
  • Copy jar file to adding folder
  • Check if jar file has the right permissions