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

Hi,
i have a problem when running OH3 as a service in Windows.
After the configuration like the documentation, OH3 does not use my userdata-directory.
it creates a ‘userdata’-directory in the ‘userdata’-directory and begins with a clean datastore.

this can not be correct…

when I start OH3 with the start.bat…everything is ok.

my paths in the wrapper-configuration-file are correct…
what can i do?

Ralph

By default a service runs under the local system account.

You can configure the openHAB service in the Windows service settings to run under a different user. These are steps (I will try to translate them to English because I have got a German windows):

  • Press Win+R and enter services.msc
  • Search for the openHAB service
  • Right click and select Properties (or maybe Settings)
  • In the dialog select the second tab
  • Here you can change the account that should be used to execute the service.

Thank you for your answer.

This is not my problem. I have configured the service to run with specific user credentials.
but in any case “systemaccount” or “user” it will use the wrong “userdata”-directory.

i have tested it again with a plain install - same error!

i found out, that there is an error in the documentation:

see here: Windows | openHAB

In the section " Set up openHAB to run as a Windows Service"
See the wrapper example-data. In the line

wrapper.java.additional.11-Dopenhab.userdata-"%OPENHAB_HOME%\userdata"
is missing an “=”

It should be:

wrapper.java.additional.11-Dopenhab.userdata=-"%OPENHAB_HOME%\userdata"

if you correct this file, than the service is running well :wink:

Somebody should correct the documentation…

Ralph

Ouch, I never tried it myself.

I can fix the documentation. Thanks for the hint.

Thank You !!

Doc has already been corrected two day ago, but not yet published.

Tanks for the update. The service is now starting in the correct directories and the correct data base is loaded.

However there is a second problem with the service configuration.

When starting the runtime as a service, then any labels in the database that were typed in, in a foreign language (in my case Greek) do not display correctly.
When the runtime is started using the bat file all the foreign labels show up correctly.

When starting as a service even though the labels that were already entered when the runtime was started by bat file, will not display correctly, any NEW labels that are typed (in a foreign language) when starting as a service will display correctly. The problem is only with existing labels.

Somehow, different fonts are used by the system, when started as service and when started by bat file.

Please try the following:

  • Open the file openHAB-wrapper.conf in the userdate/etc directory
  • Append the following line in the "Java Parameters’ section:

wrapper.java.additional.18=-Dfile.encoding=UTF-8

the number “18” should be replaced to the correct forward running option number.
Restart the service and look

ralph

That solved the problem. Perfect.

Thank you very much for the quick solution.

[quote=“RalphSester, post:9, topic:112110”]
wrapper.java.additional.18=-Dfile.encoding=UTF-8
[/quote]could you help me I have the same thing I use Zulu 11

I get this in cmd A system error has occurred.

System error 1067 has occurred.

The process terminated unexpectedly.

C:\Windows\system32>

thanks Oliver