ALL:
1. I hope this the proper forum. For some time I have tried to correct an error: "java.io StreamCorruptedException invalid stream header" , reoccuring in Jasper Reports source code.
2. Based upon requirements, The Program packages variables into a HashMap, and creates a "BLOB" object which is inserted into an Oracle database. At a later point, the BLOB object is retrieved, and the "BLOB" contents are read into a byte array. The next occurring task is to retrieve data from the receiving byte array and reconstitute the original HashMap object.
THIS IS WHEN THE PROGRAM FAILS !!!
3. I can verify the number of bytes going in/out of the "BLOB" object as being the same count. I have tried different approaches listed on diverse sites w/o success. My Source Code Follows:
************************************************************************************
// I tried to include only germane source code.
// THIS SECTION GETS THE BLOB OBJECT AND PUTS IT INTO A BYTE //ARRAY
rs = ps.executeQuery();
if (rs.next())
{
BLOB myblob =((OracleResultSet)rs).getBLOB("JASPERDATA");
int chunkSize = myblob.getChunkSize();
System.out.println("Incomming DATA size is ........." + chunkSize);
textbuffer = new byte[chunkSize];
int bytesRead;
InputStream myis = myblob.getBinaryStream();
OutputStream myout = myblob.getBinaryOutputStream();
while((bytesRead = myis.read(textbuffer) )!= -1)
{
myout.write(textbuffer);
}
myout.flush();
"" //code not germane to Discussion
""
""
return (textbuffer); //Returns Byte Array
*************************************************************************************
// I tried to include only germane source code.
byte [] textbuffer = adb.getBLOBFromQueue(dataFile); // Get Byte Array from above.
int textbufferLength = textbuffer.length;
HashMap localParamValueMap = null;
Object in = new ObjectInputStream(new ByteArrayInputStream(textbuffer ));
localParamValueMap = (HashMap) ((ObjectInputStream) in).readObject(); // THIS IS THE PROBLEM AREA EXCEPTION OCCURS AT "readObject"
***********************************************************************
// ERROR RECEIVED IN
TOMCAT //ERROR CALLSTACK
java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
at com.entservlet.DisplayJasperReports.doGet(DisplayJasperReports.java:72)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
Any help rendered would be greatly appreciated.
Thanks .............