Milo:连接到(公共)OPC-UA服务器

问题描述:

首先:我是OPCUA的新手。 :)Milo:连接到(公共)OPC-UA服务器

我试图连接一个米洛客户端到我们的服务器,但不真正明白什么是错的。样本客户机和服务器工作正常起来,但是当我尝试到客户端样本与公众OPC-UA-测试的服务器的一个连接,我得到的那些异常:

15:48:34.729 [UA-网状-event-loop-0] DEBUG org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientAcknowledgeHandler - 在通道= [id:0xc22800c2,L:/10.22.19.217:58947 - R:opcua]上发送了Hello消息。 demo-this.com/52.233.134.134:51210。 15:48:34.729警告io.netty.channel.DefaultChannelPipeline - 一个exceptionCaught()事件被触发,它到达管道的尾部 。它通常意味着流水线中的最后一个处理程序确实不会处理异常,例如 。 java.io.IOException:现有连接 被远程主机强制关闭了 sun.nio.ch.SocketDispatcher.read0(Native Method) sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)在 sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)at sun.nio.ch.IOUtil.read(IOUtil.java:192)at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl。的java:380)在 io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:221) 在 io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:898) 在 io.netty.channel。 socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:242) 在 io.netty.channel.nio.AbstractNioByteChannel $ NioByteUnsafe.read(AbstractNioByteChannel.java:119) 在 io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528) 在 io.netty。 channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:485) 在 io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:399) 在io.netty.channel.nio.NioEventLoop.run(NioEventLoop .java:371)at io.netty.util.concurrent.SingleThreadEventExecutor $ 2.run(SingleThreadEventExecutor.java:112) at java.lang.Thread.run(Thread.java:745)15:48:39.612 [ForkJoinPool .commonPool-worker-1]调试 org.ecl ipse.milo.opcua.stack.client.ClientChannelManager - 频道 引导失败:超时等待确认 org.eclipse.milo.opcua.stack.core.UaException:超时等待 确认在 org.eclipse.milo .opcua.stack.client.handlers.UaTcpClientAcknowledgeHandler.lambda $ startHelloTimeout $ 4(UaTcpClientAcknowledgeHandler.java:156) at org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientAcknowledgeHandler $$ Lambda $ 27/469017260.run(未知 源)在 io.netty.util.HashedWheelTimer $ HashedWheelTimeout.expire(HashedWheelTimer.java:581) 在 io.netty.util.HashedWheelTimer $ HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:655) 在 io.netty.util.HashedWheelTimer $ Worker.run(HashedWheelTimer.java:367) 在java.lang.Thread.run(Thread.java:745)15:48:39.613 [主要] ERROR org.eclipse.milo例如:UaException:status = Bad_Timeout,message =超时等待 确认java.util.concurrent.ExecutionException:UaException: status = Bad_Timeout,message =超时等待确认 java的。util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357) 在 java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1887) 在 org.eclipse.milo.examples.client.ClientExampleRunner.createClient( ClientExampleRunner.java:56) 在 org.eclipse.milo.examples.client.ClientExampleRunner.run(ClientExampleRunner.java:103) 在 org.eclipse.milo.examples.client.BrowseExample.main(BrowseExample.java: 40)引起 :org.eclipse.milo.opcua.stack.core.UaException:超时 在 org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientAcknowledgeHandler.lambda $ startHelloTimeout $ 4等待确认(UaTcpClientAcknowledgeHandler的.java :156) 在 org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientAcknowledgeHandler $$ LAMBDA $ 27日/ 469017260.run(未知 来源)在 io.netty.util.HashedWheelTimer $ HashedWheelTimeout.expire(HashedWheelTimer。 Java的:581) 在 io.netty.util.HashedWheelTimer $ HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:655) 在 io.netty.util.HashedWheelTimer $ Worker.run(HashedWheelTimer.java:367) 是java。 lang.Thread.run(Thread.java:745)15:48:42.842 [threadDeathWatcher-2-1] DEBUG io.netty.buffer.PoolThreadCache - Freed 2个线程本地缓冲区(s)来自线程:ua-netty -event-loop-0

我拿着样品代码并删除了证书/密钥对,改变了网址opc.tcp://opcua.demo-this.com:51210/UA/SampleServer,因为公共服务器不需要授权:

SecurityPolicy securityPolicy = clientExample.getSecurityPolicy(); 
EndpointDescription[] endpoints = UaTcpStackClient.getEndpoints("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer").get(); 

EndpointDescription endpoint = Arrays.stream(endpoints) 
    .filter(e -> e.getSecurityPolicyUri().equals(securityPolicy.getSecurityPolicyUri())) 
    .findFirst().orElseThrow(() -> new Exception("no desired endpoints returned")); 

logger.info("Using endpoint: {} [{}]", endpoint.getEndpointUrl(), securityPolicy); 

loader.load(); 

OpcUaClientConfig config = OpcUaClientConfig.builder() 
    .setApplicationName(LocalizedText.english("eclipse milo opc-ua client")) 
    .setApplicationUri("urn:eclipse:milo:examples:client") 
    //.setCertificate(loader.getClientCertificate()) 
    //.setKeyPair(loader.getClientKeyPair()) 
    .setEndpoint(endpoint) 
    .setIdentityProvider(clientExample.getIdentityProvider()) 
    .setRequestTimeout(uint(5000)) 
    .build(); 

return new OpcUaClient(config); 

我缺少什么?

的问候和感谢提前:)

在堆栈跟踪埋是真正的问题:UaException: timed out waiting for acknowledge

也许您的防火墙或网络设置阻止了它,或者服务器没有发回它,但问题是客户端从未收到Acknowledge消息以响应其Hello

FWIW,我可以运行ReadExample针对该公共服务器没有问题。在ReadExample我覆盖getSecurityPolicy()并返回SecurityPolicy.None和在ClientExampleRunner刚刚取代了端点URL。

+0

好的,所以防火墙似乎是问题所在。虽然我不明白为什么,因为我可以连接到其他客户端的样本服务器(使用Integration Objects和Prosys OPC UA客户端进行测试) – lukas