[SOLVED] Openhab 2.3 and systemd (Error executing command: java.lang.NullPointerException)

I tried to upgrade from version 2.1 to 2.3 but I can get it running with systemd

if I start “start.sh”, everything works now. But if i try to start it as a daemon with systemd it doesn’t.

In my system logs I can see the karaf console output followed by this line

openhab> Error executing command: java.lang.NullPointerException

and in my openhab.log I see a normal startup. Initializing items and rules and at the end it is shutting down itself.

It is a new openhab installation. Means an empty cache. I also updated my jdk to version 1.8.171 but nothing helps.

my service configuration is using a modified version from here.

anyone has an idea?

I haven’t updated to OH 2.3 but for my installation I use a simpler definition that directly executes “start.sh”

This is my definition (OH ist installed in /opt/openhab).

[Unit]
Description=Starts and stops the openHAB Home Automation Bus
Documentation=http://www.openhab.org
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
GuessMainPID=yes
User=openhab
ExecStart=/opt/openhab2/start.sh
ExecStop=/bin/kill -SIGINT $MAINPID
Restart=on-failure
WorkingDirectory=/opt/openhab2

[Install]
WantedBy=multi-user.target

i had a similar configuration before too. After i found this post

i changed my configuration to the new one

but both versions are generating the same error

Hmm, strange.

What operating sytem are you using?

I will update my installation to OH 2.3 in the next days and will see what happens …

I’m using opensuse 42.3

I found the reason. In my openhab.service file I was setting

Environment=OPENHAB_STARTMODE=debug

but this creates the karaf console which does work with systemd

instead I’m setting now

Environment=OPENHAB_STARTMODE=daemon

and this works :rofl:

1 Like