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
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]
Nick Nygaard - 03 Nov 2005 19:51 GMT
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