You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by "Lukasz L." <Lu...@sabre.com> on 2007/10/23 13:03:54 UTC

http endpoint - connection forcibly closed

I have an http-consumer that act like a proxy for jms-producer. I'm trying to
send a message to http endpoint with a simple http client and I got
following error:

DEBUG - jetty                          - EXCEPTION 
java.io.IOException: An existing connection was forcibly closed by the
remote host
	at sun.nio.ch.SocketDispatcher.read0(Native Method)
	at sun.nio.ch.SocketDispatcher.read(Unknown Source)
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
	at sun.nio.ch.IOUtil.read(Unknown Source)
	at sun.nio.ch.SocketChannelImpl.read(Unknown Source)
	at org.mortbay.io.nio.ChannelEndPoint.fill(ChannelEndPoint.java:128)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:282)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
	at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
	at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)

http consumer configuration is:

<beans xmlns:http="http://servicemix.apache.org/http/1.0"
	xmlns:tns="http://mynamespace/test">
	<http:endpoint
		service="tns:jmsProvider"
		endpoint="jmsProvider"
		role="consumer"
		locationURI="http://localhost:8192/httpConsumer/"
		defaultMep="http://www.w3.org/2004/08/wsdl/in-only">
	</http:endpoint>
</beans>

the client code:

   public static void main(String[] args) throws Exception
   {
      String httpEndpoint = "http://localhost:8192/httpConsumer/";
      URLConnection connection = new URL(httpEndpoint).openConnection();
      connection.setDoOutput(true);
      OutputStream sender = connection.getOutputStream();
      String msg = "<TestMsg>hello!</TestMsg>";
      sender.write(msg.getBytes());
      sender.flush();
      sender.close();
   }

Similar error was reported here:
http://www.nabble.com/http-jbi-connector-tf3065579s12049.html#a8526348
http://www.nabble.com/http-endpoint-tf3121826s12049.html#a8649586

I noticed that in all three cases in-only MEP is used but (AFAIK) http
consumer allow this kind of MEP.
-- 
View this message in context: http://www.nabble.com/http-endpoint---connection-forcibly-closed-tf4676702s12049.html#a13361766
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: http endpoint - connection forcibly closed

Posted by Gert Vanthienen <ge...@skynet.be>.
L.S.,

With the in-only MEP, no data is returned in the HTTP response, only the 
response header is sent back to the client (e.g. the 202 - 
HTTP_STATUS_ACCEPTED status code)


Gert

Lukasz L. wrote:
> The workaround for this problem was in my case to get input stream on client
> side e.g. like this:
> [...]     
> sender.close();
> InputStream inputStream = connection.getInputStream();
> inputStream.close();
>
> Jetty error still occurs in the log file, but the message is now routed to
> jms component. Without it message wasn't forward by http component.
>
> This is very strange, as MEP is set to in-only so http-component should only
> accept input. 
> And it seems that Jetty doesn't send anything back, client can't read
> anything even if we try it, but on the other side jetty seems to send HTTP
> 202 code.
> How in-only MEP is emulated over http protocol?
>
>   


Re: http endpoint - connection forcibly closed

Posted by "Lukasz L." <Lu...@sabre.com>.
The workaround for this problem was in my case to get input stream on client
side e.g. like this:
[...]     
sender.close();
InputStream inputStream = connection.getInputStream();
inputStream.close();

Jetty error still occurs in the log file, but the message is now routed to
jms component. Without it message wasn't forward by http component.

This is very strange, as MEP is set to in-only so http-component should only
accept input. 
And it seems that Jetty doesn't send anything back, client can't read
anything even if we try it, but on the other side jetty seems to send HTTP
202 code.
How in-only MEP is emulated over http protocol?

-- 
View this message in context: http://www.nabble.com/http-endpoint---connection-forcibly-closed-tf4676702s12049.html#a13384562
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: http endpoint - connection forcibly closed

Posted by "Lukasz L." <Lu...@sabre.com>.
The workaround for this problem was in my case to get input stream on client
side e.g. like this:
[...]     
sender.close();
InputStream inputStream = connection.getInputStream();
inputStream.close();

Jetty error still occurs in the log file, but the message is now routed to
jms component. Without it message wasn't forward by http component.

This is very strange, as MEP is set to in-only so http-component should only
accept input. 

-- 
View this message in context: http://www.nabble.com/http-endpoint---connection-forcibly-closed-tf4676702s12049.html#a13384562
Sent from the ServiceMix - User mailing list archive at Nabble.com.