You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by Zacarias <zm...@gmail.com> on 2009/05/08 17:06:15 UTC

Error "Attempted read on closed stream" with Cache Ligthweigth Component

Hi,

I made a service configured the following way
HTTP as a consumer
EIP component as orchestator
Cache endpoint (configured as a ligthweigth component) to keep the answer
from a HTTP Provider.
HTTP as a provider


Execution of this service raised the following exception* Error "Attempted
read on closed stream"*

This happened in a IBM JVM but I didn't test if this is the whole problem
because I couldn't evaluate all libraries in the environment.
In the IBM environment the "response" variable at
"servicemix-3.2.2/common/servicemix-components/src/main/java/org/apache/servicemix/components/cache/CacheComponent.java"
line 102 is javax.xml.transform.stream.StreamSource
in the SUN JVM environment the response variable al the same class is
javax.xml.transform.dom.DOMSource

so I found a solution for this issue (if it is really a bug :)))  )

in the CacheComponent.java I change the line where the compontent keeps the
response. I use de "out" variable instead of the "response"

old line
cache.put(key, response);

new line
cache.put(key, out);

I think this is the correct use of
getMessageTransformer().transform(exchange, response, out);
Please let me know if its the correction of a bug and if you gonna make the
cut in a future release because I wouldn't like to have a different code
from you.

Regards
Zacarias