You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by pchakinala <pr...@planetsoft.com> on 2011/08/27 18:04:40 UTC

com.ctc.wstx.exc.WstxIOException: Attempted read on closed stream

Hi,
 I am using servicemix 4.3 and my usecase flow is like below 

http client --> http consumer ---> camel -->http provider --> Out Side HTTP
Service

Outside HTTP Service returns xml file

Configuration:

		 <http:endpoint service="picf:httpManuTransmit"
                 endpoint="endpoint"
                 targetService="picf:routerChubbPDB"
                 role="consumer" 
                 locationURI="http://0.0.0.0:8192/manuTransmit/"
                 defaultMep="http://www.w3.org/2004/08/wsdl/in-out" >
	</http:endpoint>
		
		<camel:route streamCache="true">
		      <camel:from
uri="jbi:service:http://planetsoft.com/picf2/routerChubbPDB?mep=in-out" />
		<camel:to
uri="jbi:endpoint:http://planetsoft.com/picf2/httpMEF/endpoint?mep=in-out"
/>
		<convertBodyTo type="java.lang.String"/>

	</camel:route> 

		<http:endpoint service="picf:httpMEF" endpoint="endpoint"
	    role="provider" soap="false"
		defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
		 locationURI="http://localhost:8080/jsp-examples/checkbox/tppStub.jsp">	 

Exception:
com.ctc.wstx.exc.WstxIOException: Attempted read on closed stream.
	at
com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:536)[104:woodstox-core-asl:4.0.8]
	at
com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:585)[104:woodstox-core-asl:4.0.8]
	at
com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:641)[104:woodstox-core-asl:4.0.8]
	at
com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:323)[104:woodstox-core-asl:4.0.8]
	at
org.apache.servicemix.jbi.jaxp.StAXSourceTransformer.toXMLStreamReader(StAXSourceTransformer.java:86)[81:servicemix-utils:1.4.0]
	at
org.apache.servicemix.soap.marshalers.SoapWriter.writeContents(SoapWriter.java:218)[169:servicemix-soap:2011.01.0]
	at
org.apache.servicemix.soap.marshalers.SoapWriter.writeSimpleMessage(SoapWriter.java:127)[169:servicemix-soap:2011.01.0]
	at
org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:92)[169:servicemix-soap:2011.01.0]
	at
org.apache.servicemix.http.processors.ProviderProcessor.writeMessage(ProviderProcessor.java:343)[170:servicemix-http:2011.01.0]
	at
org.apache.servicemix.http.processors.ProviderProcessor.process(ProviderProcessor.java:131)[170:servicemix-http:2011.01.0]
	at
org.apache.servicemix.soap.SoapEndpoint.process(SoapEndpoint.java:400)[169:servicemix-soap:2011.01.0]
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:651)[121:servicemix-common:2011.01.0]
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:606)[121:servicemix-common:2011.01.0]
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchangeInTx(AsyncBaseLifeCycle.java:501)[121:servicemix-common:2011.01.0]
	at
org.apache.servicemix.common.AsyncBaseLifeCycle$2.run(AsyncBaseLifeCycle.java:370)[121:servicemix-common:2011.01.0]
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_24]
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_24]
	at java.lang.Thread.run(Thread.java:662)[:1.6.0_24]
Caused by: java.io.IOException: Attempted read on closed stream.
	at
org.apache.commons.httpclient.AutoCloseInputStream.isReadAllowed(AutoCloseInputStream.java:183)[168:org.apache.servicemix.bundles.commons-httpclient:3.1.0.5]
	at
org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:107)[168:org.apache.servicemix.bundles.commons-httpclient:3.1.0.5]
	at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)[:1.6.0_24]
	at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)[:1.6.0_24]
	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)[:1.6.0_24]
	at java.io.InputStreamReader.read(InputStreamReader.java:167)[:1.6.0_24]
	at
