我正在尝试使用netty来消耗tcp套接字中的字节。我正在使用Apache Camel 2.12.1,Spring DSL和Windows。我的路线非常简单:
<camelContext xmlns="http://camel.apache.org/schema/spring" autoStartup="true">
<route id="my-route">
<from uri="netty:tcp://127.0.0.1:4102?sync=true&textline=true" />
<convertBodyTo type="java.lang.String" />
<to uri="file:./data" />
</route>
</camelContext>
我在启动路线时遇到此异常:
2013-11-15 19:33:23,749 ERROR [Thread-5] - org.jboss.netty.channel.ChannelException: Failed to create a selector.
org.apache.camel.RuntimeCamelException: org.jboss.netty.channel.ChannelException: Failed to create a selector.
at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1344) ~[camel-core-2.12.1.jar:2.12.1]
at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:120) ~[camel-spring-2.12.1.jar:2.12.1]
at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:301) ~[camel-spring-2.12.1.jar:2.12.1]
...
at java.lang.Thread.run(Thread.java:724) [?:1.7.0_40]
Caused by: org.jboss.netty.channel.ChannelException: Failed to create a selector.
at org.jboss.netty.channel.socket.nio.AbstractNioSelector.openSelector(AbstractNioSelector.java:337) ~[netty-3.7.0.Final.jar:?]
at org.jboss.netty.channel.socket.nio.AbstractNioSelector.<init>(AbstractNioSelector.java:95) ~[netty-3.7.0.Final.jar:?]
at org.jboss.netty.channel.socket.nio.NioServerBoss.<init>(NioServerBoss.java:49) ~[netty-3.7.0.Final.jar:?]
at org.jboss.netty.channel.socket.nio.NioServerBossPool.newBoss(NioServerBossPool.java:55) ~[netty-3.7.0.Final.jar:?]
at org.jboss.netty.channel.socket.nio.NioServerBossPool.newBoss(NioServerBossPool.java:26) ~[netty-3.7.0.Final.jar:?]
at org.jboss.netty.channel.socket.nio.AbstractNioBossPool.init(AbstractNioBossPool.java:65) ~[netty-3.7.0.Final.jar:?]
at org.jboss.netty.channel.socket.nio.NioServerBossPool.<init>(NioServerBossPool.java:40) ~[netty-3.7.0.Final.jar:?]
at org.apache.camel.component.netty.NettyServerBossPoolBuilder.build(NettyServerBossPoolBuilder.java:65) ~[camel-netty-2.12.1.jar:2.12.1]
at org.apache.camel.component.netty.SingleTCPNettyServerBootstrapFactory.startServerBootstrap(SingleTCPNettyServerBootstrapFactory.java:132) ~[camel-netty-2.12.1.jar:2.12.1]
at org.apache.camel.component.netty.SingleTCPNettyServerBootstrapFactory.doStart(SingleTCPNettyServerBootstrapFactory.java:93) ~[camel-netty-2.12.1.jar:2.12.1]
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) ~[camel-core-2.12.1.jar:2.12.1]
... 100 more
Caused by: java.lang.NoSuchMethodError: org.jboss.netty.channel.socket.nio.SelectorUtil.open()Ljava/nio/channels/Selector;
at org.jboss.netty.channel.socket.nio.AbstractNioSelector.openSelector(AbstractNioSelector.java:335) ~[netty-3.7.0.Final.jar:?]
at org.jboss.netty.channel.socket.nio.AbstractNioSelector.<init>(AbstractNioSelector.java:95) ~[netty-3.7.0.Final.jar:?]
at org.jboss.netty.channel.socket.nio.NioServerBoss.<init>(NioServerBoss.java:49) ~[netty-3.7.0.Final.jar:?]
at org.jboss.netty.channel.socket.nio.NioServerBossPool.newBoss(NioServerBossPool.java:55) ~[netty-3.7.0.Final.jar:?]
at org.jboss.netty.channel.socket.nio.NioServerBossPool.newBoss(NioServerBossPool.java:26) ~[netty-3.7.0.Final.jar:?]
at org.jboss.netty.channel.socket.nio.AbstractNioBossPool.init(AbstractNioBossPool.java:65) ~[netty-3.7.0.Final.jar:?]
at org.jboss.netty.channel.socket.nio.NioServerBossPool.<init>(NioServerBossPool.java:40) ~[netty-3.7.0.Final.jar:?]
at org.apache.camel.component.netty.NettyServerBossPoolBuilder.build(NettyServerBossPoolBuilder.java:65) ~[camel-netty-2.12.1.jar:2.12.1]
at org.apache.camel.component.netty.SingleTCPNettyServerBootstrapFactory.startServerBootstrap(SingleTCPNettyServerBootstrapFactory.java:132) ~[camel-netty-2.12.1.jar:2.12.1]
at org.apache.camel.component.netty.SingleTCPNettyServerBootstrapFactory.doStart(SingleTCPNettyServerBootstrapFactory.java:93) ~[camel-netty-2.12.1.jar:2.12.1]
... 20 more
任何有关它的想法都没有开始?谢谢!
答案 0 :(得分:1)
NoSuchMethodError
通常是由于CLASSPATH
上有一个不兼容的jar(太旧或太新)造成的。
(我偶尔发现免费的JBoss Tattletale可用于识别我CLASSPATH
上遗留的旧的重复类或副本的副本。但是,重复可能不是这里的问题。)