Search code examples
opc-uamilo

UnresolvedAdressException milo


Im trying to connect from an basic Milo-Client (ReadSample), but getting UnresolvedAdressException. Both Client and Server are in an remote Network and I only got Access to the Client. I'm pretty sure its not a Firewall since I can Connect with other Clients (Prosys OPC UA Client) and i can see that the ip is resolved to an Host-Name in the Logs:

Server is opc.tcp://192.168.115.40:49580 aka opc.tcp://Extern-Mess-Rec:49580 (tried both in UaTcpStackClient.getEndpoints(url).get();)

13:24:51.530 [main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework 13:24:51.546 [main] DEBUG io.netty.channel.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 8 13:24:51.561 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available 13:24:51.561 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available 13:24:51.561 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available 13:24:51.561 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: true 13:24:51.561 [main] DEBUG io.netty.util.internal.PlatformDependent - Platform: Windows 13:24:51.561 [main] DEBUG io.netty.util.internal.PlatformDependent - Java version: 8 13:24:51.561 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noUnsafe: false 13:24:51.561 [main] DEBUG io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available 13:24:51.561 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noJavassist: false 13:24:51.686 [main] DEBUG io.netty.util.internal.PlatformDependent - Javassist: available 13:24:51.686 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: C:\Users\SOFTWA~1\AppData\Local\Temp\3 (java.io.tmpdir) 13:24:51.686 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model) 13:24:51.686 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false 13:24:51.718 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false 13:24:51.718 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512 13:24:51.858 [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.level: simple 13:24:51.858 [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.maxRecords: 4 13:24:52.264 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 8 13:24:52.264 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 8 13:24:52.264 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192 13:24:52.264 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 11 13:24:52.264 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 16777216 13:24:52.264 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.tinyCacheSize: 512 13:24:52.264 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256 13:24:52.264 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64 13:24:52.264 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768 13:24:52.264 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192 13:24:52.296 [main] DEBUG io.netty.util.internal.ThreadLocalRandom - -Dio.netty.initialSeedUniquifier: 0x35f32988e43eab85 (took 10 ms) 13:24:52.327 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: unpooled 13:24:52.327 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 65536 13:24:52.327 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.maxThreadLocalCharBufferSize: 16384 13:24:52.358 [ua-netty-event-loop-0] DEBUG io.netty.util.internal.JavassistTypeParameterMatcherGenerator - Generated: io.netty.util.internal.matchers.org.eclipse.milo.opcua.stack.client.handlers.UaRequestFutureMatcher 13:24:52.389 [ua-netty-event-loop-0] DEBUG io.netty.buffer.AbstractByteBuf - -Dio.netty.buffer.bytebuf.checkAccessible: true 13:24:52.858 [ua-netty-event-loop-0] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxCapacity.default: 262144 13:24:52.890 [ua-netty-event-loop-0] DEBUG org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientAcknowledgeHandler - Sent Hello message on channel=[id: 0xa0ec7fec, L:/130.83.225.169:58872 - R:/192.168.115.40:49580]. 13:24:52.905 [ua-netty-event-loop-0] DEBUG org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientAcknowledgeHandler - Received Acknowledge message on channel=[id: 0xa0ec7fec, L:/130.83.225.169:58872 - R:/192.168.115.40:49580]. 13:24:52.921 [ua-netty-event-loop-0] DEBUG org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientMessageHandler - OpenSecureChannel timeout scheduled for +5s 13:24:52.967 [ua-netty-event-loop-0] DEBUG org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientMessageHandler - OpenSecureChannel timeout canceled 13:24:52.967 [ua-shared-pool-0] DEBUG org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientMessageHandler - Sent OpenSecureChannelRequest (Issue, id=0, currentToken=-1, previousToken=-1). 13:24:52.999 [ua-shared-pool-1] DEBUG org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientMessageHandler - Received OpenSecureChannelResponse. 13:24:52.999 [ua-shared-pool-1] DEBUG org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientMessageHandler - SecureChannel id=1140, currentTokenId=1, previousTokenId=-1, lifetime=3600000ms, createdAt=DateTime{utcTime=131384570808248472, javaDate=Fri May 05 13:24:40 CEST 2017} 13:24:52.999 [ua-netty-event-loop-0] DEBUG org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientMessageHandler - 0 message(s) queued before handshake completed; sending now. 13:24:52.999 [ForkJoinPool.commonPool-worker-1] DEBUG org.eclipse.milo.opcua.stack.client.ClientChannelManager - Channel bootstrap succeeded: localAddress=/130.83.225.169:58872, remoteAddress=/192.168.115.40:49580 13:24:53.061 [ForkJoinPool.commonPool-worker-1] DEBUG org.eclipse.milo.opcua.stack.client.ClientChannelManager - Sending CloseSecureChannelRequest... 13:24:53.061 [main] INFO org.eclipse.milo.examples.client.ClientExampleRunner - Using endpoint: opc.tcp://Extern-Mess-Rec:49580 [None] 13:24:53.077 [ua-netty-event-loop-0] DEBUG org.eclipse.milo.opcua.stack.client.ClientChannelManager - channelInactive(), disconnect complete 13:24:53.077 [ua-netty-event-loop-0] DEBUG org.eclipse.milo.opcua.stack.client.ClientChannelManager - disconnect complete, state set to Idle 13:24:53.124 [main] DEBUG org.eclipse.milo.opcua.sdk.client.OpcUaClient - Added ServiceFaultListener: org.eclipse.milo.opcua.sdk.client.ClientSessionManager$$Lambda$1049/664457955@58134517 13:24:53.171 [main] DEBUG org.eclipse.milo.opcua.sdk.client.OpcUaClient - Added SessionActivityListener: org.eclipse.milo.opcua.sdk.client.subscriptions.OpcUaSubscriptionManager$1@2d2e5f00 13:24:55.592 [ForkJoinPool.commonPool-worker-1] DEBUG org.eclipse.milo.opcua.stack.client.ClientChannelManager - Channel bootstrap failed: null java.nio.channels.UnresolvedAddressException: null at sun.nio.ch.Net.checkAddress(Net.java:101) at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:622) 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(Thread.java:745) 13:24:55.608 [main] ERROR org.eclipse.milo.examples.client.ClientExampleRunner - Error running client example: java.nio.channels.UnresolvedAddressException java.util.concurrent.ExecutionException: java.nio.channels.UnresolvedAddressException at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357) at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895) at org.eclipse.milo.examples.client.ReadExample.run(ReadExample.java:43) at org.eclipse.milo.examples.client.ClientExampleRunner.run(ClientExampleRunner.java:106) at org.eclipse.milo.examples.client.ReadExample.main(ReadExample.java:35) Caused by: java.nio.channels.UnresolvedAddressException: null at sun.nio.ch.Net.checkAddress(Net.java:101) at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:622) 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(Thread.java:745)


Solution

  • The server you're getting endpoints from is probably returning "Extern-Mess-Rec" as its hostname, which you can't resolve.

    See this answer for how to deal with that scenario.