Windows service not working after upgrading to OH3 from OH2.5

Hi!

The windows service stopped working after I upgraded from OH 2.5.11 to 3.2.0. I changed the JAVA_HOME environment variable to Java 11 and OH3 works fine when starting it from the command prompt.

Is there any migration instructions for the windows service from 2.5 to 3.X or do I have to uninstall it and start from scratch with these installation instructions:
Installation windows service

The default install directory changed OH3. Has you directory changed?

If so you will have to recreate/install the service

No, it’s the same directory as before the upgrade: C:\Openhab\

Any log entries in windows eventslog ?

Found this in wrapper.log:

STATUS | wrapper  | 2022/01/22 17:28:14 | --> Wrapper Started as Service
STATUS | wrapper  | 2022/01/22 17:28:15 | Launching a JVM...
INFO   | jvm 1    | 2022/01/22 17:28:15 | -Djava.endorsed.dirs=C:\Program Files\Java\jdk-11.0.13\jre\lib\endorsed;C:\Program Files\Java\jdk-11.0.13\lib\endorsed;C:\OpenHAB\runtime\lib\endorsed is not supported. Endorsed standards and standalone APIs
INFO   | jvm 1    | 2022/01/22 17:28:15 | in modular form will be supported via the concept of upgradeable modules.
INFO   | jvm 1    | 2022/01/22 17:28:15 | Error: Could not create the Java Virtual Machine.
INFO   | jvm 1    | 2022/01/22 17:28:15 | Error: A fatal exception has occurred. Program will exit.
ERROR  | wrapper  | 2022/01/22 17:28:15 | JVM exited while loading the application.
STATUS | wrapper  | 2022/01/22 17:28:20 | Launching a JVM...
INFO   | jvm 2    | 2022/01/22 17:28:20 | -Djava.endorsed.dirs=C:\Program Files\Java\jdk-11.0.13\jre\lib\endorsed;C:\Program Files\Java\jdk-11.0.13\lib\endorsed;C:\OpenHAB\runtime\lib\endorsed is not supported. Endorsed standards and standalone APIs
INFO   | jvm 2    | 2022/01/22 17:28:20 | in modular form will be supported via the concept of upgradeable modules.
INFO   | jvm 2    | 2022/01/22 17:28:20 | Error: Could not create the Java Virtual Machine.
INFO   | jvm 2    | 2022/01/22 17:28:20 | Error: A fatal exception has occurred. Program will exit.
ERROR  | wrapper  | 2022/01/22 17:28:20 | JVM exited while loading the application.
STATUS | wrapper  | 2022/01/22 17:28:25 | Launching a JVM...
INFO   | jvm 3    | 2022/01/22 17:28:25 | -Djava.endorsed.dirs=C:\Program Files\Java\jdk-11.0.13\jre\lib\endorsed;C:\Program Files\Java\jdk-11.0.13\lib\endorsed;C:\OpenHAB\runtime\lib\endorsed is not supported. Endorsed standards and standalone APIs
INFO   | jvm 3    | 2022/01/22 17:28:25 | in modular form will be supported via the concept of upgradeable modules.
INFO   | jvm 3    | 2022/01/22 17:28:25 | Error: Could not create the Java Virtual Machine.
INFO   | jvm 3    | 2022/01/22 17:28:25 | Error: A fatal exception has occurred. Program will exit.
ERROR  | wrapper  | 2022/01/22 17:28:25 | JVM exited while loading the application.
STATUS | wrapper  | 2022/01/22 17:28:30 | Launching a JVM...
INFO   | jvm 4    | 2022/01/22 17:28:30 | -Djava.endorsed.dirs=C:\Program Files\Java\jdk-11.0.13\jre\lib\endorsed;C:\Program Files\Java\jdk-11.0.13\lib\endorsed;C:\OpenHAB\runtime\lib\endorsed is not supported. Endorsed standards and standalone APIs
INFO   | jvm 4    | 2022/01/22 17:28:30 | in modular form will be supported via the concept of upgradeable modules.
INFO   | jvm 4    | 2022/01/22 17:28:30 | Error: Could not create the Java Virtual Machine.
INFO   | jvm 4    | 2022/01/22 17:28:30 | Error: A fatal exception has occurred. Program will exit.
ERROR  | wrapper  | 2022/01/22 17:28:30 | JVM exited while loading the application.
STATUS | wrapper  | 2022/01/22 17:28:35 | Launching a JVM...
INFO   | jvm 5    | 2022/01/22 17:28:35 | -Djava.endorsed.dirs=C:\Program Files\Java\jdk-11.0.13\jre\lib\endorsed;C:\Program Files\Java\jdk-11.0.13\lib\endorsed;C:\OpenHAB\runtime\lib\endorsed is not supported. Endorsed standards and standalone APIs
INFO   | jvm 5    | 2022/01/22 17:28:35 | in modular form will be supported via the concept of upgradeable modules.
INFO   | jvm 5    | 2022/01/22 17:28:35 | Error: Could not create the Java Virtual Machine.
INFO   | jvm 5    | 2022/01/22 17:28:35 | Error: A fatal exception has occurred. Program will exit.
ERROR  | wrapper  | 2022/01/22 17:28:35 | JVM exited while loading the application.
FATAL  | wrapper  | 2022/01/22 17:28:36 | There were 5 failed launches in a row, each lasting less than 300 seconds.  Giving up.
FATAL  | wrapper  | 2022/01/22 17:28:36 |   There may be a configuration problem: please check the logs.
STATUS | wrapper  | 2022/01/22 17:28:36 | <-- Wrapper Stopped

