OH2 snapshot online version using wrong folder for mapdb persistence

I’m slowly migrating from OH1 to OH2 and encountered my first problem:

I’m using the online snapshot version (#496, manual install in /opt/openhab2) and have the mapdb 1.9.0 persistence service (through addons.cfg) installed.
After starting openHAB2 I get the following error in openhab.log:

2016-09-24 12:14:59.335 [ERROR] [org.openhab.persistence.mapdb       ] - [org.openhab.persistence.mapdb(194)] The activate method has thrown an exception
java.io.IOError: java.io.IOException: Parent folder does not exist: /opt/openhab2/userdata/persistence/mapdb/storage.mapdb

When I extract the downloaded online snapshot version, there is indeed no
folder, instead there is a

After manually creating the /userdata/persistence/mapdb folder and restarting openHAB the error is gone.

Did I do something wrong?

There are two uses of mapdb. If you are using mapdb persistence, then it will (I believe) go in the persistence/mapdb folder. However there is also the storage system for storing all your configuration (as used by the system) and this is stored in the mapdb folder.

What I’ve found out after playing around: as soon as I define a default persistence service via ui, the folder /persistence/mapdb gets created and everything is working fine.

The database in /userdata/mapdb does not get populated when I change my testswitch from ON to OFF or vica versa, so it looks like it is used by the system and has nothing to do with the mapdb persistence service.

Thx for your explanation.

I had the same problem and documented in the Migration tutorial, though I didn’t spend the time to find out why. It is good to know that the setting the default persistence creates this folder for you. I’ll run some tests and perhaps update the tutorial to move that step higher in the list.

I would nonetheless suggest to file an issue for the mapdb persistence service as it shouldn’t throw an exception, if its database file isn’t yet initialized - this should be an expected situation and no reason to log an ERROR to the user.

I agree and was just looking to see if it is more appropriate to file it on OH 2 or ESH.

ESH correct?

No, it needs to be filed where the code resides, i.e. OH1!

OK, I thought this was a more widespread issue, not just a MapDB one. Filing Issue now…