HIVE MQ OPC UA Connection Codesys

Hi,

I am trying to connect a PLC to the hivemq edge through OPC UA adapter. My PLC data and tags is accessible through the UAexpert software. and when configured in the Hivemq edge it is showing below error. I am getting unkown host exception. I am running teh hivemq edge in windows computer.

2025-01-27 13:39:41,337 ERROR - Not able to connect and subscribe to OPC UA server opc.tcp://192.168.24.6:4840 java.util.concurrent.CompletionException: java.net.UnknownHostException: No such host is known (Compact) at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331) at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:346) at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:632) at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506) at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2094) at org.eclipse.milo.opcua.stack.client.transport.uasc.ClientChannelFsm$ClientChannelActions.lambda$connect$0(ClientChannelFsm.java:131) at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590) at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:557) at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492) at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636) at io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:629) at io.netty.util.concurrent.DefaultPromise.setFailure(DefaultPromise.java:110) at io.netty.channel.DefaultChannelPromise.setFailure(DefaultChannelPromise.java:89) at io.netty.bootstrap.Bootstrap.doResolveAndConnect0(Bootstrap.java:228) at io.netty.bootstrap.Bootstrap.access$000(Bootstrap.java:47) at io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:189) at io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:175) at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590) at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:557) at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492) at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636) at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:625) at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:105) at io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:84) at io.netty.channel.AbstractChannel$AbstractUnsafe.safeSetSuccess(AbstractChannel.java:988) at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:515) at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:428) at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:485) at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at java.base/java.lang.Thread.run(Thread.java:829)

Below is my config file
…


1885
0.0.0.0


…
…


OPC-UA
opcua

opc.tcp://192.168.24.6:4840
false

false


1000
1


NONE







…

Hi Kalyan,

Welcome to the community! :tada:

The error you’re encountering, UnknownHostException: No such host is known, typically means that the system is unable to resolve the specified IP address or hostname. In your case, HiveMQ Edge seems to have trouble connecting to the OPC UA server at opc.tcp://192.168.24.6:4840. This could be due to network connectivity issues, incorrect IP address, or firewall settings blocking the connection.

To troubleshoot the issue, you can test the connection between your HiveMQ Edge instance and the PLC using PowerShell’s Test-NetConnection cmdlet.

Here’s how you can do that:

  1. Open PowerShell on the machine running HiveMQ Edge.
  2. Type the following command to test the connection to the PLC:
    Test-NetConnection -ComputerName 192.168.24.6 -Port 4840
    
  3. What to expect:
    • If the result shows TcpTestSucceeded: True, it means the connection to the PLC is successful and the port is open.
    • If it shows TcpTestSucceeded: False, the connection failed, indicating possible issues like a firewall block, incorrect IP address, or network misconfiguration.

If the connection test fails, here are a few things you can check:

  • Ensure the PLC is reachable on the network.
  • Check both the Windows firewall and the PLC’s firewall to ensure port 4840 is open.
  • Double-check the IP address (192.168.24.6) for accuracy.

Feel free to share the result of the connection test if you need further assistance, and we’ll be happy to help you troubleshoot!

Best regards,
Dasha from The HiveMQ Team

1 Like

Hi Dasha,

Thanks for the swift response. I have checked now and found that it was the firewall which caused the issue. Now it is working fine.

I am just starting out on hivemq edge. I have another query that in the hivemq edge workspace if i click on the hivemq broker overview panel i am getting “An Unexpected error has occured - no root”.

Whether can you able to comment on this.

Best Regards,
Kalyan

Hi Kalyan,

I appreciate you bringing this to my attention. What you are describing does not seem expected. If the issue is reproducible, please create a Bug Report at HiveMQ Edge GitHub Issues.

In the report, include details such as the HiveMQ Edge version, JDK version, and OS version. Additionally, archiving your hivemq-edge directory and attaching it to the ticket as an evidence will allow the engineers to extract it, run it, and quickly reproduce the issue. Please also describe the steps to reproduce the error, and if possible, attach a short video showing what actions you take in the HiveMQ Edge UI leading to the error.

Let me know if you need any further clarification.

Best regards,
Dasha from The HiveMQ Team