Anonymous | Login | Signup for a new account | 11-22-2024 09:40 PST |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Advanced Details [ Jump to Notes ] | [ View Simple ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0003655 | [Hessian] | minor | always | 08-28-09 08:51 | 07-29-19 13:54 | ||||
Reporter | ferg | View Status | public | ||||||
Assigned To | ferg | ||||||||
Priority | normal | Resolution | fixed | Platform | |||||
Status | closed | OS | |||||||
Projection | none | OS Version | |||||||
ETA | none | Fixed in Version | 4.0.63 | Product Version | 4.0.1 | ||||
Product Build | |||||||||
Summary | 0003655: Hessian InputStream result is closed | ||||||||
Description |
(rep by Mattias Jiderhamn) After upgrading from Resin/Hessian 3.1 to 4.0.1 we have a problem returning InputStream from Hessian calls. I get this exception while trying to read the stream on the client: java.io.IOException: stream is closed at sun.net.www.http.ChunkedInputStream.ensureOpen(ChunkedInputStream.java:151) at sun.net.www.http.ChunkedInputStream.read(ChunkedInputStream.java:646) at java.io.FilterInputStream.read(FilterInputStream.java:116) at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2446) at com.caucho.hessian.io.Hessian2Input.readBuffer(Hessian2Input.java:2689) at com.caucho.hessian.io.Hessian2Input.read(Hessian2Input.java:2635) at com.caucho.hessian.io.Hessian2Input$ReadInputStream.read(Hessian2Input.java:2785) ... I created a small testcase which just sends the output of a Hessian2Output to a Hessian2Input and in that case, InputStream works fine. The proxy is created using Springs HessianProxyFactoryBean. Any tips on how to debug this??? |
||||||||
Steps To Reproduce |
Both client and server is using Hessian included in Resin 4.0.1. Here is a detailed test case (without Spring): Service interface: public interface HessianTest { InputStream testString(String input); } Service implementation: public class HessianTestImpl implements HessianTest { public InputStream testString(String s) { return new ByteArrayInputStream(s.getBytes()); } } Service configuration; web.xml: <servlet-mapping url-pattern="/hessian/test" servlet-class="com.caucho.hessian.server.HessianServlet"> <init-param> <api-class>foo.HessianTest</api-class> <service-class>foo.HessianTestImpl</service-class> </init-param> </servlet-mapping> Test case: HessianProxyFactory hessianProxyFactory = new HessianProxyFactory(); // Workaround for http://bugs.caucho.com/view.php?id=3634 [^] hessianProxyFactory.setSerializerFactory(new SerializerFactory() { protected Deserializer loadDeserializer(Class cl) throws HessianProtocolException { if (InputStream.class.isAssignableFrom(cl)) return new InputStreamDeserializer(); else return super.loadDeserializer(cl); } }); HessianTest hessianTest = (HessianTest) hessianProxyFactory.create(HessianTest.class, "http://localhost/hessian/test"); [^] StringBuilder sb = new StringBuilder(); for(int i = 0; i < 512; i++) { final int digit = (i % 10) + 1; sb.append(digit); System.out.println("No of chars: " + sb.length()); InputStream is = hessianTest.testString(sb.toString()); BufferedReader br = new BufferedReader(new InputStreamReader(is)); assertEquals(sb.toString(), br.readLine()); } Output: No of chars: 1 No of chars: 2 No of chars: 3 No of chars: 4 No of chars: 5 No of chars: 6 No of chars: 7 No of chars: 8 No of chars: 9 No of chars: 11 No of chars: 12 No of chars: 13 No of chars: 14 No of chars: 15 No of chars: 16 No of chars: 17 No of chars: 18 No of chars: 19 java.io.IOException: stream is closed at sun.net.www.http.ChunkedInputStream.ensureOpen(ChunkedInputStream.java:151) at sun.net.www.http.ChunkedInputStream.read(ChunkedInputStream.java:646) at java.io.FilterInputStream.read(FilterInputStream.java:116) at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2391) at com.caucho.hessian.io.Hessian2Input.readBuffer(Hessian2Input.java:2689) at com.caucho.hessian.io.Hessian2Input.read(Hessian2Input.java:2661) at com.caucho.hessian.io.Hessian2Input.read(Hessian2Input.java:2603) at com.caucho.hessian.io.Hessian2Input$ReadInputStream.read(Hessian2Input.java:2785) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at se.exder.HessianInputStreamTest.testHessianTest(HessianInputStreamTest.java:80) ... </Mattias> |
||||||||
Additional Information | |||||||||
Attached Files | Hessian_3000655.patch [^] (571 bytes) 08-28-09 09:46 | ||||||||
|
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
60 total queries executed. 40 unique queries executed. |