骆驼 Netty4 udp 多播无法在 windows 上工作
Camel Netty4 udp Multicast not working on windows
我一直在尝试让 Camel Netty4 udp 多播在 windows 上工作,而 NettyUDPMulticastAsyncTest 似乎因 java.nio.channels.ClosedChannelException 而失败。
相同的测试似乎正在 OSX 上进行。两台机器都是 运行ning Java 1.7
我已经更新了测试中的接口名称,并且我能够在同一接口上 运行 NIO UDP 多播示例。
我正在使用 Camel 2.14.1,但它似乎无法在 2.15.x 上运行。
堆栈跟踪如下。
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.026 sec <<< FAILURE! - in org.apache.camel.component.netty4.NettyUDPMulticastAsyncTest
testUDPInOnlyMulticastWithNettyConsumer(org.apache.camel.component.netty4.NettyUDPMulticastAsyncTest) Time elapsed: 0.023 sec <<< ERROR!
java.nio.channels.ClosedChannelException: null
at sun.nio.ch.DatagramChannelImpl.innerJoin(DatagramChannelImpl.java:832)
at sun.nio.ch.DatagramChannelImpl.join(DatagramChannelImpl.java:894)
at io.netty.channel.socket.nio.NioDatagramChannel.joinGroup(NioDatagramChannel.java:409)
at io.netty.channel.socket.nio.NioDatagramChannel.joinGroup(NioDatagramChannel.java:382)
at io.netty.channel.socket.nio.NioDatagramChannel.joinGroup(NioDatagramChannel.java:375)
at org.apache.camel.component.netty4.SingleUDPNettyServerBootstrapFactory.startServerBootstrap(SingleUDPNettyServerBootstrapFactory.java:177)
at org.apache.camel.component.netty4.SingleUDPNettyServerBootstrapFactory.doStart(SingleUDPNettyServerBootstrapFactory.java:97)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)
at org.apache.camel.component.netty4.NettyConsumer.doStart(NettyConsumer.java:69)
发现问题出在加入组之前绑定到多播地址,由于某种原因在 windows 上不起作用。必须在 SingleUDPNettyServerBootstrapFactory
中将 bootstrap.bind 更新为如下所示
ChannelFuture channelFuture = bootstrap.bind(new InetSocketAddress(configuration.getPort()));
我一直在尝试让 Camel Netty4 udp 多播在 windows 上工作,而 NettyUDPMulticastAsyncTest 似乎因 java.nio.channels.ClosedChannelException 而失败。 相同的测试似乎正在 OSX 上进行。两台机器都是 运行ning Java 1.7 我已经更新了测试中的接口名称,并且我能够在同一接口上 运行 NIO UDP 多播示例。 我正在使用 Camel 2.14.1,但它似乎无法在 2.15.x 上运行。
堆栈跟踪如下。
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.026 sec <<< FAILURE! - in org.apache.camel.component.netty4.NettyUDPMulticastAsyncTest
testUDPInOnlyMulticastWithNettyConsumer(org.apache.camel.component.netty4.NettyUDPMulticastAsyncTest) Time elapsed: 0.023 sec <<< ERROR!
java.nio.channels.ClosedChannelException: null
at sun.nio.ch.DatagramChannelImpl.innerJoin(DatagramChannelImpl.java:832)
at sun.nio.ch.DatagramChannelImpl.join(DatagramChannelImpl.java:894)
at io.netty.channel.socket.nio.NioDatagramChannel.joinGroup(NioDatagramChannel.java:409)
at io.netty.channel.socket.nio.NioDatagramChannel.joinGroup(NioDatagramChannel.java:382)
at io.netty.channel.socket.nio.NioDatagramChannel.joinGroup(NioDatagramChannel.java:375)
at org.apache.camel.component.netty4.SingleUDPNettyServerBootstrapFactory.startServerBootstrap(SingleUDPNettyServerBootstrapFactory.java:177)
at org.apache.camel.component.netty4.SingleUDPNettyServerBootstrapFactory.doStart(SingleUDPNettyServerBootstrapFactory.java:97)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)
at org.apache.camel.component.netty4.NettyConsumer.doStart(NettyConsumer.java:69)
发现问题出在加入组之前绑定到多播地址,由于某种原因在 windows 上不起作用。必须在 SingleUDPNettyServerBootstrapFactory
中将 bootstrap.bind 更新为如下所示ChannelFuture channelFuture = bootstrap.bind(new InetSocketAddress(configuration.getPort()));