Jars and Kars in addons folder not being picked up

I’m just starting some preliminary investigation. I’m posting here to see if anyone else has seen this with OH 5.

I’m trying to test a snapshot build of a jar file for an add-on and I’m finding that it’s not being picked up from the addons folder.

Details:

  • running in Docker, official image
  • addons folder is mounted as a volume from the host to /openhab/addons as it always has been
  • permissions are correct for the jar and kar files placed in the addons folder
  • OH 5.0 release

Nothing has changed with how I launch OH since the last time I did this and it worked, which was in OH 4.3.

I get no indication that that OH sees the files. I’ve tried a jar file as well as a kar file (signal binding) downloaded from the marketplace. Neither are picked up. There are no logs. They do not appear in the Inbox to choose from nor the add Things page in MainUI. And they do not appear in bundle:list in the console.

It’s like OH doesn’t see them.

I have verified that the jar and kar files appear inside the container where they should be in /openhab/addons with the right permissions.

Is anyone else using the addons folder and this works? Or it’s not working?

Any ideas most welcome.

Does $OPENHAB_HOME point to parent directory of your addons directory?

I’m not at my system to do any testing at the moment, but I can say that I’ve got at least two jars in the add-on folder for my docker install and they both work (including one old 4.0 version which surprises me).

image

Just to eliminate that as a possibility I changed the docker run command to pass in $OPENHAB_HOME and I echoed it from a script to confirm it’s set.

Still no loading of the files from addons.

It’s a Docker instance so I’m pretty sure this environment variable is set automatically.

Were these “installed” prior to upgrading to OH 5? I haven’t really changed anything so this is really odd. But if it works for you something is different with my install. I just gotta figure out what.

Should be. The rachio jar definitely has been in place forever (hence 4.0 version), the other is one of the last zwave-js jars before that went official, I just haven’t had a chance to switch it out yet, so that one probably was also there for at least my most recent container updates.

I’d be in the working category. Same details.

Just updated docker container (via apt upgrade) (already on OH5.0 image) with 5.1 snapshot in addons. After stable, deleted the snapshot, waited a bit and added it back. All good.

Not that it helps you, but I’ve been doing some testing with both JARs and KARs in 5.0 snapshot builds, and these have been picked up (although the KARs have plenty of other issues).

Maybe adding debug logging to org.openhab.core.addon could shed some more light?

I’m not certain I understand what you did. Do you mean you ran apt to upgrade inside the container, then dropped all add-ons KAR file into addons? I’m not sure if that would show the same thing because those would be all the official add-ons and those will show up no matter what.

Maybe I misunderstand what you did?

I put that logger into DEBUG level (thanks for saving me the search). A lot of logging during OH startup. It’ll take a bit to go through it.

But I tried removing and adding the file to addons to see if anything happens. Moving the jar file out of the folder did not generate any logging so I assume it wasn’t noticed by OH. That’s not concerning since it never loaded it in the first place.

Moving the jar file back to the addons folder though also didn’t generate any logging at all.

What’s the logger name for the file watcher? Maybe that will have something relevant?

Sorry I probably combined two things. I wasn’t clear if you were looking for a binding to work in addons at OH5 startup or if it was dropped into an empty addons after OH5 was running. Anyway both work.

Before I saw your post, I was updating my debian system with apt (but not OH) and new docker files were included from the docker repository. When they get updated all the running containers restart, so I took this as the first test since I had a jar in the addons folder. Then I saw you post, so I deleted the addons jar while OH was still running and then put it back and everything started. The only file in the addons is of the PR I have proposed for a new binding for the Midea AC.

Addons 2025-07-29 173855

I have never figured out exactly where the code that picks up the dropped add-ons live. I don’t think it’s a “simple filewatcher”, I suspect that it’s somehow integrated into the whole OSGi system so that OSGi might be the one doing the “watching” and OH then processes the results.

edit: JarFileAddonService should be the one picking up JAR files (KAR files is handled by a different service), and all it does is “listen” to OSGi for added bundles. So, this must be set up so that the addons folder is “magically” picked up by Karaf or OSGi. I have no idea where to look to figure out how this is done. It also makes it look like not just add-ons would be picked up in that folder, but any “valid bundle” dropped there. But, that again is speculation, since I haven’t found the mechanism.

In any case, JarFileAddonService should be logging when org.openhab.core.addon is in DEBUG, since it’s a part of that package. An add-on’s “life” in JarFileAddonService seems to start here:

    @Override
    public final synchronized Bundle addingBundle(@NonNullByDefault({}) Bundle bundle,
            @NonNullByDefault({}) BundleEvent event) {
        if (isRelevant(bundle) && trackedBundles.add(bundle)) {
            logger.debug("Added {} to add-on list", bundle.getSymbolicName());
        }

        scheduler.execute(this::refreshSource);
        return bundle;
    }

So, as soon as it picks up an add-on, you should see Added <name> to add-on list

Just had a chance to test and removing the zwave-js jar from the add-ons folder was detected and binding was properly removed from the system.

I’m on build #4753 if that helps.

@rlkoshak, try this:

docker compose exec openhab ls -l /openhab/addons

Uninstalled marketplace binding Open Meteo Weather, downloaded jar compiled for OH 5, dropped into addons folder: no issues, no errors, no restart needed, works :person_shrugging:

But: no docker (Proxmox vm)

I think that’s the case. You can put kar files there too. I’ve done that in the past.

This is all very weird. I can’t imagine why this stopped working but it seems to mainly be me with the problem. I’ll give it over night and move this all to another thread of no one else comes in with the same problem on 5 release.

I’ll do you one better.

console.info(actions.Exec.executeCommandLine(time.Duration.ofSeconds(1), "ls", "-l", "/openhab/addons"));
025-07-30 07:31:13.015 [INFO ] [nhab.automation.script.ui.scratchpad] - total 0
-rw-r--r-- 1 openhab openhab 0 Jul 29 15:11 org.openhab.binding.ipp-5.0.0-SNAPSHOT.jar
-rw-r--r-- 1 openhab openhab 0 Jul 29 12:11 org.openhab.binding.signal-5.0.0.kar


I’ve found that using docker exec doesn’t have the environment variables I’ve passed in defined. By running from a rule, probably a side effect of the way entrypoint.sh launches OH under a different user. So I’ve been running all these sorts of commands from rules to see it exactly as OH itself sees it.

But using docker exec -it openhab ls -l /openhab/addons gives the same result.

This is one of the first things I checked.

Since this seems to be only me, I’ll try to move the discussion to another thread.

The file sizes are reported as 0 bytes. Could it be that they got corrupted during transfer?

How did I miss that?

I must be blind.

Indeed, Firefox has been lying to me. It’s been claiming downloads are finished, but they are zero length. Good grief.

I restarted FF, redownloaded the jar file and moved it over, and now it’s being picked up.

You’re doing so much for this community, glad I could return the favor for once :grinning_face:
(and without @jimtng ’s suggestion to do an ls -l I would never have spotted it either)