I'm running Catalina (TC4) as a servlet engine with IIS and I'm having
problems with object streaming. On the client side I have multiple threads
sending POST messages to the server, and on the server side I have a servlet
with a doPost catching the messages - all very standard. However, I often
get IOExceptions thrown on the client at out.close() and the message
'[Ajp13] bad read: -103' appears in the Catalina command window. I can't
find any information on the ajp bad read in the Tomcat documentation nor on
the web. The servlet doesn't implement SingleThreadModel so, theoretically,
a new servlet instance should be loaded for each doPost.
What is causing the bad read and why should out.close() throw an
IOException?
Many thanks for your help,
Cathy
Client:
private InputStream sendPostMessage(URL i_url) throws IOException
{
URLConnection con = i_url.openConnection();
// Prepare for both input and output
con.setDoInput(true);
con.setDoOutput(true);
// Turn off caching
con.setUseCaches(false);
// Set the content type to be java-internal/classname
con.setRequestProperty("Content-Type", "java-internal/" +
getClass().getName());
// Write the serialized object as post data
ObjectOutputStream out = new ObjectOutputStream(con.getOutputStream());
out.writeObject(this);
out.flush();
out.close();
return con.getInputStream();
}
Server:
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
ObjectInputStream in = new ObjectInputStream(request.getInputStream());
ObjectOutputStream out = new
ObjectOutputStream(response.getOutputStream());
MyObject obj = (APICall)in.readObject();
// do stuff with obj
}
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>