Check if this helps:

This got med a step further! The service now starts correctly and I can log in to OpenHab. But now I get a different error in the wrapper log (see below). I also get a lot of errors when Openhab starts that I don’t get if I start it manually, so something is still not working.

STATUS | wrapper  | 2022/01/24 13:14:32 | --> Wrapper Started as Service
STATUS | wrapper  | 2022/01/24 13:14:32 | Launching a JVM...
INFO   | jvm 1    | 2022/01/24 13:14:38 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
INFO   | jvm 1    | 2022/01/24 13:14:38 |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
INFO   | jvm 1    | 2022/01/24 13:14:38 | 
INFO   | jvm 1    | 2022/01/24 13:14:38 | 
INFO   | jvm 1    | 2022/01/24 13:14:38 | WARNING - Unable to load the Wrapper's native library 'wrapper.dll'.
INFO   | jvm 1    | 2022/01/24 13:14:38 |           The file is located on the path at the following location but
INFO   | jvm 1    | 2022/01/24 13:14:38 |           could not be loaded:
INFO   | jvm 1    | 2022/01/24 13:14:38 |             C:\OpenHAB\userdata\lib\wrapper\wrapper.dll
INFO   | jvm 1    | 2022/01/24 13:14:38 |           Please verify that the file is readable by the current user
INFO   | jvm 1    | 2022/01/24 13:14:38 |           and that the file has not been corrupted in any way.
INFO   | jvm 1    | 2022/01/24 13:14:38 |           One common cause of this problem is running a 32-bit version
INFO   | jvm 1    | 2022/01/24 13:14:38 |           of the Wrapper with a 64-bit version of Java, or vica versa.
INFO   | jvm 1    | 2022/01/24 13:14:38 |           This is a 64-bit JVM.
INFO   | jvm 1    | 2022/01/24 13:14:38 |           Reported cause:
INFO   | jvm 1    | 2022/01/24 13:14:38 |             C:\OpenHAB\userdata\lib\wrapper\wrapper.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
INFO   | jvm 1    | 2022/01/24 13:14:38 |           System signals will not be handled correctly.
INFO   | jvm 1    | 2022/01/24 13:14:38 | 
INFO   | jvm 1    | 2022/01/24 13:14:48 | jan. 24, 2022 1:14:47 EM org.apache.karaf.main.lock.SimpleFileLock lock
INFO   | jvm 1    | 2022/01/24 13:14:48 | INFO: Trying to lock C:\OpenHAB\userdata\tmp\lock
INFO   | jvm 1    | 2022/01/24 13:14:48 | jan. 24, 2022 1:14:47 EM org.apache.karaf.main.lock.SimpleFileLock lock
INFO   | jvm 1    | 2022/01/24 13:14:48 | INFO: Lock acquired
INFO   | jvm 1    | 2022/01/24 13:14:48 | jan. 24, 2022 1:14:47 EM org.apache.karaf.main.Main$KarafLockCallback lockAcquired
INFO   | jvm 1    | 2022/01/24 13:14:48 | INFO: Lock acquired. Setting startlevel to 100
INFO   | jvm 1    | 2022/01/24 13:14:48 | jan. 24, 2022 1:14:48 EM org.apache.karaf.main.ShutdownSocketThread run
INFO   | jvm 1    | 2022/01/24 13:14:48 | INFO: Shutdown socket thread is listening on 127.0.0.1:59088
INFO   | jvm 1    | 2022/01/24 13:15:59 | Warning: Nashorn engine is planned to be removed from a future JDK release
INFO   | jvm 1    | 2022/01/24 13:16:01 | Warning: Nashorn engine is planned to be removed from a future JDK release
INFO   | jvm 1    | 2022/01/24 13:20:36 | Warning: Nashorn engine is planned to be removed from a future JDK release
INFO   | jvm 1    | 2022/01/24 13:20:36 | Warning: Nashorn engine is planned to be removed from a future JDK release

