473,769 Members | 6,926 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

java.io.StreamC orruptedExcepti on: invalid stream header

What does this error for the Code below
java.io.StreamC orruptedExcepti on: invalid stream header
at java.io.ObjectI nputStream.read StreamHeader(Un known Source)
at java.io.ObjectI nputStream.<ini t>(Unknown Source)
at com.kbs.framewo rk.client.gui.P IPReport.doProc ess(PIPReport.j ava:562)
at com.kbs.framewo rk.client.gui.P IPReport.action Performed(PIPRe port.java:508)
at javax.swing.Abs tractButton.fir eActionPerforme d(Unknown Source)
at javax.swing.Abs tractButton$For wardActionEvent s.actionPerform ed(Unknown
Source)
at javax.swing.Def aultButtonModel .fireActionPerf ormed(Unknown Source)
at javax.swing.Def aultButtonModel .setPressed(Unk nown Source)
at javax.swing.pla f.basic.BasicBu ttonListener.mo useReleased(Unk nown
Source)
at java.awt.Compon ent.processMous eEvent(Unknown Source)
at java.awt.Compon ent.processEven t(Unknown Source)
at java.awt.Contai ner.processEven t(Unknown Source)
at java.awt.Compon ent.dispatchEve ntImpl(Unknown Source)
at java.awt.Contai ner.dispatchEve ntImpl(Unknown Source)
at java.awt.Compon ent.dispatchEve nt(Unknown Source)
at java.awt.Lightw eightDispatcher .retargetMouseE vent(Unknown Source)
at java.awt.Lightw eightDispatcher .processMouseEv ent(Unknown Source)
at java.awt.Lightw eightDispatcher .dispatchEvent( Unknown Source)
at java.awt.Contai ner.dispatchEve ntImpl(Unknown Source)
at java.awt.Compon ent.dispatchEve nt(Unknown Source)
at java.awt.EventQ ueue.dispatchEv ent(Unknown Source)
at java.awt.EventD ispatchThread.p umpOneEventForH ierarchy(Unknow n
Source)
at java.awt.EventD ispatchThread.p umpEventsForHie rarchy(Unknown Source)
at java.awt.EventD ispatchThread.p umpEvents(Unkno wn Source)
at java.awt.EventD ispatchThread.p umpEvents(Unkno wn Source)
at java.awt.EventD ispatchThread.r un(Unknown Source)

When I click the Button in Applet , I want it open a Dialog asking for
the excel to open/save etc... It doesnt happen why...

Though I'm writing the contents to excel , Now it doesnt create the
excel file Why....
My Applet code is
------------------------------------------------------------------------------
URL url =new URL("http://localhost:8080/portal/servlet/com.kbs.framewo rk.client.gui.R eportServlet");

HttpURLConnecti on servletConnecti on =
(HttpURLConnect ion)url.openCon nection();
servletConnecti on.setDoInput(t rue);
servletConnecti on.setDoOutput( true);

servletConnecti on.setUseCaches (false);
servletConnecti on.setDefaultUs eCaches(false);
servletConnecti on.setRequestMe thod("POST");
servletConnecti on.setRequestPr operty("Content-type","applicat ion/octet-stream");

ObjectOutputStr eam outStream =
new ObjectOutputStr eam(servletConn ection.getOutpu tStream());
outStream.write Object(command) ;
outStream.flush ();
outStream.close ();

System.out.prin tln("MY RESULT IN APPLET");
InputStream instr = servletConnecti on.getInputStre am();
ObjectInputStre am inputFromServle t = new ObjectInputStre am(instr);
String result = (String) inputFromServle t.readObject();
inputFromServle t.close();
instr.close();
------------------------------------------------------------------

