Applet Servlet Communication in NES using Object Serialization

Applet Servlet Communication in NES using Object Serialization

Post by Amar Sha » Fri, 14 Apr 2000 04:00:00



Hi , I am having a serious problem trying to send an object to the NES
server using ObjectOutputStream. I create a URL for the servlet
                    and then set the SETDoOutput(true) on the URLConnection
object . Now I create a ObjectOutputStream from the the URLConnection
                    Object and write a simple string to the servlet. The
problem happens when the servlet is trying to read the Object(String). It
generates a
                    streamCorrupted exception as follows:

                    failure (16079): Internal error: exception thrown from
the servlet service function (uri=/servlet/AjayServlet):
                    java.io.StreamCorruptedException: Caught EOFException
while reading the stream header, Stack: java.io.StreamCorruptedException:
                    Caught EOFException while reading the stream header at
java.lang.Throwable.fillInStackTrace(Native Method) at
                    java.lang.Throwable.fillInStackTrace(Compiled Code) at
java.lang.Throwable.(Compiled Code) at
                    java.lang.Exception.(Exception.java:42) at
java.io.IOException.(IOException.java:47) at

java.io.ObjectStreamException.(ObjectStreamException.java:29) at

java.io.StreamCorruptedException.(StreamCorruptedException.java:30) at

java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:727) at
java.io.ObjectInputStream.(ObjectInputStream.java:165)
                    at AjayServlet.doPost(AjayServlet.java:15) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:538) at

javax.servlet.http.HttpServlet.service(HttpServlet.java:611) at
com.netscape.server.http.servlet.NSServletRunner.Service(Compiled
                    Code)

                    This Servlet runs fine on JavaWebServer2.0. The servlet
also runs fine if I write the string using DataInputStream from the applet
and read
                    it on the servlet from DataOutputStream. Iam also able
to return a String object from the server to the applet using
ObjectOutputStream
                    but the problem is with reading the object sent to the
servlet.

                    Please Help.

                    Thanks in advance.

 
 
 

1. Serialization of objects stored persistently (and use of the transient modifier) sent to an applet

Forwarding on below email to this group as well...knowing that the diamond
in the rough could be here too...

Hi all,

Have couple of questions for the ObjectStore and Pattern experts out there.
So here is a detailed account of my current situation (in psuedo-pattern
catalogue detail).

Problem:
How to transfer over a persistent object via serialization but without
recursively serializing particular referred objects within the persistent
object (i.e., using transient modifier) so as not to inundate network
traffic to the end client where the applet will receive this serialized
object.

Participants:
* Applet (end client)
 - awaiting transfer of serialized object.
 - will make necessary calls for new serialized objects

* Serializable object
 - lightweight when serialized so as not to inundate traffic if associated
  object has thousands of recursive objects underneath it (i.e., this
  object is a Composite type object).
 - stored in the ObjectStore database (including all its children objects)

* ObjectStore (OO Database)
 - store the Serializable object and all its object references (recursively
of course).

Environment:
ObjectStore 5.1 (OSJI 1.3) running on Windows NT Workstation 4.0

Sample Code:
/**
 * Simple test class demonstrating what I want to do but not sure if it will
 * achieve my objectives.
 */
import COM.odi.util.*;

public class Test implements Serializable {
 Test() {
 }

 private transient OSVector list;

 //yadda, yadda...other fields and methods of interest that we do want
 //serialized

Questions:
1. First (for the ObjectStore experts), will the transient list object be
properly stored into ObjectStore?  Basically, I want to have Test class be
persistent capable class.  And I DO want the associated list object to be
stored in the database as well.

2. Second (for Patterns or ObjectStore experts), is this the best way to do
this?  A colleague of mine mentioned something about creating a Proxy type
class that I transfer down to the applet.  Would this be a better solution?
Any other ideas about how to transfer over a persistent object via
serialization but without killing the network traffic to the end client
where the applet will receive it?

Many thanks in advance,

J.D.

--
J.D. Fagan
2Bridge Software

2. US-NY-NYC: C/C++/Sybase, major bank

3. Problem with Applet Servlet communication

4. Jobs In SQL Server

5. Servlet and Applet Communication

6. "Table must be declared" in procedure?

7. applet to servlet communication

8. Delphi 1.0/Access 1.1 via ODBC

9. http communication between applet and servlet

10. Communication Servlet-Applet

11. Applet-Servlet Communications.

12. http communication between applet and servlet

13. Applet-Servlet communications