com.ctc.wstx.io.ReaderBootstrapper.initialLoad(ReaderBootstrapper.java:250)[104:woodstox-core-asl:4.0.8]
	at
com.ctc.wstx.io.ReaderBootstrapper.bootstrapInput(ReaderBootstrapper.java:133)[104:woodstox-core-asl:4.0.8]
	at
com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:531)[104:woodstox-core-asl:4.0.8]

I have used convertBody function to convert string. Why it is throwing
exception.I have seen same exception when converted to DOMSource also.

Please find attached files,log for your reference.

Please suggest me.

Regards,
Praveen Chakinala
http://servicemix.396122.n5.nabble.com/file/n4741541/servicemix.log
servicemix.log 
http://servicemix.396122.n5.nabble.com/file/n4741541/camel-context.xml
camel-context.xml 
http://servicemix.396122.n5.nabble.com/file/n4741541/xbean.xml xbean.xml 



--
View this message in context: http://servicemix.396122.n5.nabble.com/com-ctc-wstx-exc-WstxIOException-Attempted-read-on-closed-stream-tp4741541p4741541.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: com.ctc.wstx.exc.WstxIOException: Attempted read on closed stream

Posted by pchakinala <pr...@planetsoft.com>.
Hi JB,
Thanks for the reply. I have tried Option 1 and got same exception.
 
I will try with Option2
 
Thanks & Regards,
Praveen Chakinala
 
-----Original Message-----
From: "Jean-Baptiste Onofré [via ServiceMix]" <ml...@n5.nabble.com>
Sent: Saturday, August 27, 2011 2:08pm
To: "pchakinala" <pr...@planetsoft.com>
Subject: Re: com.ctc.wstx.exc.WstxIOException: Attempted read on closed stream



Hi, 

it seems that an endpoint already the message. When the JBI message  
source is read, the stream is closed. 

Could you try: 
1/ in your camel route, try to put the <convertBodyTo/> before the <to/>. 
2/ I advice to use the new HTTP endpoints, such as <http:soap-consume/>,  
<http:soap-provider/>, etc 
3/ In any case, a workaround is to fully use Camel for your  
implementation (with camel-cxf or camel-http depending of your  
requirements). 
For instance, using Camel, you can do: 

<from uri="[http://localhost:9090/route] http://localhost:9090/route"/> 
<to uri="[http://remote:/test/test] http://remote:/test/test"/> 

Regards 
JB 

On 08/27/2011 06:04 PM, pchakinala wrote:

