OpenHAB in Service Wrapper runs when ran manually, not in launchd on Mac OS X High Sierra

I am running Mac OS X High Sierra on a mini server. I want to start openhab as LaunchDaemon for obvious reasons.

After manually updating the wrapper configuration to fill out the missing and incorrect values for JAVA_HOME, KARAF_BASE and KARAF_HOME, (see [issue 401 on GitHub] (https://github.com/openhab/openhab-distro/issues/401) and the workaround included there) I finally got OpenHAB running in a service wrapper when ran manually ( execute openhab.service). However, when I run this through launchctl as LaunchDaemon, even though with ps aux I see exactly the same information (same user selected in plist file), I get the following error when visiting the web pages:

    HTTP ERROR 404

Problem accessing /start/index. Reason:

    Not Found
Powered by Jetty:// 9.3.21.v20170918

So there is no problem when I run the service manually, openHAB starts and I can access paper UI etc. But not when I start this as a LaunchDaemon. See below for ps output, plist file, etc.

No entries in the logs whatsoever in the case of launchctl, even though tmp.stdout says
Running openHAB runtime...

Any thoughts?
My plist file:

     <?xml version="1.0" encoding="UTF-8"?>
<!--Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements. See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version
    2.0 (the "License"); you may not use this file except in compliance
    with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0 Unless required by
    applicable law or agreed to in writing, software distributed under the
    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
    CONDITIONS OF ANY KIND, either express or implied. See the License for
    the specific language governing permissions and limitations under the
    License.
    -->
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>ProcessType</key>
        <string>Background</string>
        <key>KeepAlive</key>
        <false/>
        <key>Label</key>
        <string>openHAB</string>
        <key>ProgramArguments</key>
        <array>
                <!-- path to your KARAF-service wrapper -->
                <string>/Applications/openhab/runtime/bin/openHAB-service</string>
                <string>console</string>
        </array>
        <key>RunAtLoad</key>
        <false/>
        <key>UserName</key>
        <string>Server</string>
        <key>StandardOutPath</key>
        <string>/tmp/test.stdout</string>
        <key>StandardErrorPath</key>
        <string>/tmp/test.stderr</string>
</dict>
</plist>

sudo ps aux | grep open

`are identical:

server            445   0.0  4.6  6923652 191664   ??  S    11:04pm   0:22.89 /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/bin/java -Dkaraf.home=/Applications/openhab/runtime -Dkaraf.base=/Applications/openhab/runtime -Dkaraf.data=/Applications/openhab/userdata -Dkaraf.etc=/Applications/openhab/userdata/etc -Dcom.sun.management.jmxremote -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -Djava.endorsed.dirs=/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/jre/lib/endorsed:/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/lib/endorsed:/Applications/openhab/runtime/lib/endorsed -Djava.ext.dirs=/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/jre/lib/ext:/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/lib/ext:/Applications/openhab/runtime/lib/ext -Djava.io.tmpdir=/Applications/openhab/userdata/tmp -Dopenhab.home=/Applications/openhab -Dopenhab.conf=/Applications/openhab/conf -Dopenhab.runtime=/Applications/openhab/runtime -Dopenhab.userdata=/Applications/openhab/userdata -Dopenhab.logdir=/Applications/openhab/userdata/logs -Dfelix.cm.dir=/Applications/openhab/userdata/config -Djetty.host=0.0.0.0 -Djetty.http.compliance=RFC2616 -Dorg.ops4j.pax.web.listening.addresses=0.0.0.0 -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -Djava.awt.headless=true -XX:+UseG1GC -Dkaraf.instances=/Applications/openhab/userdata/tmp/instances -Dkaraf.logs=/Applications/openhab/userdata/logs -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/Applications/openhab/userdata/tmp -Djava.util.logging.config.file=/Applications/openhab/userdata/etc/java.util.logging.properties -Djava.library.path=/Applications/openhab/runtime/lib/wrapper/ -classpath /Applications/openhab/runtime/lib/boot/org.apache.karaf.diagnostic.boot-4.1.5.jar:/Applications/openhab/runtime/lib/boot/org.apache.karaf.jaas.boot-4.1.5.jar:/Applications/openhab/runtime/lib/boot/org.apache.karaf.main-4.1.5.jar:/Applications/openhab/runtime/lib/boot/org.osgi.core-6.0.0.jar:/Applications/openhab/runtime/lib/wrapper/karaf-wrapper-main.jar:/Applications/openhab/runtime/lib/wrapper/karaf-wrapper.jar -Dwrapper.key=kHWoNsK37Rg5FCRt -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=416 -Dwrapper.version=3.2.3 -Dwrapper.native_library=wrapper -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1 org.apache.karaf.wrapper.internal.service.Main
server            416   0.0  0.0  4286808   1064   ??  Ss   11:04pm   0:00.05 /Applications/openhab/runtime/bin/openHAB-wrapper /Applications/openhab/userdata/etc/openHAB-wrapper.conf wrapper.syslog.ident=openHAB wrapper.pidfile=/Applications/openhab/runtime/openHAB.wrapper.pid


server            492 328.2  9.6  7053508 400916 s001  R+   11:07pm   1:10.89 /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/bin/java -Dkaraf.home=/Applications/openhab/runtime -Dkaraf.base=/Applications/openhab/runtime -Dkaraf.data=/Applications/openhab/userdata -Dkaraf.etc=/Applications/openhab/userdata/etc -Dcom.sun.management.jmxremote -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -Djava.endorsed.dirs=/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/jre/lib/endorsed:/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/lib/endorsed:/Applications/openhab/runtime/lib/endorsed -Djava.ext.dirs=/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/jre/lib/ext:/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/lib/ext:/Applications/openhab/runtime/lib/ext -Djava.io.tmpdir=/Applications/openhab/userdata/tmp -Dopenhab.home=/Applications/openhab -Dopenhab.conf=/Applications/openhab/conf -Dopenhab.runtime=/Applications/openhab/runtime -Dopenhab.userdata=/Applications/openhab/userdata -Dopenhab.logdir=/Applications/openhab/userdata/logs -Dfelix.cm.dir=/Applications/openhab/userdata/config -Djetty.host=0.0.0.0 -Djetty.http.compliance=RFC2616 -Dorg.ops4j.pax.web.listening.addresses=0.0.0.0 -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -Djava.awt.headless=true -XX:+UseG1GC -Dkaraf.instances=/Applications/openhab/userdata/tmp/instances -Dkaraf.logs=/Applications/openhab/userdata/logs -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/Applications/openhab/userdata/tmp -Djava.util.logging.config.file=/Applications/openhab/userdata/etc/java.util.logging.properties -Djava.library.path=/Applications/openhab/runtime/lib/wrapper/ -classpath /Applications/openhab/runtime/lib/boot/org.apache.karaf.diagnostic.boot-4.1.5.jar:/Applications/openhab/runtime/lib/boot/org.apache.karaf.jaas.boot-4.1.5.jar:/Applications/openhab/runtime/lib/boot/org.apache.karaf.main-4.1.5.jar:/Applications/openhab/runtime/lib/boot/org.osgi.core-6.0.0.jar:/Applications/openhab/runtime/lib/wrapper/karaf-wrapper-main.jar:/Applications/openhab/runtime/lib/wrapper/karaf-wrapper.jar -Dwrapper.key=msmEZ21c2_ebvupf -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=463 -Dwrapper.version=3.2.3 -Dwrapper.native_library=wrapper -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1 org.apache.karaf.wrapper.internal.service.Main
server            463   0.0  0.0  4278616   1052 s001  S+   11:07pm   0:00.03 /Applications/openhab/runtime/bin/openHAB-wrapper /Applications/openhab/userdata/etc/openHAB-wrapper.conf wrapper.syslog.ident=openHAB wrapper.pidfile=/Applications/openhab/runtime/openHAB.wrapper.pid

This is old, but I think I understand why it wouldn’t run on reboot if it still helps. If I understood what I read correctly, in later versions of Mac a LaunchDaemon won’t run as root unless the executable is writable only by root. The plist generated by install-service does not specify a user, so it runs as root by default, and there is no mention of the issue.

My reply to this post describes how I set up my installation.