You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by bwest <bw...@gmail.com> on 2014/11/25 16:24:48 UTC

camel-netty: no response received from remote server.

Greetings, 

I have a need to send a request via tcp to a socket server.  I'm trying to
use the camel-netty component to do this.  So I send a request and then I
get
I get errors the following error thrown out: 

*org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message: ☻97244♥]
        at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1380)
        at
org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:622)
        at
org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:471)
        at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:133)
        at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:149)
        at
org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:301)
        at
com.ta.shop.integration.routes.paymentprocessing.ABSPostAuthorizationProducerTest.testDataTransmission(ABSPostAuthorizationProducerTest.java:53)
Caused by: org.apache.camel.CamelExchangeException: No response received
from remote server: xx.xx.xx.xx:xxxx. Exchange[Message: ☻97244♥]
        at
org.apache.camel.component.netty.handlers.ClientChannelHandler.channelClosed(ClientChannelHandler.java:118)
        at
org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:88)
        at
org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at
org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
        at
org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60)
        at
org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at
org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
        at
org.jboss.netty.handler.codec.frame.FrameDecoder.cleanup(FrameDecoder.java:493)
        at
org.jboss.netty.handler.codec.frame.FrameDecoder.channelClosed(FrameDecoder.java:371)
        at
org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:88)
        at
org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at
org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
        at
org.jboss.netty.channel.Channels.fireChannelClosed(Channels.java:468)
        at
org.jboss.netty.channel.socket.nio.AbstractNioWorker.close(AbstractNioWorker.java:375)
        at
org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:93)
        at
org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
        at
org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
        at
org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
        at
org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
        at
org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
        at
org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)*
		
		
Now just to make sure, I did a tcp trace on the and I did see the request
being sent and I do see the server responding.  So I'm not sure why this
error is being thrown.  

Here is my statement for good measure, it doesn't make it past the .to
statement before the error is thrown.  

/from("direct:sendAuthMessage")
			//.setBody(simple("${body}", String.class))
			.transform().body(String.class)
		
.to("netty:tcp://xx.xx.xx.xx:xxxx?sync=true&textline=true&autoAppendDelimiter=false&keepAlive=false").process(new
testProcessor())
			.log("${body}")
			.to("file:/tmp/output/")
			.to("mock:authorization");/

 Any ideas?  
 
 Thanks,



--
View this message in context: http://camel.465427.n5.nabble.com/camel-netty-no-response-received-from-remote-server-tp5759592.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-netty: no response received from remote server.

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

It depends on the codec you use for netty. I think it may for some odd
reason be a java seriazlization codec as that was the default with the
mina component, and we wanted netty to be similar.

If you use textline=true then its a text based message etc.

On Wed, Nov 26, 2014 at 4:50 PM, bwest <bw...@gmail.com> wrote:
> Hello,
>
> I've made some progress with the original question.  I appears that I am
> receiving a response as expected.  However, the response isn't in the body.
> So when i do a .log("Message: ${body}) in the route, it comes back blank.
>
> Although in my unit tests the following statement returns the response in
> the String as expected.
>
> String response = (String) template.requestBody("direct:accessAuth", new
> String(Files.readAllBytes(Paths.get(getClass().getResource("/requests/raw.txt").toURI()))));
>
>
> What am I missing?  I've started to look into the stream caching, tho i'm
> not sure if this is the right direction.
>
> ANY ideas are appreciated!
>
> Thanks!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-netty-no-response-received-from-remote-server-tp5759592p5759650.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: camel-netty: no response received from remote server.

Posted by bwest <bw...@gmail.com>.
Hello, 

I've made some progress with the original question.  I appears that I am
receiving a response as expected.  However, the response isn't in the body. 
So when i do a .log("Message: ${body}) in the route, it comes back blank.  

Although in my unit tests the following statement returns the response in
the String as expected.     

String response = (String) template.requestBody("direct:accessAuth", new
String(Files.readAllBytes(Paths.get(getClass().getResource("/requests/raw.txt").toURI()))));


What am I missing?  I've started to look into the stream caching, tho i'm
not sure if this is the right direction.  

ANY ideas are appreciated!

Thanks!



--
View this message in context: http://camel.465427.n5.nabble.com/camel-netty-no-response-received-from-remote-server-tp5759592p5759650.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-netty: no response received from remote server.

Posted by Claus Ibsen <cl...@gmail.com>.
You can add an explicit conversion to your route

to("netty...")
convertBodyTo(String.class)
to("log:...")

On Wed, Nov 26, 2014 at 5:37 PM, bwest <bw...@gmail.com> wrote:
> Hi Claus,
>
> This is the what my route currently looks like:
>
> from("direct:sendAuthMessage")
>                         .log("Logging Incoming message -->" + "${body}")
>                         .setBody(simple("${body}", String.class))
>
> .to("netty:tcp://10.98.1.41:1100?clientPipelineFactory=#cpf&sync=true&textline=true&autoAppendDelimiter=false").delay(3000)
>                         .to("log:Socket response??showAll=true")     // <-- This show the body as
> blank.
>                         //.to("file:/tmp/output/")
>                         .to("mock:authorization");
>
> My Logging statement is showing the following:
> Headers: {breadcrumbId=ID-BWEST-52331-1417019441385-0-1}, BodyType: String,
> Body: , Out: null: ]
>
>
> I am using the textline codec.  I'm also using a custom pipeline in order to
> implement a custom delimiterbasedframedecoder, not sure if that would have
> something to do with this.
>
>
> I'm not sure why the Unit test can trap this value as a String but the route
> can't seem to get at it.  I'm new with camel, so am I not doing something
> correctly in the route?
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-netty-no-response-received-from-remote-server-tp5759592p5759660.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: camel-netty: no response received from remote server.

Posted by bwest <bw...@gmail.com>.
Hi Claus, 

This is the what my route currently looks like:  

from("direct:sendAuthMessage")
			.log("Logging Incoming message -->" + "${body}")
			.setBody(simple("${body}", String.class))
		
.to("netty:tcp://10.98.1.41:1100?clientPipelineFactory=#cpf&sync=true&textline=true&autoAppendDelimiter=false").delay(3000)
			.to("log:Socket response??showAll=true")     // <-- This show the body as
blank.
			//.to("file:/tmp/output/")
			.to("mock:authorization");

My Logging statement is showing the following:  
Headers: {breadcrumbId=ID-BWEST-52331-1417019441385-0-1}, BodyType: String,
Body: , Out: null: ]


I am using the textline codec.  I'm also using a custom pipeline in order to
implement a custom delimiterbasedframedecoder, not sure if that would have
something to do with this.


I'm not sure why the Unit test can trap this value as a String but the route
can't seem to get at it.  I'm new with camel, so am I not doing something
correctly in the route?  
 



--
View this message in context: http://camel.465427.n5.nabble.com/camel-netty-no-response-received-from-remote-server-tp5759592p5759660.html
Sent from the Camel - Users mailing list archive at Nabble.com.