473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Servlet<->Applet - oreilly API and "invalid stream header"

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-e...et/ch10_02.htm of how to
construct e.g. a day time server, gives me:
java.io.StreamCorruptedException: invalid stream header

It happens right here:

InputStream in = msg.sendGetMessage(props); // (Have a look at the buttom
of this post to see what sendGetMessage returns)
ObjectInputStream ois = new ObjectInputStream(in);

The StreamCorruptedException occurs in attempt to create the ois object.

What kind of headers should i return, and where could the problem lie.

Please help
Nick
Reading from the InputStream:
[0] = -2
[1] = -70
[2] = -66
[3] = 0
[4] = 0
[5] = 0
[6] = 49
[7] = 0
[8] = 110
[9] = 10
[10] = 0
[11] = 26
[12] = 0
[13] = 52
[14] = 7
[15] = 0
[16] = 53
[17] = 10
[18] = 0
[19] = 2
[20] = 0
[21] = 52
[22] = 8
[23] = 0
[24] = 54
[25] = 8
[26] = 0
[27] = 55
[28] = 11
[29] = 0
[30] = 56
[31] = 0
[32] = 57
[33] = 8
[34] = 0
[35] = 58
[36] = 8
[37] = 0
[38] = 59
[39] = 10
[40] = 0
[41] = 60
[42] = 0
[43] = 61
[44] = 7
[45] = 0
[46] = 62
[47] = 11
[48] = 0
[49] = 56
....
[51] = 63
[52] = 10
[53] = 0
[54] = 10
[55] = 0
[56] = 64
[57] = 8
[58] = 0
[59] = 65
[60] = 8
[61] = 0
[62] = 66
[63] = 11
[64] = 0
[65] = 67
[66] = 0
[67] = 68
[68] = 10
[69] = 0
[70] = 69
[71] = 0
[72] = 70
[73] = 10
[74] = 0
[75] = 25
[76] = 0
[77] = 71
[78] = 10
[79] = 0
[80] = 10
[81] = 0
[82] = 72
[83] = 10
[84] = 0
[85] = 10
[86] = 0
[87] = 73
[88] = 11
[89] = 0
[90] = 56
[91] = 0
[92] = 74
[93] = 10
[94] = 0
[95] = 2
[96] = 0
[97] = 75
[98] = 10
[99] = 0
[100] = 76
....
[202]
Oct 27 '05 #1
1 7073
Using Tomcat as Java container caused the problem, I'm not quite sure why
the problem occurs, but using another container (w3c's) fixes the invalid
stream header exception.
An examination of the headers showed that there wasnt nothing wrong with
them.

Hopefully other programmers will benefit from this discovery.

Regards
Nov 3 '05 #2

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

Similar topics

40
by: post400 | last post by:
Hi, there is another famous book 'Writing solid code' but does it apply to Python ? Or it's usable only by Microsoft C programmers ? The author seems to be an ex-Microsoft guy ! Thanks ,...
3
by: Patrick | last post by:
Hi I am currently learning JS and have heard a lot of good about that book even if it's a reference and better suited for intermediate to experienced users. My local bookstore has both the 3rd...
7
by: gene tani | last post by:
http://radar.oreilly.com/archives/2005/08/codezoo_program_1.html http://python.codezoo.com/ Nice to see that python is in-demand, but what is the rationale for another ASPN cookbook/Parnassus...
1
by: andrewcw | last post by:
OK I am half way there - I can manipulate the stream without the byte issue like this - but is this the way to push the new values back into the stream & write out the stream without resorting to...
5
by: andrewcw | last post by:
I have an object to serialize. TextWriter writer = new StreamWriter("test.xml"); serializer.Serialize(writer,obj); writer.Close(); but below does not, why ?? I have a file that I will have...
3
by: MJB | last post by:
I'm getting an IStream back from function xmlHttp.responsestream. I would like to convert this to a System.IO.Stream in order to work with it in my application. Has anyone encountered this and...
4
by: TT (Tom Tempelaere) | last post by:
Hey there, I need a string stream, but I can't find one in .NET. I thought StringWriter would derive from Stream, alas it doesn't do so. Which leads me to my next question: What is the purpose...
8
by: Marc Gravell | last post by:
I want to write a method that will accept a stream as a parameter, and which will write xml to the stream (based in reality on database results) using the XmlTextWriter class. However, this insists...
3
by: sven.suursoho | last post by:
Hello, In main(), the first output API is what I try to achieve. Unfortunately it fails, printing first string as pointer instead of human readable message. Tried to initialize str(""), set new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.