1

我是opcua的新手。我已经尝试了https://dentrassi.de/2017/09/14/creating-opc-ua-solutions-eclipse-milo/中的示例,并设法连接到本地 OPCUA 服务器,但不是远程服务器。

错误如下图:

Exception in thread "main" java.util.concurrent.ExecutionException: java.nio.channels.UnresolvedAddressException
    at java.util.concurrent.CompletableFuture.reportGet(Unknown Source)
    at java.util.concurrent.CompletableFuture.get(Unknown Source)
    at com.programcreek.helloworld.test2.main(test2.java:101)
Caused by: java.nio.channels.UnresolvedAddressException
    at sun.nio.ch.Net.checkAddress(Unknown Source)
    at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
    at io.netty.channel.socket.nio.NioSocketChannel.doConnect(NioSocketChannel.java:209)
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:207)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1279)
    at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:453)
    at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:439)
    at io.netty.channel.ChannelDuplexHandler.connect(ChannelDuplexHandler.java:50)
    at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:453)
    at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:439)
    at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:421)
    at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:1024)
    at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:203)
    at io.netty.bootstrap.Bootstrap$2.run(Bootstrap.java:167)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:374)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
    at java.lang.Thread.run(Unknown Source)
4

1 回答 1

2

UnresolvedAddressException意味着您用于调用 GetEndpoints 的 URL 或您选择连接的端点内的 URL 具有您的机器无法解析的主机名。

如果端点中的 URL 与您用于原始调用的 URL 不匹配,并且无法正确配置相关服务器,您可以使用EndpointUtil将 EndpointDescription中的主机名替换为另一个,在这种情况下为原始您用于发现的主机名。

于 2019-02-20T03:16:03.817 回答