> Hi, 
>   I am using servicemix 4.3 and my usecase flow is like below 
> 
> http client -->  http consumer --->  camel -->http provider -->  Out Side HTTP 
> Service 
> 
> Outside HTTP Service returns xml file 
> 
> Configuration: 
> 
> 		<http:endpoint service="picf:httpManuTransmit" 
>                   endpoint="endpoint" 
>                   targetService="picf:routerChubbPDB" 
>                   role="consumer" 
>                   locationURI="[http://0.0.0.0:8192/manuTransmit/] http://0.0.0.0:8192/manuTransmit/" 
>                   defaultMep="[http://www.w3.org/2004/08/wsdl/in-out] http://www.w3.org/2004/08/wsdl/in-out"> 
> 	</http:endpoint> 
> 		 
> 		<camel:route streamCache="true"> 
> 		<camel:from 
> uri="jbi:service:[http://planetsoft.com/picf2/routerChubbPDB?mep=in-out] http://planetsoft.com/picf2/routerChubbPDB?mep=in-out" /> 
> 		<camel:to 
> uri="jbi:endpoint:[http://planetsoft.com/picf2/httpMEF/endpoint?mep=in-out] http://planetsoft.com/picf2/httpMEF/endpoint?mep=in-out" 
> /> 
> 		<convertBodyTo type="java.lang.String"/> 
> 
> 	</camel:route> 
> 
> 		<http:endpoint service="picf:httpMEF" endpoint="endpoint" 
> 	    role="provider" soap="false" 
> 		defaultMep="[http://www.w3.org/2004/08/wsdl/in-out] http://www.w3.org/2004/08/wsdl/in-out" 
> 		 locationURI="[http://localhost:8080/jsp-examples/checkbox/tppStub.jsp] http://localhost:8080/jsp-examples/checkbox/tppStub.jsp">	 
> 
> Exception: 
> com.ctc.wstx.exc.WstxIOException: Attempted read on closed stream. 
> 	at 
> com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:536)[104:woodstox-core-asl:4.0.8] 
> 	at 
> com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:585)[104:woodstox-core-asl:4.0.8] 
> 	at 
> com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:641)[104:woodstox-core-asl:4.0.8] 
> 	at 
> com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:323)[104:woodstox-core-asl:4.0.8] 
> 	at 
> org.apache.servicemix.jbi.jaxp.StAXSourceTransformer.toXMLStreamReader(StAXSourceTransformer.java:86)[81:servicemix-utils:1.4.0] 
> 	at 
> org.apache.servicemix.soap.marshalers.SoapWriter.writeContents(SoapWriter.java:218)[169:servicemix-soap:2011.01.0] 
> 	at 
> org.apache.servicemix.soap.marshalers.SoapWriter.writeSimpleMessage(SoapWriter.java:127)[169:servicemix-soap:2011.01.0] 
> 	at 
> org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:92)[169:servicemix-soap:2011.01.0] 
> 	at 
> org.apache.servicemix.http.processors.ProviderProcessor.writeMessage(ProviderProcessor.java:343)[170:servicemix-http:2011.01.0] 
> 	at 
> org.apache.servicemix.http.processors.ProviderProcessor.process(ProviderProcessor.java:131)[170:servicemix-http:2011.01.0] 
> 	at 
> org.apache.servicemix.soap.SoapEndpoint.process(SoapEndpoint.java:400)[169:servicemix-soap:2011.01.0] 
> 	at 
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:651)[121:servicemix-common:2011.01.0] 
> 	at 
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:606)[121:servicemix-common:2011.01.0] 
> 	at 
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchangeInTx(AsyncBaseLifeCycle.java:501)[121:servicemix-common:2011.01.0] 
> 	at 
> org.apache.servicemix.common.AsyncBaseLifeCycle$2.run(AsyncBaseLifeCycle.java:370)[121:servicemix-common:2011.01.0] 
> 	at 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_24] 
> 	at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_24] 
> 	at java.lang.Thread.run(Thread.java:662)[:1.6.0_24] 
> Caused by: java.io.IOException: Attempted read on closed stream. 
> 	at 
> org.apache.commons.httpclient.AutoCloseInputStream.isReadAllowed(AutoCloseInputStream.java:183)[168:org.apache.servicemix.bundles.commons-httpclient:3.1.0.5] 
> 	at 
> org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:107)[168:org.apache.servicemix.bundles.commons-httpclient:3.1.0.5] 
> 	at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)[:1.6.0_24] 
> 	at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)[:1.6.0_24] 
> 	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)[:1.6.0_24] 
> 	at java.io.InputStreamReader.read(InputStreamReader.java:167)[:1.6.0_24] 
> 	at 
> com.ctc.wstx.io.ReaderBootstrapper.initialLoad(ReaderBootstrapper.java:250)[104:woodstox-core-asl:4.0.8] 
> 	at 
> com.ctc.wstx.io.ReaderBootstrapper.bootstrapInput(ReaderBootstrapper.java:133)[104:woodstox-core-asl:4.0.8] 
> 	at 
> com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:531)[104:woodstox-core-asl:4.0.8] 
> 
> I have used convertBody function to convert string. Why it is throwing 
> exception.I have seen same exception when converted to DOMSource also. 
> 
> Please find attached files,log for your reference. 
> 
> Please suggest me. 
> 
> Regards, 
> Praveen Chakinala 
> [http://servicemix.396122.n5.nabble.com/file/n4741541/servicemix.log] http://servicemix.396122.n5.nabble.com/file/n4741541/servicemix.log
> servicemix.log 
> [http://servicemix.396122.n5.nabble.com/file/n4741541/camel-context.xml] http://servicemix.396122.n5.nabble.com/file/n4741541/camel-context.xml
> camel-context.xml 
> [http://servicemix.396122.n5.nabble.com/file/n4741541/xbean.xml] http://servicemix.396122.n5.nabble.com/file/n4741541/xbean.xml xbean.xml 
> 
> 
> 
> -- 
> View this message in context: [http://servicemix.396122.n5.nabble.com/com-ctc-wstx-exc-WstxIOException-Attempted-read-on-closed-stream-tp4741541p4741541.html] http://servicemix.396122.n5.nabble.com/com-ctc-wstx-exc-WstxIOException-Attempted-read-on-closed-stream-tp4741541p4741541.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
--  
Jean-Baptiste Onofré 
[/user/SendEmail.jtp?type=node&node=4741768&i=0] [hidden email] 
[http://blog.nanthrax.net] http://blog.nanthrax.net
Talend - [http://www.talend.com] http://www.talend.com




If you reply to this email, your message will be added to the discussion below:[http://servicemix.396122.n5.nabble.com/com-ctc-wstx-exc-WstxIOException-Attempted-read-on-closed-stream-tp4741541p4741768.html] http://servicemix.396122.n5.nabble.com/com-ctc-wstx-exc-WstxIOException-Attempted-read-on-closed-stream-tp4741541p4741768.html
To unsubscribe from com.ctc.wstx.exc.WstxIOException: Attempted read on closed stream, [http://servicemix.396122.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4741541&code=cHJhdmVlbi5jaGFraW5hbGFAcGxhbmV0c29mdC5jb218NDc0MTU0MXwtMjAwNDE3OTQwNg==] click here.

--
View this message in context: http://servicemix.396122.n5.nabble.com/com-ctc-wstx-exc-WstxIOException-Attempted-read-on-closed-stream-tp4741541p4741798.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: com.ctc.wstx.exc.WstxIOException: Attempted read on closed stream

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

it seems that an endpoint already the message. When the JBI message 
source is read, the stream is closed.

Could you try:
1/ in your camel route, try to put the <convertBodyTo/> before the <to/>.
2/ I advice to use the new HTTP endpoints, such as <http:soap-consume/>, 
<http:soap-provider/>, etc
3/ In any case, a workaround is to fully use Camel for your 
implementation (with camel-cxf or camel-http depending of your 
requirements).
For instance, using Camel, you can do:

<from uri="http://localhost:9090/route"/>
<to uri="http://remote:/test/test"/>

Regards
JB

On 08/27/2011 06:04 PM, pchakinala wrote:
> Hi,
>   I am using servicemix 4.3 and my usecase flow is like below
>
> http client -->  http consumer --->  camel -->http provider -->  Out Side HTTP
> Service
>
> Outside HTTP Service returns xml file
>
> Configuration:
>
> 		<http:endpoint service="picf:httpManuTransmit"
>                   endpoint="endpoint"
>                   targetService="picf:routerChubbPDB"
>                   role="consumer"
>                   locationURI="http://0.0.0.0:8192/manuTransmit/"
>                   defaultMep="http://www.w3.org/2004/08/wsdl/in-out">
> 	</http:endpoint>
> 		
> 		<camel:route streamCache="true">
> 		<camel:from
> uri="jbi:service:http://planetsoft.com/picf2/routerChubbPDB?mep=in-out" />
> 		<camel:to
> uri="jbi:endpoint:http://planetsoft.com/picf2/httpMEF/endpoint?mep=in-out"
> />
> 		<convertBodyTo type="java.lang.String"/>
>
> 	</camel:route>
>
> 		<http:endpoint service="picf:httpMEF" endpoint="endpoint"
> 	    role="provider" soap="false"
> 		defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
> 		 locationURI="http://localhost:8080/jsp-examples/checkbox/tppStub.jsp">	
>
> Exception:
> com.ctc.wstx.exc.WstxIOException: Attempted read on closed stream.
> 	at
> com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:536)[104:woodstox-core-asl:4.0.8]
> 	at
> com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:585)[104:woodstox-core-asl:4.0.8]
> 	at
> com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:641)[104:woodstox-core-asl:4.0.8]
> 	at
> com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:323)[104:woodstox-core-asl:4.0.8]
> 	at
> org.apache.servicemix.jbi.jaxp.StAXSourceTransformer.toXMLStreamReader(StAXSourceTransformer.java:86)[81:servicemix-utils:1.4.0]
> 	at
> org.apache.servicemix.soap.marshalers.SoapWriter.writeContents(SoapWriter.java:218)[169:servicemix-soap:2011.01.0]
> 	at
> org.apache.servicemix.soap.marshalers.SoapWriter.writeSimpleMessage(SoapWriter.java:127)[169:servicemix-soap:2011.01.0]
> 	at
> org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:92)[169:servicemix-soap:2011.01.0]
> 	at
> org.apache.servicemix.http.processors.ProviderProcessor.writeMessage(ProviderProcessor.java:343)[170:servicemix-http:2011.01.0]
> 	at
> org.apache.servicemix.http.processors.ProviderProcessor.process(ProviderProcessor.java:131)[170:servicemix-http:2011.01.0]
> 	at
> org.apache.servicemix.soap.SoapEndpoint.process(SoapEndpoint.java:400)[169:servicemix-soap:2011.01.0]
> 	at
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:651)[121:servicemix-common:2011.01.0]
> 	at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:606)[121:servicemix-common:2011.01.0]
> 	at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchangeInTx(AsyncBaseLifeCycle.java:501)[121:servicemix-common:2011.01.0]
> 	at
> org.apache.servicemix.common.AsyncBaseLifeCycle$2.run(AsyncBaseLifeCycle.java:370)[121:servicemix-common:2011.01.0]
> 	at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_24]
> 	at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_24]
> 	at java.lang.Thread.run(Thread.java:662)[:1.6.0_24]
> Caused by: java.io.IOException: Attempted read on closed stream.
> 	at
> org.apache.commons.httpclient.AutoCloseInputStream.isReadAllowed(AutoCloseInputStream.java:183)[168:org.apache.servicemix.bundles.commons-httpclient:3.1.0.5]
> 	at
> org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:107)[168:org.apache.servicemix.bundles.commons-httpclient:3.1.0.5]
> 	at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)[:1.6.0_24]
> 	at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)[:1.6.0_24]
> 	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)[:1.6.0_24]
> 	at java.io.InputStreamReader.read(InputStreamReader.java:167)[:1.6.0_24]
> 	at
> com.ctc.wstx.io.ReaderBootstrapper.initialLoad(ReaderBootstrapper.java:250)[104:woodstox-core-asl:4.0.8]
> 	at
> com.ctc.wstx.io.ReaderBootstrapper.bootstrapInput(ReaderBootstrapper.java:133)[104:woodstox-core-asl:4.0.8]
> 	at
> com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:531)[104:woodstox-core-asl:4.0.8]
>
> I have used convertBody function to convert string. Why it is throwing
> exception.I have seen same exception when converted to DOMSource also.
>
> Please find attached files,log for your reference.
>
> Please suggest me.
>
> Regards,
> Praveen Chakinala
> http://servicemix.396122.n5.nabble.com/file/n4741541/servicemix.log
> servicemix.log
> http://servicemix.396122.n5.nabble.com/file/n4741541/camel-context.xml
> camel-context.xml
> http://servicemix.396122.n5.nabble.com/file/n4741541/xbean.xml xbean.xml
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/com-ctc-wstx-exc-WstxIOException-Attempted-read-on-closed-stream-tp4741541p4741541.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com