Thanks Claus! I wasn't aware of the *-starter packages for Camel. Much
appreciated for the pointer.
Moving to the 'camel-ahc-ws-starter' package and adjusting all other camel*
packages I now get a different exception.
Any help/pointers are appreciated. Thanks
java.util.concurrent.ExecutionException: java.lang.IllegalStateException:
Invalid Status Code 404
at
org.asynchttpclient.netty.NettyResponseFuture.done(NettyResponseFuture.java:228)
~[async-http-client-2.0.15.jar:na]
at
org.asynchttpclient.netty.handler.WebSocketHandler$UpgradeCallback.call(WebSocketHandler.java:100)
~[async-http-client-2.0.15.jar:na]
at
org.asynchttpclient.netty.handler.AsyncHttpClientHandler.channelRead(AsyncHttpClientHandler.java:73)
~[async-http-client-2.0.15.jar:na]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
~[netty-transport-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
~[netty-transport-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
~[netty-transport-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:435)
~[netty-transport-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)
~[netty-codec-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)
~[netty-codec-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:250)
~[netty-transport-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
~[netty-transport-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
~[netty-transport-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
~[netty-transport-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294)
~[netty-transport-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
~[netty-transport-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
~[netty-transport-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911)
~[netty-transport-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
~[netty-transport-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:611)
~[netty-transport-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:552)
~[netty-transport-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:466)
~[netty-transport-4.0.41.Final.jar:4.0.41.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438)
~[netty-transport-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)
~[netty-common-4.0.41.Final.jar:4.0.41.Final]
at
io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
~[netty-common-4.0.41.Final.jar:4.0.41.Final]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_91]
Caused by: java.lang.IllegalStateException: Invalid Status Code 404
at
org.asynchttpclient.ws.WebSocketUpgradeHandler.onCompleted(WebSocketUpgradeHandler.java:81)
~[async-http-client-2.0.15.jar:na]
at
org.asynchttpclient.ws.WebSocketUpgradeHandler.onCompleted(WebSocketUpgradeHandler.java:29)
~[async-http-client-2.0.15.jar:na]
at
org.asynchttpclient.netty.NettyResponseFuture.getContent(NettyResponseFuture.java:188)
~[async-http-client-2.0.15.jar:na]
at
org.asynchttpclient.netty.NettyResponseFuture.done(NettyResponseFuture.java:223)
~[async-http-client-2.0.15.jar:na]
... 24 common frames omitted
-----Original Message-----
From: Claus Ibsen [mailto:[email protected]]
Sent: Friday, October 28, 2016 3:20 AM
To: [email protected]
Subject: Re: Camel-ahc-ws netty runtime problems
When using Spring Boot and Camel 2.18 onwards you should use the -starter
components, eg camel-ahc-ws-starter and so on.
On Tue, Oct 25, 2016 at 8:21 PM, Ingram, Stuart <[email protected]> wrote:
> Using the following dependencies
>
> compile('org.apache.camel:camel-jackson:2.18.0')
> compile('org.apache.camel:camel-metrics:2.18.0')
> compile('org.apache.camel:camel-spring-boot-starter:2.18.0')
> compile('org.apache.camel:camel-spring-redis:2.18.0')
> compile('org.apache.camel:camel-stream:2.18.0')
> compile('org.apache.camel:camel-ahc-ws:2.18.0')
> compile('org.springframework.boot:spring-boot-actuator')
> compile("org.springframework.boot:spring-boot-starter-web")
>
> And the following ahc-ws definition in Spring Boot
>
> .........
> .multicast()
> .parallelProcessing()
>
> .pipeline()
> .marshal().json(JsonLibrary.Jackson)
> .convertBodyTo(String.class) // Avoids string serialization issues
> in websocket component.
> .to("ahc-ws://localhost:8080/votes?sendToAll=true")
> .end()
> .........
>
> At runtime I get the following error when publishing to this sink
>
> 2016-10-25 11:41:45.689 INFO 1864 --- [ #7 - Multicast]
> o.a.camel.component.ahc.ws.WsEndpoint : Reconnecting websocket:
> ws://localhost:8080/votes?sendToAll=true
> 2016-10-25 11:41:45.777 ERROR 1864 --- [ #7 - Multicast]
> o.a.camel.processor.DefaultErrorHandler : Failed delivery for
> (MessageId: ID-singram-mint172-42019-1477410101007-0-56 on ExchangeId:
> ID-singram-mint172-42019-1477410101007-0-59). Exhausted after delivery
> attempt: 1 caught: java.util.concurrent.ExecutionException:
> java.net.ConnectException:
> io.netty.channel.DefaultChannelId.newInstance()Lio/netty/channel/Defau
> ltChannelId;
>
> java.util.concurrent.ExecutionException: java.net.ConnectException:
> io.netty.channel.DefaultChannelId.newInstance()Lio/netty/channel/DefaultChannelId;
> at
> org.asynchttpclient.netty.NettyResponseFuture.abort(NettyResponseFuture.java:239)
> ~[async-http-client-2.0.15.jar:na]
> at
> org.asynchttpclient.netty.channel.NettyConnectListener.onFailure(NettyConnectListener.java:162)
> ~[async-http-client-2.0.15.jar:na]
> at
> org.asynchttpclient.netty.request.NettyChannelConnector$1.onFailure(NettyChannelConnector.java:103)
> ~[async-http-client-2.0.15.jar:na]
> at
> org.asynchttpclient.netty.SimpleChannelFutureListener.operationComplete(SimpleChannelFutureListener.java:28)
> ~[async-http-client-2.0.15.jar:na]
> at
> org.asynchttpclient.netty.SimpleChannelFutureListener.operationComplete(SimpleChannelFutureListener.java:20)
> ~[async-http-client-2.0.15.jar:na]
> at
> io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:514)
> ~[netty-all-4.1.5.Final.jar:4.1.5.Final]
> at
> io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:488)
> ~[netty-all-4.1.5.Final.jar:4.1.5.Final]
> at
> io.netty.util.concurrent.DefaultPromise.access$000(DefaultPromise.java:34)
> ~[netty-all-4.1.5.Final.jar:4.1.5.Final]
> at
> io.netty.util.concurrent.DefaultPromise$1.run(DefaultPromise.java:438)
> ~[netty-all-4.1.5.Final.jar:4.1.5.Final]
> at
> io.netty.util.concurrent.GlobalEventExecutor$TaskRunner.run(GlobalEventExecutor.java:233)
> ~[netty-all-4.1.5.Final.jar:4.1.5.Final]
> at
> io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
> ~[netty-all-4.1.5.Final.jar:4.1.5.Final]
> at java.lang.Thread.run(Thread.java:745) [na:1.8.0_91] Caused
> by: java.net.ConnectException:
> io.netty.channel.DefaultChannelId.newInstance()Lio/netty/channel/DefaultChannelId;
> at
> org.asynchttpclient.netty.channel.NettyConnectListener.onFailure(NettyConnectListener.java:160)
> ~[async-http-client-2.0.15.jar:na]
> ... 10 common frames omitted
> Caused by: java.lang.NoSuchMethodError:
> io.netty.channel.DefaultChannelId.newInstance()Lio/netty/channel/DefaultChannelId;
> at io.netty.channel.AbstractChannel.newId(AbstractChannel.java:107)
> ~[netty-all-4.1.5.Final.jar:4.1.5.Final]
> at io.netty.channel.AbstractChannel.<init>(AbstractChannel.java:79)
> ~[netty-all-4.1.5.Final.jar:4.1.5.Final]
> at
> io.netty.channel.nio.AbstractNioChannel.<init>(AbstractNioChannel.java:84)
> ~[netty-all-4.1.5.Final.jar:4.1.5.Final]
> at
> io.netty.channel.nio.AbstractNioByteChannel.<init>(AbstractNioByteChannel.java:54)
> ~[netty-all-4.1.5.Final.jar:4.1.5.Final]
> at
> io.netty.channel.socket.nio.NioSocketChannel.<init>(NioSocketChannel.java:98)
> ~[netty-all-4.1.5.Final.jar:4.1.5.Final]
> at
> io.netty.channel.socket.nio.NioSocketChannel.<init>(NioSocketChannel.java:88)
> ~[netty-all-4.1.5.Final.jar:4.1.5.Final]
> at
> io.netty.channel.socket.nio.NioSocketChannel.<init>(NioSocketChannel.java:81)
> ~[netty-all-4.1.5.Final.jar:4.1.5.Final]
> at
> io.netty.channel.socket.nio.NioSocketChannel.<init>(NioSocketChannel.java:74)
> ~[netty-all-4.1.5.Final.jar:4.1.5.Final]
> at
> org.asynchttpclient.netty.channel.NioSocketChannelFactory.newChannel(NioSocketChannelFactory.java:25)
> ~[async-http-client-2.0.15.jar:na]
> at
> org.asynchttpclient.netty.channel.NioSocketChannelFactory.newChannel(NioSocketChannelFactory.java:19)
> ~[async-http-client-2.0.15.jar:na]
> at
> io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:319)
> ~[netty-all-4.1.5.Final.jar:4.1.5.Final]
> at
> io.netty.bootstrap.Bootstrap.doResolveAndConnect(Bootstrap.java:163)
> ~[netty-all-4.1.5.Final.jar:4.1.5.Final]
> at io.netty.bootstrap.Bootstrap.connect(Bootstrap.java:156)
> ~[netty-all-4.1.5.Final.jar:4.1.5.Final]
>
> Any thoughts on what's going on/missing?
>
> I did notice that the dependency tree is a little odd in that netty-all (see
> bottom) is 4.1.5 and all other netty dependencies are 4.0.41. This was
> generated with 'gradle dependencies'
>
> +--- org.apache.camel:camel-ahc-ws:2.18.0
> | +--- org.apache.camel:camel-core:2.18.0 (*)
> | \--- org.apache.camel:camel-ahc:2.18.0
> | +--- org.apache.camel:camel-core:2.18.0 (*)
> | +--- org.asynchttpclient:async-http-client:2.0.15
> | | +--- org.asynchttpclient:async-http-client-netty-utils:2.0.15
> | | | +--- io.netty:netty-buffer:4.0.41.Final
> | | | | \--- io.netty:netty-common:4.0.41.Final
> | | | \--- org.slf4j:slf4j-api:1.7.21
> | | +--- io.netty:netty-codec-http:4.0.41.Final
> | | | +--- io.netty:netty-codec:4.0.41.Final
> | | | | \--- io.netty:netty-transport:4.0.41.Final
> | | | | \--- io.netty:netty-buffer:4.0.41.Final (*)
> | | | \--- io.netty:netty-handler:4.0.41.Final
> | | | +--- io.netty:netty-buffer:4.0.41.Final (*)
> | | | +--- io.netty:netty-transport:4.0.41.Final (*)
> | | | \--- io.netty:netty-codec:4.0.41.Final (*)
> | | +--- io.netty:netty-transport-native-epoll:4.0.41.Final
> | | | +--- io.netty:netty-common:4.0.41.Final
> | | | +--- io.netty:netty-buffer:4.0.41.Final (*)
> | | | \--- io.netty:netty-transport:4.0.41.Final (*)
> | | +--- org.asynchttpclient:netty-resolver-dns:2.0.15
> | | | +--- org.asynchttpclient:netty-resolver:2.0.15
> | | | | +--- io.netty:netty-common:4.0.41.Final
> | | | | \--- org.slf4j:slf4j-api:1.7.21
> | | | +--- org.asynchttpclient:netty-codec-dns:2.0.15
> | | | | +--- io.netty:netty-codec:4.0.41.Final (*)
> | | | | \--- org.slf4j:slf4j-api:1.7.21
> | | | +--- io.netty:netty-transport:4.0.41.Final (*)
> | | | \--- org.slf4j:slf4j-api:1.7.21
> | | +--- org.reactivestreams:reactive-streams:1.0.0
> | | +--- com.typesafe.netty:netty-reactive-streams:1.0.7
> | | | +--- io.netty:netty-handler:4.0.39.Final -> 4.0.41.Final
> (*)
> | | | \--- org.reactivestreams:reactive-streams:1.0.0
> | | +--- org.javassist:javassist:3.20.0-GA
> | | \--- org.slf4j:slf4j-api:1.7.21
> | \--- io.netty:netty-all:4.1.5.Final
>
> Any assistance would be greatly appreciated
>
> Thanks
> - Stuart
>
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2