(Solved) Problem running OH3.0 CR2 as a service on Windows 10

  • Platform information:
    • Hardware: _Intel 2x86
    • OS: Windows 10
    • Java Runtime Environment: Julu 11
    • openHAB version: OH3.0 RC2

I have been running OH 3.0 RC 2 on Windows 10 for the last couple of days with out any problem and was able to create a new data base from scratch.

Today I tried to make the necessary changes in order to run OH as a service.
I followed the instructions in the new documentation about running OH 3 as a service and upon restarting OH was loaded and running as expected.
However when I tried to open the web side on the localhost I was presented with the dialogue for creating a new administrator and a brand new data base was created from scratch with out any entries in it.

I copied back the complete openhab directory from backup and I regained my old data base with all entries but off course without the ability to start as a service.

I repeated the instructions on the new documentation for a second time and again had the same result. The service started but with a completely new data base.

What am I doing wrong …

Is the wrapper.conf using the right folders? Make sure that OPENHAB_HOME is pointing at your OH 3 folder.

It appears that it’s looking in the wrong place for your conf and userdata folders.

Thanks for the reply Rich. Always value your posts.

Unfortunately OPEN_HOME seems not to be the problem. Checked it again and again .
It is pointing to C:\openHAB which is the correct OH directory.

set.default.OPENHAB_HOME=C:\openHAB

Can it be some other entry in wrapper.conf ?
I checked the userdata/jsondb folder and the correct data files are still there. So it must be some kind of a pointer showing in the wrong direction.
Maybe necessary to clean a cache or something.?
The problem remains even after several restarts.

No, if it’s different when you run it using start.bat from when you run it as a service, the problem is in that service wrapper config somewhere. I can’t say how or where the problem is though. Just that, based on appearances, it’s getting the paths wrong.

Clearing the cache won’t do anything for this. All that really does if force a reinstallation of the addons.

Investigating this problem further I have found that when the openHAB service is started for the first time it creates a second userdata directory within the original userdata containing empty jsondb files… i.e

C:\openhab\userdata\userdata\jsondb

This is the reason that when starting the runtime as a service is asking for the creation of a new data base even though there is an existing database in C:\openhab\userdata\jsondb.

Deleting this additional directory and starting the service will create the additional directory again.

I went through the openHAB-wrapper.conf file and the C:\openhab\userdata\bin\openHAB-service.bat file but I cannot find anything wrong that could cause such a behavior.

A walk around to solve this problem is to copy the contents of the original C:\openhab\userdata\jsondb directory into C:\openhab\userdata\userdata\jsondb in which case the service is working properly but off course this is not a good solution since in such a case, starting the runtime using the start.bat batch file will access the wrong data base located in C:\openhab\userdata\jsondb.

Any advice as to the cause of this problem will be greatly appreciated.

I have noticed this exact problem as well in Stable Release of OF 3.0.0. All worked fine on previous 2.5.x

I have even compared the two openHAB-wrapper.conf files and they all seem almost identical - nothing different in any of the paths anyway.

This looks like a bug - anyone else come across it / found a fix?

Problem is solved.
Please see topic.
“[SOLVED] When running OpenHAB 3 as a windows-service - it takes wrong userdata-directory]”

([SOLVED] When running OpenHAB 3 as a windows-service - it takes wrong userdata-directory)