hivemq / hivemq-edge

HiveMQ Edge is an MQTT gateway that enables interoperability between OT devices and IT systems. It translates diverse protocols into MQTT for streamlined communication and helps organize data into a unified namespace, making managing and streaming data across your infrastructure easier.
http://hivemq.com
Apache License 2.0
92 stars 21 forks source link

HiveMQ Edge JDK HttpServer Exception #285

Closed Isildur981 closed 3 months ago

Isildur981 commented 5 months ago

Expected behavior

HiveMQ Edge server starts normally.

Actual behavior

HiveMQ Edge servers starts with a JDK HttpServer ProcessingException error

To Reproduce

Unzip the downloaded HiveMQ Edge v2024.1 program to C:\hivemq on a Windows 10 computer. Download and install the OpenJDK11 JRE from https://adoptium.net/?variant=openjdk11. Right click on the run.bat file in the \bin directory and select "Run as administrator".

Steps

Reproducer code

Details

I suspect the web GUI server is trying to use a port that is already in use, but the port HiveMQ Edge is attempting to use isn't listed. I read through the wiki, and didn't see any configuration setting for how to set the web GUI port. The default web GUI port isn't documented anywhere in the wiki. I've included the error message displayed below.

2024-02-09 09:53:43,051 INFO - Started MQTT TCP Listener on address 0.0.0.0 and on port 1883 2024-02-09 09:53:44,188 ERROR - Uncaught Error: javax.ws.rs.ProcessingException: IOException thrown when creating the JDK HttpServer. at org.glassfish.jersey.jdkhttp.JdkHttpServerFactory.createHttpServer(JdkHttpServerFactory.java:232) at org.glassfish.jersey.jdkhttp.JdkHttpServerFactory.createHttpServer(JdkHttpServerFactory.java:176) at org.glassfish.jersey.jdkhttp.JdkHttpServerFactory.createHttpServer(JdkHttpServerFactory.java:84) at com.hivemq.http.JaxrsHttpServer.startServer(JaxrsHttpServer.java:136) at com.hivemq.HiveMQEdgeMain.startApiServer(HiveMQEdgeMain.java:205) at com.hivemq.HiveMQEdgeMain.startGateway(HiveMQEdgeMain.java:169) at com.hivemq.HiveMQEdgeMain.start(HiveMQEdgeMain.java:224) at com.hivemq.HiveMQEdgeMain.main(HiveMQEdgeMain.java:244) Caused by: java.net.BindException: Address already in use: bind at java.base/sun.nio.ch.Net.bind0(Native Method) at java.base/sun.nio.ch.Net.bind(Unknown Source) at java.base/sun.nio.ch.Net.bind(Unknown Source) at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source) at java.base/sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source) at jdk.httpserver/sun.net.httpserver.ServerImpl.(Unknown Source) at jdk.httpserver/sun.net.httpserver.HttpServerImpl.(Unknown Source) at jdk.httpserver/sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(Unknown Source) at jdk.httpserver/com.sun.net.httpserver.HttpServer.create(Unknown Source) at org.glassfish.jersey.jdkhttp.JdkHttpServerFactory.createHttpServer(JdkHttpServerFactory.java:229) ... 7 common frames omitted

simon622 commented 5 months ago

Thank you for the feedback. We will review.

DC2-DanielKrueger commented 3 months ago

Thx @Isildur981 for flagging this problem. My current thesis is that you have some service like a webserver binding on port 8080. This is also the port HiveMQ Edge is using for binding the web ui. I will look into this problem and surely we can provide a better error message than this stack trace.

Best regards, Daniel

DC2-DanielKrueger commented 3 months ago

Small addition: HiveMQ Edge API Documentation shows you the configuration of the port in case another service needs that port. The documentation moved to the website from the wiki. Hope this helps you.

Best Regards, Daniel