Skip to content

jsondb, upgradetool.jar — difference between a missing file and a file with content {} #5029

@dilyanpalauzov

Description

@dilyanpalauzov

OpenHAB creates /var/lib/openhab/jsondb/org.openhab.core.items.Item.json and /var/lib/openhab/jsondb/org.openhab.core.thing.link.ItemChannelLink.json, only when an item and a link to it are created over MainUI. If this linked item is later removed, the mentioned files contain just {}. It turns out, there is a difference between a missing file in jsondb and a file with content {}:

During OpenHAB upgrade to 5.1 the system logs:

[openHAB] Running JSON Database upgrade tool (${OPENHAB_RUNTIME}/bin/upgradetool.jar).
[main] INFO org.openhab.core.tools.UpgradeTool - Executing itemCopyUnitToMetadata: Copy item unit from state description to metadata
[main] INFO org.openhab.core.tools.internal.ItemUnitToMetadataUpgrader - Copying item unit from state description to metadata in database '/var/lib/openhab/jsondb/org.openhab.core.items.Item.json'
[main] ERROR org.openhab.core.tools.internal.ItemUnitToMetadataUpgrader - Cannot access item database '/var/lib/openhab/jsondb/org.openhab.core.items.Item.json', check path and access rights.
[main] INFO org.openhab.core.tools.UpgradeTool - Executing linkUpgradeJSProfile: Upgrade JS profile configuration to new format
[main] INFO org.openhab.core.tools.internal.JSProfileUpgrader - Upgrading JS profile configuration in database '/var/lib/openhab/jsondb/org.openhab.core.thing.link.ItemChannelLink.json'
[main] ERROR org.openhab.core.tools.internal.JSProfileUpgrader - Cannot access link database '/var/lib/openhab/jsondb/org.openhab.core.thing.link.ItemChannelLink.json', check path and access rights.
[main] INFO org.openhab.core.tools.UpgradeTool - Executing linkUpgradeScriptProfile: Upgrade script profile configuration toHandlerScript to commandFromItemScript
[main] INFO org.openhab.core.tools.internal.ScriptProfileUpgrader - Upgrading script profile configuration in database '/var/lib/openhab/jsondb/org.openhab.core.thing.link.ItemChannelLink.json'
[main] ERROR org.openhab.core.tools.internal.ScriptProfileUpgrader - Cannot access link database '/var/lib/openhab/jsondb/org.openhab.core.thing.link.ItemChannelLink.json', check path and access rights.
[main] INFO org.openhab.core.tools.UpgradeTool - Already executed 'yamlTagsListToMap' on 2025-09-08T10:31:54.968080262+01:00[Europe/London]. Use '--force' to execute it again.
[openHAB] JSON Database upgrade completed.

So OpenHAB distinguishes between a missing file in jsondb and a file with content {}. Under this conditions either OpenHAB should unconditionally create org.openhab.core.items.Item.json and org.openhab.core.thing.link.ItemChannelLink.json with content {}, or upgradetool.jar should not log a message, when the files are missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions