hi all, maybe someone can give me a hint where to start searching my problem?
i send a http post request to a remote server. that server then reads a url (a file) on my server and processes the text in it. as a result i get a response. here is my code:
the remote script obviously does read and processes my data, some output is generated. but it stops at some point and throws this exception:
java.io.EOFException at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2502) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1267) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339) ...
what could be the reason for this exception? the file on my server is intact. does the script on the remote server not work properly?
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2502) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1267) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339) hey 2502,1267,339 has relation with which line in your source?
hi, you are right, i use some more code and i guess that's where the problem is. i actually have two servlet classes: a "broker"-servlet who sends a http-message to a "communication"-servlet i mentioned above. the second one does the actual communication to the remote server. i think the communication between my own servlets fails. the exception refers to the broker-servlet.
obviously the ObjectInputStream in brokeRequest is the problem. do i have to create an ObjectOutputStream in doRemoteRequest? i would like to let the broker know if the request succeeded. how would i do this?
In order to use an ObjectInputStream to read an object, you must use an ObjectOutputStream to write an object (see here for a tutorial). What exactly does your URL reference? Also, you say broker-servlet and communication-servlet are servlets, but they do not appear to implement the Servlet interface or its sub-interfaces. Do you understand how HTTP and Servlets work?
yes, the classes do extend HttpServlet, i only left out the irrelevant stuff. i think i understand what servlets do, though i am certainly not an expert. i'm not that familiar with http. thanks for the tutorial. i'll try to understand the ObjectOutputStreams. L