hmm…it seems like I hade these errors in wrapper log already in the 2.5.11-installation before the upgrade, but things seemd to work fine then.

The service starts now but it can not find the configuration file, so nothing really works. This is how the OH-log looks like:

13:37:55.397 [WARN ] [ervice.jetty.internal.JettyServerImpl] - server configuration file location is invalid
13:37:57.397 [WARN ] [e.jetty.internal.ServerControllerImpl] - SSL password and SSL keystore password must be set in order to enable SSL.
13:37:57.397 [WARN ] [e.jetty.internal.ServerControllerImpl] - SSL connector will not be started
13:38:53.287 [WARN ] [.core.karaf.internal.FeatureInstaller] - Cannot determine online repo url - online repo support will be disabled. Error: userdata\etc\version.properties (Det g䰠inte att hitta s񪷤gen)
13:38:53.303 [WARN ] [.core.karaf.internal.FeatureInstaller] - Cannot determine online repo url - online repo support will be disabled.
13:39:21.397 [INFO ] [b.core.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
13:39:34.115 [INFO ] [org.openhab.ui.internal.UIService    ] - Started UI on port 8080
13:39:42.522 [INFO ] [ig.discovery.internal.PersistentInbox] - Added new thing 'chromecast:chromecast:9d01a45aa95a4792ac167a427342046c' to inbox.
13:39:43.006 [INFO ] [ig.discovery.internal.PersistentInbox] - Added new thing 'chromecast:chromecast:791e9b1d736f7a7944fc2aeba162fb5b' to inbox.
13:39:43.600 [INFO ] [ig.discovery.internal.PersistentInbox] - Added new thing 'chromecast:chromecast:a50d8d04763537e17cabc35db3909dea' to inbox.
13:39:44.225 [INFO ] [ig.discovery.internal.PersistentInbox] - Added new thing 'chromecast:chromecast:367d55dc470ed4f3cbe13826462caa93' to inbox.
13:39:44.881 [INFO ] [ig.discovery.internal.PersistentInbox] - Added new thing 'chromecast:chromecast:6242923818b3eb66562094af490d2f4f' to inbox.
13:39:44.912 [INFO ] [ig.discovery.internal.PersistentInbox] - Added new thing 'chromecast:chromecast:1dd19d04abcfa7509f61754b99fcbcbf' to inbox.
13:39:44.928 [INFO ] [ig.discovery.internal.PersistentInbox] - Added new thing 'chromecast:chromecast:b146be0249d68f0ffb9d923331fec607' to inbox.
13:39:44.928 [INFO ] [ig.discovery.internal.PersistentInbox] - Added new thing 'chromecast:audiogroup:3166bade-5937-4b6c-af4f-1a5bf2193a51' to inbox.
13:39:45.193 [INFO ] [ig.discovery.internal.PersistentInbox] - Added new thing 'chromecast:chromecast:c2454bec3e3fd7195d19096deff55924' to inbox.
13:39:45.209 [INFO ] [ig.discovery.internal.PersistentInbox] - Added new thing 'chromecast:chromecast:85e0ec405efc424e7579e38b0a434878' to inbox.
13:39:57.115 [ERROR] [.io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance. Reconnecting.
13:39:59.351 [INFO ] [hab.ui.habpanel.internal.HABPanelTile] - Started HABPanel at /habpanel
13:39:59.492 [ERROR] [.io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance. Reconnecting.
13:40:01.716 [ERROR] [.io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance. Reconnecting.
13:40:07.050 [ERROR] [.io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance. Reconnecting.
13:40:15.801 [ERROR] [.io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance. Reconnecting.
13:40:28.231 [ERROR] [.io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance. Reconnecting.
13:40:58.480 [ERROR] [.io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance. Reconnecting.
13:41:28.760 [WARN ] [okhttp3.OkHttpClient                 ] - A connection to https://myopenhab.org/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);
13:41:28.807 [WARN ] [okhttp3.OkHttpClient                 ] - A connection to https://myopenhab.org/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);
13:41:28.823 [ERROR] [.io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance. Reconnecting.
13:41:58.978 [ERROR] [.io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance. Reconnecting.
13:42:29.147 [ERROR] [.io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance. Reconnecting.

This is how my wrapper configuration looks like right now:

#*******************************************************
# openHAB2-wrapper.conf for Windows Service Installation
#*******************************************************

# openHAB installation dir (Adapt this first setting to your system)
set.default.OPENHAB_HOME=C:\OpenHAB

# Wrapper Properties
set.default.OPENHAB_CONF=%OPENHAB_HOME%\conf
set.default.OPENHAB_RUNTIME=%OPENHAB_HOME%\runtime
set.default.OPENHAB_USERDATA=%OPENHAB_HOME%\userdata
set.default.OPENHAB_LOGDIR=%OPENHAB_USERDATA%\logs
set.default.KARAF_HOME=%OPENHAB_RUNTIME%
set.default.KARAF_BASE=%OPENHAB_USERDATA%
set.default.KARAF_DATA=%OPENHAB_USERDATA%
set.default.KARAF_ETC=%OPENHAB_USERDATA%\etc
set.default.PATH=%PATH%;%KARAF_BASE%\lib;%KARAF_HOME%\lib

# Java Application
wrapper.working.dir=%KARAF_BASE%
wrapper.java.command=%JAVA_HOME%\bin\java
wrapper.java.mainclass=org.apache.karaf.wrapper.internal.service.Main
wrapper.java.classpath.1=%KARAF_HOME%\lib\boot\*.jar
wrapper.java.classpath.2=%KARAF_DATA%\lib\wrapper\*.jar
wrapper.java.classpath.3=%KARAF_HOME%\lib\jdk9plus\*.jar
wrapper.java.classpath.4=%KARAF_HOME%\lib\endorsed\*.jar
wrapper.java.library.path.1=%KARAF_DATA%\lib\wrapper\

# Java Parameters
wrapper.java.additional.1=-Dkaraf.home="%KARAF_HOME%"
wrapper.java.additional.2=-Dkaraf.base="%KARAF_BASE%"
wrapper.java.additional.3=-Dkaraf.data="%KARAF_DATA%"
wrapper.java.additional.4=-Dkaraf.etc="%KARAF_ETC%"
wrapper.java.additional.5=-Dcom.sun.management.jmxremote
wrapper.java.additional.6=-Dkaraf.startLocalConsole=false
wrapper.java.additional.7=-Dkaraf.startRemoteShell=true
# wrapper.java.additional.8=-Djava.endorsed.dirs="%JAVA_HOME%\jre\lib\endorsed;%JAVA_HOME%\lib\endorsed;%KARAF_HOME%\lib\endorsed"
# wrapper.java.additional.9=-Djava.ext.dirs="%JAVA_HOME%\jre\lib\ext;%JAVA_HOME%\lib\ext;%KARAF_HOME%\lib\ext"
wrapper.java.additional.10=-Dopenhab.home="%OPENHAB_HOME%"
wrapper.java.additional.11=-Dopenhab.conf="%OPENHAB_HOME%\conf"
wrapper.java.additional.12=-Dopenhab.runtime="%OPENHAB_HOME%\runtime"
wrapper.java.additional.13=-Dopenhab.userdata="%OPENHAB_HOME%\userdata"
wrapper.java.additional.14=-Dopenhab.logdir="%OPENHAB_USERDATA%\logs"
wrapper.java.additional.15=-Dfelix.cm.dir="%OPENHAB_HOME%\userdata\config"
wrapper.java.additional.16=-Dorg.osgi.service.http.port=8080
wrapper.java.additional.17=-Dorg.osgi.service.http.port.secure=8443
wrapper.java.additional.18=-Dfile.encoding="UTF-8"
wrapper.java.maxmemory=512

# Wrapper Logging Properties
wrapper.console.format=PM
wrapper.console.loglevel=INFO
wrapper.logfile=%OPENHAB_USERDATA%\logs\wrapper.log
wrapper.logfile.format=LPTM
wrapper.logfile.loglevel=INFO
wrapper.logfile.maxsize=10m
wrapper.logfile.maxfiles=5
wrapper.syslog.loglevel=NONE

# Wrapper Windows Properties
wrapper.console.title=openHAB2
wrapper.ntservice.name=openHAB2
wrapper.ntservice.displayname=openHAB2
wrapper.ntservice.description=openHAB 2 Service
wrapper.ntservice.dependency.1=
wrapper.ntservice.starttype=AUTO_START
wrapper.ntservice.interactive=false

There are quite a few references to openHAB2. I wonder if that is not the issue?

Even the wrapper.conf refers to openHAB2.

I copied the current wrapper.config from the installations instructions and it seems to work now: https://www.openhab.org/docs/installation/windows.html#set-up-openhab-to-run-as-a-windows-service

I don’t know exactly what made it work, they seem almost the same to me, but everything seems fine for now. Thanks for pointing me in the right direction!