SERVLET CODE
--------------------------------------------------------------------
public void performTask(jav ax.servlet.http .HttpServletReq uest
request,javax.s ervlet.http.Htt pServletRespons e response)
{
response.setCon tentType("appli cation/vnd.ms-excel");
PrintWriter out = response.getWri ter();
String fileName = "temp" + Long.toString(S ystem.currentTi meMillis())
+ ".xls";
response.addHea der("Content-Disposition", "inline; filename=\"" +
fileName
+ "\"");
InputStream in = request.getInpu tStream();
ObjectInputStre am inputFromApplet = new ObjectInputStre am(in);
String command = (String) inputFromApplet .readObject();
String result = submitQuery(com mand);
System.out.prin tln("RESULT" + result);
out.println(com mand);
out.close();
--------------------------------------------------------------
Jul 17 '05 #1
2 47278
"SubbaRao Karanam" <su************ @yahoo.com> wrote in message
news:5d******** *************** ***@posting.goo gle.com...
What does this error for the Code below
java.io.StreamC orruptedExcepti on: invalid stream header *snip stacktrace*

When I click the Button in Applet , I want it open a Dialog asking for
the excel to open/save etc... It doesnt happen why...

Though I'm writing the contents to excel , Now it doesnt create the
excel file Why....
My Applet code is
-------------------------------------------------------------------------- ---- URL url =new URL("http://localhost:8080/portal/servlet/com.kbs.framewo rk.client.gui.R epor
tServlet");
HttpURLConnecti on servletConnecti on =
(HttpURLConnect ion)url.openCon nection();
servletConnecti on.setDoInput(t rue);
servletConnecti on.setDoOutput( true);

servletConnecti on.setUseCaches (false);
servletConnecti on.setDefaultUs eCaches(false);
servletConnecti on.setRequestMe thod("POST");
servletConnecti on.setRequestPr operty("Content-type","applicat ion/octet-strea
m");
ObjectOutputStr eam outStream =
new ObjectOutputStr eam(servletConn ection.getOutpu tStream());
outStream.write Object(command) ;
outStream.flush ();
outStream.close ();

System.out.prin tln("MY RESULT IN APPLET");
InputStream instr = servletConnecti on.getInputStre am();
ObjectInputStre am inputFromServle t = new ObjectInputStre am(instr);
String result = (String) inputFromServle t.readObject();
inputFromServle t.close();
instr.close();
------------------------------------------------------------------

SERVLET CODE
--------------------------------------------------------------------
public void performTask(jav ax.servlet.http .HttpServletReq uest
request,javax.s ervlet.http.Htt pServletRespons e response)
{
response.setCon tentType("appli cation/vnd.ms-excel");
PrintWriter out = response.getWri ter();
String fileName = "temp" + Long.toString(S ystem.currentTi meMillis())
+ ".xls";
response.addHea der("Content-Disposition", "inline; filename=\"" +
fileName
+ "\"");
InputStream in = request.getInpu tStream();
ObjectInputStre am inputFromApplet = new ObjectInputStre am(in);
String command = (String) inputFromApplet .readObject();
String result = submitQuery(com mand);
System.out.prin tln("RESULT" + result);
out.println(com mand);
out.close();
--------------------------------------------------------------


Compilable code is preferable. For tips on future posts, see:
http://www.physci.org/codes/sscce.jsp

From what you provided, I would assume you're attempting to use an
ObjectInputStre am to receive data from a PrintWriter. How do you expect that
to work? You're getting a StreamCorrupted Exception because an
ObjectInputStre am expects to read an object stream, i.e. the other end of an
ObjectOutputStr eam.
Jul 17 '05 #2
meena
1 New Member
Hi
I am trying to call the servlet's dopost method through my java program. I am supposed to give a file through my java program to the servlet and servlet has to save the same in the specified location. I was searching for the code, I found you are also trying to do the same. Please let me know whether you got any solution for your problem. Can you please post your code.

thanks in advance.

regards
Mar 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7091
by: Nick Nygaard | last post by:
Hi everyone, I'm using O'Reilly's servlet API to make an object based HTTP communication between an Applet and a servlet. Following their own tutorial 10.2.3. Object-based HTTP Communication http://www.unix.org.ua/orelly/java-ent/servlet/ch10_02.htm of how to construct e.g. a day time server, gives me: java.io.StreamCorruptedException: invalid stream header
0
472
by: CSN | last post by:
There are a bunch of these in PG's log: ERROR: Invalid page header in block 14 of start_items_key What does it mean? PG seems to be working fine - anything I need to fix/adjust/worry about? TIA, CSN
1
2034
by: Carmen Wai | last post by:
Hello: I am a new user of postgresql. I am using postgresql 7.3.4 and I had inserted about 1.7 million records to a table. When I vacuum / select * from table, it gets a error message of : Invalid page header in block xxx of TableA. I check that I still can insert records to the table. But I am not able to get part of the data (as I try to copy all records to text file, only around 1.6 million records are copied.) How can I recovery...
0
1362
by: Konstantinos Agouros | last post by:
Hi, I have a machine that is currently a bit unstable. No I got a: sysad=# select * from attacks where start < '1.1.2000'; ERROR: Invalid page header in block 3618 of attacks From googeling I saw that this should be solvable if I can delete the bad rows or find the bad datafile. Anybody has a tip on how to do that? Because I could not find the how in detail.
2
11585
by: Anthony | last post by:
Our Database is having errors. We are currently using PostgreSQL to store 2.5 Million records per day. The average addition to our primary table is 4.5 Gigs of data. We are doing this on a dual Opteron 244 system with 1 TeraByte of HDD space. The drives are 250 Gig Western Digital. The Raid Controller is LSI Logic MegaRaid 150-6. We are getting an error after about 4-5 days worth of data being put into the system.
0
1440
by: Hubert Fröhlich | last post by:
Hi list, I am working with 7.4.1 under Linux (SuSE 8.1) The server is a HP ProLiant DL 380-G3, 2x Intel Pentium4-Xeon, 2.8 GHz, 4 GB memory and a RAID 5 system with ca. 500 GB diskspace (xfs file system) When doing big transactions or changes (UPDATE several million rows in one step) on a database with ca. 50 GB diskspace and ca 15 million entries, PostGIS and lots of indexes, I get errors like
5
4163
by: Ed L. | last post by:
I have 5 corrupted page headers as evidenced by these errors: ERROR: Invalid page header in block 13947 of ... The corruption is causing numerous queries to abort. First option is to try to salvage data before attempt restore from backup. I want to try to edit the file to zero out the bogus headers. I realize there may be data lost from this attempt. I have scalpel (binary editor) in hand. Which bytes should I edit, and what do...
5
8275
by: Steve Crawford | last post by:
This morning I got bitten by the "SELECT INTO" / "CREATE TABLE AS" from tables without OIDs bug in 7.4.1. Postmaster killed all the backends and restarted - pg was down for 2 seconds. This happened two times within a few minute period. Now I am getting 'invalid page header in block 52979 of relation "pg_attribute"' errors in the postgresql log file. I cannot reindex
6
3165
by: sapsi | last post by:
Hello, I am using HadoopStreaming using a BinaryInputStream. What this basically does is send a stream of bytes ( the java type is : private byte bytes) to my python program. I have done a test like this, while 1: x=sys.stdin.read(100) if x: print x
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.