I’m running OH in docker, and I just upgraded from 3 to 4, and the web interface is longer coming up because of a port binding error.
In the logs I see the following:
2023-08-11 22:20:36.784 [INFO ] [lipse.jetty.server.AbstractConnector] - Started 0.0.0.0:8444@283e8eb9{SSL, (ssl, http/1.1)}{0.0.0.0:8444}
2023-08-11 22:20:36.805 [INFO ] [lipse.jetty.server.AbstractConnector] - Started default@722877c0{HTTP/1.1, (http/1.1, h2c)}{127.0.0.1:8087}
2023-08-11 22:20:36.817 [ERROR] [j.pax.web.service.internal.Activator] - Unable to start Pax Web server: Failed to bind to /127.0.0.1:8444
java.io.IOException: Failed to bind to /127.0.0.1:8444
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349) ~[?:?]
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310) ~[?:?]
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80) ~[?:?]
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234) ~[?:?]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[?:?]
at org.eclipse.jetty.server.Server.doStart(Server.java:401) ~[?:?]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[?:?]
at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper.start(JettyServerWrapper.java:623) ~[?:?]
at org.ops4j.pax.web.service.jetty.internal.JettyServerController.start(JettyServerController.java:109) ~[?:?]
at org.ops4j.pax.web.service.internal.Activator.performConfiguration(Activator.java:555) ~[?:?]
at org.ops4j.pax.web.service.internal.Activator.updateController(Activator.java:445) ~[?:?]
at org.ops4j.pax.web.service.internal.Activator.lambda$updateServerControllerFactory$1(Activator.java:347) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method) ~[?:?]
at sun.nio.ch.Net.bind(Net.java:555) ~[?:?]
at sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337) ~[?:?]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294) ~[?:?]
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:89) ~[?:?]
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344) ~[?:?]
There is nothing else using port 8444. When I stop the container, the port is free, and when I start the OH container I see java listening to the port. I even get the error if I change the port of OH to something else.
I’ve cleared the temp, cache and addons directories and I’ve restarted the container countless times.
No, I did not have more time to spend on debugging this and I reverted to the previous version.
I did see a clue in the logs once I reverted, but I’ve not spend any time looking at it since I got OH3 running again. When running OH3, there was a warning from jetty related to the certificate. I’m speculating that OH3 is not starting the TLS connector for jetty, but for some reason OH4 is starting it. I don’t know what the fix would be, or what actually should listen to that port, though.
Looking into the xml file according to my understanding port 8443 is the default port to be used for jetty and pax.
So I am wondering why in first post port 8444 is being used. Did you change anything to use that port ?
I change the default port. I use docker, and pass in OPENHAB_HTTP_PORT=8087 and OPENHAB_HTTPS_PORT=8444 to change the ports. Both the jetty and pax port change when I do that.
Looking into the xml file according to my understanding port 8443 is the default port to be used for jetty and pax.
I don’t know enough about the architecture of the container to understand what should be binding to the port. From your properties, it looks like pax is delegating to jetty.
When I start the container, something in the container is binding to that port before jetty gets a chance to bind. It does not matter if I change the default port or not.
Are you also using docker by chance? I’m just wondering if this is a problem with the docker image, or if it’s something in the userdata directory.
No I don’t use docker.
Wouldn’t it be a good test to use the standard ports instead of changing them ? In case it works with default ports but does not work when ports are changed then this is a problem related to changing the ports and it would be required to further look into what went wrong ?