Okey than i’m going to try the xml way
I was looking for this info too. The 2.0 b3 obeys the port config in
I had to change it, as the 8080 was already taken by another app, motion. Maybe this helps someone looking for info, and would end up into docs. Note, it must have “export” in it.
Hello, I have fresh installation on PC with Win7. The port 8080 is blocked and I need to change to any else. In previously version of OpenHAB I used 1883 and its worked fine.
In tutorial here: http://docs.openhab.org/installation/index.html
is note: export OPENHAB_HTTP_PORT=8011
But where??? I tried to change start.bat, but no change…
Thank you for your help.
The export statement is for linux users. I believe in windows, you’ll need to add a system variable to define the openhab port. Go to System->System Variables and add a new one with the same syntax as the others already there.
For anyone else coming across this, I have just setup OH2_b4 on an RPi3 and found I had to change the HTTP_PORT value near the top of /usr/share/openhab2/runtime/karaf/bin/setenv
The export OPENHAB_HTTP_PORT option in /etc/defaults/openhab2 didn’t seem to work for some reason, but I may have missed something.
Hope that helps.
I managed to change the ports on OH2 on a RPi3 by editing /etc/default/openhab2
sudo nano /etc/default/openhab2
add the lines
DONT use export, it will not work
elysiandc solution worked but the file was changed in every update
Hope that helps
looks like for oh2 beta 5 the right (?) place to change port settings is /opt/openhab2/runtime/bin/setenv
Kindly let me know if there is an easier, e.g. more elegant way to adapt ports
That would work but @Fivos_G’s answer above you should be more appropriate, since that file won’t get reset each upgrade.
@Benjy valid point taken.
However at manual installation there is no file /etc/defaults/openhab2, neither under ./runtime/etc nor at ./userdata/etc.
Tried to create ./userdata/etc/defaults/openhab2 and add
but it did not work
Finally what worked was to add in: /opt/openhab2/start.sh following lines:
I got the same problem.
I installed openhab2 beta via apt-get on my raspsi (still wheezy, but up to date)
Port 8080 is already taken.
I get this error:
2017-01-17 00:28:50.835 [ERROR] [.service.internal.HttpServiceStarted] - Could not start the servlet context for context path  xjava.net.BindException: Die Adresse wird bereits verwendet
I added the parameters to /etc/default/openhab2.
EXTRA_JAVA_OPTS="" OPENHAB_HTTP_PORT=9090 OPENHAB_HTTPS_PORT=9091
But the error still hapens.
should not be necessary. I just tested setting OPENHAB_HTTP_PORT and OPENHAB_HTTPS_PORT as environment variables on a normal installation (not APT!) and all works as expected.
I therefore assume that the problem is with the apt installation only. @Benjy did you test this yourself already?
was there by default.
I just added some echos to debug.
echo "HTTP: $OPENHAB_HTTP_PORT" >> /tmp/oh_port.txt
I get an emtpy value everytime.
echo "HTTP2: $OPENHAB_HTTP_PORT" >> /tmp/oh_port.txt
I get the correct value.
When starting or stopping the service I get this:
HTTP2: 9090 HTTP:
For some reason the value (or the variable) gets deleted or is not accessible in the setenv script.
Maybe I can debug further in the evening.
I’ll have a look too.
@christoph_wempe, what happens if you run:
systemctl --system daemon-reload sudo service openhab2 restart
after you change
Will do when I know what the correct ones are!
Cannot do that.
I am still running respbian wheezy on my test system.
sudo: systemctl: command not found
Right, I have a test machine with Ubuntu 14 which will have the same service system. I should be able to test what’s going on in a couple of days and get back to you!
I did some more debuging and added this to both files.
echo "env: `export`" >> /tmp/oh_port.txt
export HOME='/root' export LANG='de_BE.UTF-8' export LOGNAME='root' export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:[..]' export MAIL='/var/mail/root' export PATH='/sbin:/usr/sbin:/bin:/usr/bin' export PWD='/home/cwempe' export SHELL='/bin/bash' export SUDO_COMMAND='/etc/init.d/openhab2 stop' export SUDO_GID='1002' export SUDO_UID='1001' export SUDO_USER='cwempe' export TERM='xterm' export USER='root' export USERNAME='root'
export EXTRA_JAVA_OPTS='' export HOME='/root' export KARAF_BASE='/var/lib/openhab2' export KARAF_DATA='/var/lib/openhab2' export KARAF_ETC='/var/lib/openhab2/etc' export KARAF_HOME='/usr/share/openhab2/runtime' export KARAF_SCRIPT='stop' export LANG='de_BE.UTF-8' export LOGNAME='root' export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:[..]' export MAIL='/var/mail/root' export OPENHAB_CONF='/etc/openhab2' export OPENHAB_HOME='/usr/share/openhab2' export OPENHAB_LOGDIR='/var/log/openhab2' export OPENHAB_RUNTIME='/usr/share/openhab2/runtime' export OPENHAB_USERDATA='/var/lib/openhab2' export PATH='/sbin:/usr/sbin:/bin:/usr/bin' export PWD='/home/cwempe' export SHELL='/bin/bash' export SUDO_COMMAND='/etc/init.d/openhab2 stop' export SUDO_GID='1002' export SUDO_UID='1001' export SUDO_USER='cwempe' export TERM='xterm' export USER='openhab' export USERNAME='root'
Does this help?
I couldn’t get this to work, and so ended up changing the ports on my other application…