Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

[MapDB] should just create a default directory and data store if it doesn't already exist #4662

Closed
rkoshak opened this issue Sep 24, 2016 · 2 comments

Comments

@rkoshak
Copy link

rkoshak commented Sep 24, 2016

Expected Behavior

When using MapDB on a new openHAB 2 install it should create missing parent folders for the path to its persistence files instead of throwing an error in the logs.

Current Behavior

When migrating to a brand new openHAB 2 install and first starting up MapDB persistence an error gets thrown in the logs complaining about the parent directory not existing.

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

To correct the error one need only manually create the persistence/mapdb folder.

This may primarily be a problem with openHAB 2 manual installs only as I saw it when setting up openHAB 2 in Docker and this thread is using paths that imply a manual install.

Possible Solution

Have the binding create missing parent directories if they are missing.

Steps to Reproduce (for bugs)

  1. Stop openHAB 2
  2. Move or remove the userdata/persistence/mapdb folder
  3. Start openHAB 2

Context

Initial setup and configuration of openHAB 2. It was an unexpected, if easily manually mitigated error.

Your Environment

  • Version used: openHAB 2, latest snapshot on Docker image, linked to thread above is using some openHAB 2 apparently manually installed
  • Official Docker Image, not sure about linked to thread
  • Ubuntu 16.1 based OS

@9037568
Copy link
Contributor

9037568 commented Dec 1, 2016

As far as I can tell this feature has existed at least since 1.7.

Anyone have a good debug log?

See referenced issue.

9037568 added a commit to 9037568/openhab that referenced this issue Dec 1, 2016
initialization.

The main change is modifying mkdir() to mkdirs() to cover the case where
more than one directory in the path does not exist. Also added some
additional debugging/log messages.

Fixes openhab#4662.
Fixes openhab#4844.
@9037568
Copy link
Contributor

9037568 commented Dec 1, 2016

I have a code change ready that should fix this. Would someone like to try out this test jar?

The code change is in my fork. If someone can verify the fix, I'll create a PR.

kaikreuzer pushed a commit that referenced this issue Dec 2, 2016
initialization.

The main change is modifying mkdir() to mkdirs() to cover the case where
more than one directory in the path does not exist. Also added some
additional debugging/log messages.

Fixes #4662.
Fixes #4844.
mvolaart pushed a commit to mvolaart/openhab that referenced this issue Dec 23, 2016
…nhab#4850)

initialization.

The main change is modifying mkdir() to mkdirs() to cover the case where
more than one directory in the path does not exist. Also added some
additional debugging/log messages.

Fixes openhab#4662.
Fixes openhab#4844.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants