[mapdb] Can´t get mapdb to store items state or restoreOnStartup

Hi there,

i´m currently trying to get the mapdb persistence running.

What i´ve done so far:

  • Installing mapdb through PaperUI (addons.cfg isn´t used)
  • Creating an mapdb.persist file (changes are mentioned in the logs)
  • Checked the bundles state (Active 1.13.0)
  • the standard persistence is still set to jdbc in runtime.cfg
  • changing the log level to DEBUG and even TRACE
  • the persistence starts and creates files under /var/lib/openhab2/persistence/mapdb (tried to delete them)

There´s no message about an items state being stored with mapdb.

Did i missed something?

mapdb.persist

Strategies
{
  default = everyChange
}

Items
{
  * : strategy = everyChange, restoreOnStartup
}

Log after starting the service:

2019-01-15 21:06:01.877 [DEBUG] [org.openhab.persistence.mapdb       ] - ServiceEvent UNREGISTERING - {org.openhab.core.persistence.PersistenceService}={commitsamestate=false, service.id=457, service.bundleid=253, service.scope=bundle, commitinterval=5, service.pid=org.openhab.mapdb, component.name=org.openhab.persistence.mapdb, component.id=294} - org.openhab.persistence.mapdb
2019-01-15 21:06:01.884 [DEBUG] [pdb.internal.MapDBPersistenceService] - mapdb persistence service deactivated
2019-01-15 21:06:01.904 [DEBUG] [pdb.internal.MapDBPersistenceService] - Found 1 MapDB-Jobs to delete from DefaultScheduler (keys=[MapDB_SchedulerGroup.Commit_Transaction])
2019-01-15 21:06:01.923 [DEBUG] [org.openhab.persistence.mapdb       ] - BundleEvent STOPPING - org.openhab.persistence.mapdb
2019-01-15 21:06:01.929 [DEBUG] [b.internal.MapDBPersistenceActivator] - MapDB persistence bundle has been stopped.
2019-01-15 21:06:01.947 [DEBUG] [org.openhab.persistence.mapdb       ] - ServiceEvent UNREGISTERING - {org.osgi.service.cm.ManagedService}={service.id=456, service.bundleid=253, service.scope=singleton} - org.openhab.persistence.mapdb
2019-01-15 21:06:01.954 [DEBUG] [org.openhab.persistence.mapdb       ] - BundleEvent STOPPED - org.openhab.persistence.mapdb
2019-01-15 21:06:01.961 [DEBUG] [org.openhab.persistence.mapdb       ] - BundleEvent STARTING - org.openhab.persistence.mapdb
2019-01-15 21:06:01.964 [DEBUG] [b.internal.MapDBPersistenceActivator] - MapDB persistence bundle has been started.
2019-01-15 21:06:01.993 [DEBUG] [org.openhab.persistence.mapdb       ] - ServiceEvent REGISTERED - {org.osgi.service.cm.ManagedService}={service.id=474, service.bundleid=253, service.scope=singleton} - org.openhab.persistence.mapdb
2019-01-15 21:06:02.003 [DEBUG] [pdb.internal.MapDBPersistenceService] - mapdb persistence service is being activated
2019-01-15 21:06:02.156 [DEBUG] [pdb.internal.MapDBPersistenceService] - Scheduled Commit-Job with interval 5sec.
2019-01-15 21:06:02.162 [DEBUG] [pdb.internal.MapDBPersistenceService] - mapdb persistence service is now activated
2019-01-15 21:06:02.180 [DEBUG] [org.openhab.persistence.mapdb       ] - ServiceEvent REGISTERED - {org.openhab.core.persistence.PersistenceService}={commitsamestate=false, service.id=475, service.bundleid=253, service.scope=bundle, commitinterval=5, service.pid=org.openhab.mapdb, component.name=org.openhab.persistence.mapdb, component.id=309} - org.openhab.persistence.mapdb
2019-01-15 21:06:02.186 [DEBUG] [org.openhab.persistence.mapdb       ] - BundleEvent STARTED - org.openhab.persistence.mapdb
  • Platform information:
    • Hardware: Raspberry Pi 3B
    • OS: raspbian 9
    • Java Runtime Environment:
      • openjdk version “1.8.0_152”
        OpenJDK Runtime Environment (Zulu Embedded 8.25.0.76-linux-aarch32hf)
        OpenJDK Client VM (Zulu Embedded 8.25.0.76-linux-aarch32hf)
    • openHAB version: 2.3.0-1 (Release Build)

The persistence service only or openHAB?

Only the persistence service because i did a restart via bundle:restart org.openhab.persistence.mapdb

Did you restart OH. It is sometimes necessary after persistence config changes

Yes multiple times after installing the persistence.

Have you found a solution? I seem to have the same problem.

Not a real solution.
I removed everything from mapdb and installed it again.

Hi Michael, I’m having the same issue as you. Can you elaborate a bit on what you mean by “remove everything from mapdb”? Was ist just deleting the mapdb.persist file, and uninstalling and reinstalling the mapdb service? Thanks in advance for your help.

If i remember correctly…

  • Open the Karaf console
    • sudo openhab-cli console
  • Identify the MapDB package
    • bundle:list | grep MapDB
  • Uninstalling mapdb through Karaf
    • bundle:uninstall XXX <- Bundle ID
  • Removing the mapdb.config file
    • It´s located in openhab2-userdata\config\org\openhab
  • Restarting openHAB runtime
    • sudo service openhabe2 restart
  • Download the latest MapDB .jar file
  • Copy the .jar file into your addons folder
  • Check the Karaf console again
    • bundle:list | grep MapDB
    • You should see MapDB with version 2.5.0 M4

kind regards
Michael

Hi Michael, thanks for the super quick and clear reply.
After copying the latest Jenkins Build 2.5.0 M4 MapDB .jar file to the addons folder, I get some errors during startup.

2019-10-28 20:55:59.578 [INFO ] [org.apache.felix.fileinstall        ] - Installing bundle org.openhab.persistence.mapdb / 2.5.0.M4

2019-10-28 20:55:59.649 [DEBUG] [org.openhab.persistence.mapdb       ] - BundleEvent INSTALLED - org.openhab.persistence.mapdb

2019-10-28 20:55:59.763 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.persistence.mapdb-2.5.0.M4.jar

org.osgi.framework.BundleException: Could not resolve module: org.openhab.persistence.mapdb [230]

  Unresolved requirement: Import-Package: org.mapdb; version="[1.0.0,2.0.0)"

2019-10-28 20:57:00.062 [ERROR] [org.openhab.persistence.mapdb       ] - FrameworkEvent ERROR - org.openhab.persistence.mapdb

org.osgi.framework.BundleException: Could not resolve module: org.openhab.persistence.mapdb [230]

  Unresolved requirement: Import-Package: org.mapdb; version="[1.0.0,2.0.0)"

2019-10-28 20:57:09.199 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.persistence.mapdb-2.5.0.M4.jar

org.osgi.framework.BundleException: Could not resolve module: org.openhab.persistence.mapdb [230]

  Unresolved requirement: Import-Package: org.mapdb; version="[1.0.0,2.0.0)"

It seems to me like a dependency issue? I tried to find something like this in the community and google but no luck.
On a related note, why do Paper UI and the Maven openHAB Distribution have 1.14.0 as the latest MapDB version?
For context I’m running openHAB 2.5.0~S1703-1 (Build #1703) with openHABian v1.5

I would suggest to create a new topic and refer to this topic.
Have a look at this thread and try to include as much informations as possible.