连接到远程OPCUA服务器时出现问题

时间:2019-02-20 03:05:27

标签: opc-ua milo

我是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)

1 个答案:

答案 0 :(得分:0)

UnresolvedAddressException表示您用来调用GetEndpoints的URL或您选择连接的端点内的URL具有您的计算机无法解析的主机名。

如果端点中的URL与您用于原始呼叫的URL不匹配,并且不能正确配置有问题的服务器,则可以使用EndpointUtil将EndpointDescription中的主机名替换为另一个一个,在本例中为您用于发现的原始主机名。