Eclipse Milo OPCUA客户端在等待安全通道时超时

Eclipse Milo OPCUA客户端在等待安全通道时超时,eclipse,apache,apache-nifi,opc-ua,milo,Eclipse,Apache,Apache Nifi,Opc Ua,Milo,我正在为ApacheNIFI开发一个服务,它应该能够订阅OPCUA服务器上的一些变量。我无法使服务连接到OPCUA服务器。这是stacktrace: java.util.concurrent.ExecutionException: UaException: status=Bad_Timeout, message=timed out waiting for secure channel at java.util.concurrent.CompletableFuture.reportGet(Comp

我正在为ApacheNIFI开发一个服务,它应该能够订阅OPCUA服务器上的一些变量。我无法使服务连接到OPCUA服务器。这是stacktrace:

java.util.concurrent.ExecutionException: UaException: status=Bad_Timeout, message=timed out waiting for secure channel
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
at com.hashmapinc.tempus.processors.StandardMiloOPCUAService.createClient(StandardMiloOPCUAService.java:75)
at com.hashmapinc.tempus.processors.StandardMiloOPCUAService.onEnabled(StandardMiloOPCUAService.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:137)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:125)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:70)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotation(ReflectionUtils.java:47)
at org.apache.nifi.controller.service.StandardControllerServiceNode$2.run(StandardControllerServiceNode.java:400)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.eclipse.milo.opcua.stack.core.UaException: timed out waiting for secure channel
at org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientMessageHandler.lambda$handlerAdded$2(UaTcpClientMessageHandler.java:151)
at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:581)
at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:655)
at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:367)
... 1 common frames omitted
因此,它在等待安全通道时超时。当我向服务提供一些伪造的IP地址时,它只是说连接超时了

这是我用来创建客户端的代码:

private OpcUaClient createClient() throws Exception {
    EndpointDescription[] endpoints;
    endpoints = UaTcpStackClient
            .getEndpoints("opc.tcp://theaddress:49320")
            .get();
    EndpointDescription endpoint = endpoints[0];
    OpcUaClientConfig config = OpcUaClientConfig.builder()
            .setApplicationName(LocalizedText.english("MinimalClient"))
            .setApplicationUri("urn:theurn")
            .setCertificate(null)
            .setKeyPair(null)
            .setEndpoint(endpoint)
            .setMaxResponseMessageSize(uint(50000))
            .setIdentityProvider(new AnonymousProvider())
            .setRequestTimeout(uint(5000))
            .build();
    return new OpcUaClient(config);
}

这可能是防火墙问题吗?它是否连接到服务器,然后无法获得安全通道?仅供参考:服务器允许匿名身份,并且具有安全策略:无。

为什么从列表中选择第一个端点?列表中有多少个端点?为什么不创建EndPointDescription,而是使用UaTcpStackClient.getEndPoints?这个工作正常吗?听起来确实像是防火墙问题-Wireshark捕获会有所帮助。我在github上打开了一个问题,并提供了一些附加信息:。