Read a field of a serialized object

Hi,
is-it possible to read separately a field of a serialized object? By exemple, if I serialize an object that contains a String field, can I read only this String field?
Thanks
Jean

You can do so, if you re-implement Java's serialization spec. That or overload readObject() and wait for your individual field to come in, trap the result and forward it on.
As you can see from either of these alternatives, there is not a good way to do this. It's like asking 'how can I get an XML fragment from a file?" That task is, on the face of it, far easier. But it equally does not make sense.
If you have control over the serialization, and you have a key lookup field, serialize it separately in an index-like file or serialize it ahead of Java's serialization in the same file.
- Saish
"My karma ran over your dogma." - Anon

Similar Messages

  • Can't read all attribute of my serialized object

    Hello everybody,
    I've got a problem with my program. I try to serialized a MutableTreeNode root in order to save and then open my JTree.
    I serialize it and i have no problem but when i open it the parent hierarchy is saved (x is son of y...) but their name are null. I loose nodes' name... :/
                   try {
                        //Je cr�e un fichier temporaire dans le r�p�rtoire courant
                        //Ce fichier est l'arbre (selection de l'utilisateur) serializ�
                        //Flux cr�ant un fichier
                        FileOutputStream fos = new FileOutputStream(this.path);
                        //Flux dans lequel je stocke un objet
                        ObjectOutputStream oos = new ObjectOutputStream(fos);
                        //J'�cris dans mon flux mon objet
                        System.out.println("root before drag = "+this.root); 
                        oos.writeObject(this.root);
                        //On ferme le flux
                        oos.flush();
                        fos.close();
                   } catch (FileNotFoundException e1) {
                        System.err.println("FileNotFoundException");
                        e1.printStackTrace();
                        return null;
                   } catch (IOException e1) {
                        System.err.println("IOException");
                        return null;
                   } catch (ClassCastException e1) {
                        System.err.println("ClassCastException");
                        return null;
                   try {
                        FileInputStream fos = new FileInputStream(this.path);
                        ObjectInputStream oos = new ObjectInputStream(fos);
                        //J'�cris dans mon flux mon objet
                        MutableTreeNode sousArbre = (MutableTreeNode) oos.readObject();
                        //On ferme le flux
                        fos.close();
                        //On r�cup�re l'arbre
                        System.out.println("root after drag = " + sousArbre);
                        this.root = sousArbre;
                        modele = new DefaultTreeModel(root);
                        Arbre.setModel(modele);
                        Aide a = new Aide(Arbre);
                   } catch (FileNotFoundException e1) {
                        System.err.println("FileNotFoundException");
                        e1.printStackTrace();
                   } catch (IOException e1) {
                        System.err.println("IOException");
                        e1.printStackTrace();
                   } catch (ClassNotFoundException e1) {
                        System.err.println("ClassNotFoundException");
                        e1.printStackTrace();
                   } catch (ClassCastException e1) {
                        System.err.println("ClassCastException");
                        e1.printStackTrace();
                   }so:
    System.out.println("root before drag = "+this.root);
    return node name
    Mais :
    System.out.println("root after drag = " + sousArbre);
    return null
    Have you an idea ?
    Thx :)

    Please check your Node Object, I mean all Objects that you are going to save is serialized or not.

  • [ORA-22905] How to read a field of an object inside another object?

    Greetings,
    I'm a student and in a current exercise we have to work with the Object Oriented Programming functionality of Oracle.
    In the database we defined an object type, which is then considered inside another object type. The thing is, that I cannot read an attribute of the inner object. I've read tens of websites but none of them have helped so far. I've read the PL/SQL User Guide and Reference document also.
    The inner object is defined as follows:
    create type address_t as object (
            street varchar(50),
            city varchar(50),
            pcode number(5,0)
            );The outer object has an object of type address_t inside it:
    CREATE TYPE professor_t as OBJECT(
              code number(2),
              p_name varchar(50),
              address address_t,
              );Also, there is a table named PROFESSORS that stores objects of type professor_t
    First of all, with a simple testing SQL statement I can see the data inside the object professor, even the object address_t:
    SELECT * FROM PROFESSORS WHERE CODE = 13;returns the following:
    CODE    |         NAME      |       ADDRESS
    13      |         JOHN     |       MYSCHEMA.ADDRESS_T('FIFTH AVENUE','NEW YORK',12345)The thing is, I want to read the field street of the object address (of type address_t) inside professor (of type professor_t).
    I could see everywhere that the way to go is to use point notation, and I've seen examples about the command VALUE, but none of the following SQL statements work:
    SELECT VALUE(ADDRESS.STREET) FROM(
      SELECT CODE,P_NAME,ADDRESS FROM PROFESSORS WHERE CODE = 13);
    SELECT ADDRESS.STREET FROM PROFESSORS WHERE CODE = 13;
    SELECT PROFESSOR.ADDRESS.STREET FROM PROFESSORS WHERE CODE = 13;I'd really appreciate if someone could show me how to access the values of the field of the object inside an object.
    Thanks in advance,
    - David
    Edited by: 858176 on May 11, 2011 6:53 PM Formatting

    Great, this worked so far.
    It is curious that you wrote 'profesores' but that is the actual name for the variable. I translated everything to english in order to post it here.
    So, the statement is:
    select value(t).DIRECCION.CIUDAD from profesores t;And It returned:
    VALUE(T).DIRECCION.CIUDAD                         
    Valencia                                          
    New York
    TijuanaAnd, applying the VALUE command to the statement:
    select codigo,
    nombre,
    value(t).DIRECCION.CALLE,
    value(t).DIRECCION.CIUDAD,
    value(t).DIRECCION.CP
    from profesores T WHERE T.CODIGO = 13;Resulting in:
    CODIGO                 NOMBRE                                             VALUE(T).DIRECCION.CALLE                           VALUE(T).DIRECCION.CIUDAD                          VALUE(T).DIRECCION.CP 
    13                     Pepito Pérez                                       Calle de los Rosales 0                           Valencia                                           46023                  That is EXACTLY what I needed.
    Thanks Thomas, It was really helpful !
    Edited by: 858176 on May 11, 2011 7:46 PM

  • Error: This item must be open to read this field while trying to access field of WI using Object Model

    Hi there,
         I'm trying to access few fields for example Description, History,Repro Steps etc. ,but I get error as
    Error: This item must be open to read this field.
    How do i fix this?
    Thanks,
    Anu

    WorkItem.Open() ?
    There is no open() method for workitem
    is there any other solution?
    Thanks
    Anusha

  • Creating a converter for old serialized objects

    Hi,
    I have an application, which writes class objects to file, and then reads the class objects from file when the application is started up.
    Now the problem is, that if i create/modify/etc fields in the class, then all my data is lost (i.e., i cant read the data in when the application starts)....
    Now the docs state that a field can be added, and an old serialized object will still be recoverable...well for some reason this only works when it wants....i have tried several times, and its not a guarenteed thing....
    So i was wondering, is there any way to create an application, which can grab an old serialized version of an object (i.e. class), have a copy of the old class, and the new class, and somehow cast the old to the new...or something of that sort?
    thanks a lot!

    This might be of some help:
    http://www.onjava.com/pub/a/onjava/excerpt/JavaRMI_10/?page=5

  • How to divide big serialized object in parts to be able to save as Blob typ

    Hi,
    Actually i have serialize a big XML document object and want to save in a field of type Blob. As Blob size is 64k. So if the serialized object is greater than 64k. It gives me error of size.Can anybody tell how to break large serialized objects.
    I am using this code
    File f = new File("out.ser");
    FileInputStream fin = new FileInputStream(f);
    p = farCon.prepareStatement("insert into TeeColor values('3',?)");
    p.setBinaryStream(1, fin, f.length());
    p.executeUpdate();
    This code works fine if the size of out.ser file is less than 64k. But does not work for bigger sizes
    Please help me out
    Thanks

    Read your data from the file into a byte array, then extract 64K at a time into a smaller byte array, and use a ByteArrayInputStream for updating the database.

  • Reducing Size of Serialized Object

    Does anyone know how to crunch the size of the serialized object? My serialized objects are exceeding 20 megabytes and it's going to cost a lot of bandwidth transfers within our network.
    Thanks. :-)

    Make any fields transient that you can compute on the other side. If they're still too big after zipping them you may have to use another mechanism other then serialization: extract the minimum necessary data to create the objects and send it over using your own protocol.
    I should note that most modems all ready do hardware compression so compressing it yourself may not improve performance much.

  • A General serialized object

    Hi!
    I'm trying to create some server software that will allow any number of applets to connect to the server and communicate with each other. Presumably, only applets of the same type would talk together, though applets could send general string messages. I've created a general serialized object, Packet, which all applets would send to the server, and which the server would then pass on to the destination applet(s).
    The problem is that Packet has a field "data" of type Object. When data is something the server knows about, such as a String or a Vector, it does ok. But if the code for the applets creates a new class, say AppletPacket (which is serializable), and sets somePacket.data to an object of type AppletPacket, the server throws errors when it is reading the somePacket from its objectinputstream, saying it can't typecast something of type AppletPacket. But I'm not typecasting anywhere! The server doesn't have to know anything about what data represents, it just needs to send it on, and presumably the destination applets will know what to do with it.
    Can anyone suggest a work around, or tell me what I have to do so that applets can send a general Object that may represent a class the server doesn't know about and not have the server throw an error?
    Thanx
    Jim D.

    Just to clairify: The server doesn't have to do anything with the content of "data" apart from holding on to it, and pass it to another applet?
    If that's the case substitute the Object in the "data" field for an array of bytes obtained by having the applet run the "Object" through ObjectOutputStream.
    What's happening is that the server is deserializing the Packet when it arrives in the JVM of the server, when it comes across the "data" field it looks to see what class the instance really is, and fails as you dscribe if it doesn't have the class definition.

  • Losing field (in a Composit Object) in an HttpSession

    Hello. I am losing fields in a Composite object (object tree) that I am storing inside of an HttpSession. I'm developing with Tomcat and I saw that Tomcat implements the put/getAttribute methods with a Hashtable.
    So in my case, I store object A. in an HttpSession. For a user requests, I get A. and do some processing that sets object D. If I put that object back into the session and come back to it in a later request, object D has now been lost.
    A
    B
    C
    D
    Is there some contract that I'm missing here? I don't think these objects (A - D) need to be serialized. What am I missing here?
    Thanks in advance
    Tim

    It is very difficult to figure out what is going wrong from the info u have given. Examine your server log carefully if you can find any clue.
    You may also write a listener implementing HttpSessionAttributeListener and implement the methods
    attributeAdded(HttpSessionBindingEvent) ,attributeRemoved(HttpSessionBindingEvent) ,attributeReplaced(HttpSessionBindingEvent) to write some meaningful message in logs.
    Track the message generated by attributeRemoved() method in particular to find out when exactly is your object D going out of session. May be that will give u some clue. You can use HttpSessionBindingEvent.getName() and
    HttpSessionBindingEvent.getValue() methods to know about the object added/removed/reset in your session that has invoked the particular method in your listener.
    Also you will need to register the listener class in your web.xml for that to work properly.
    You will find more examples/help of this listener in net if u do a google search.

  • Bizarre ClassCastException when sending serialized objects

    I have two programs communicating with each other over a network using TCP and serialized objects. One of the programs uses an ObjectOutputStream to send the message, and the other uses an ObjectInputStream to receive it. The receiver has a thread that simply loops, receiving and processing messages one at a time.
    Under normal circumstances, this works fine. However, sometimes the sender program has to send more than one message, one right after the other. I guess my assumption was that on the receiving end, they would somehow just "queue up" in the ObjectInputStream and the receiver would be able to read them one at a time. But instead, I get this bizarre ClassCastException whose message talks about members and objects from both messages that were sent. It is as though somehow the two objects received are being mangled together and interpreted somehow as one object. This is strange to me, since I am pretty sure TCP is supposed to guarantee in-order delivery of packets.
    Can I not send multiple messages right after each other through an ObjectOutputStream and have them received in an ObjectInputStream? If not, what would be a good workaround?
    If you need more details, it works like this. I have two classes that look like this:
    class Class1 extends SerializableSuperclass
      Member1 m1;
    class Class2 extends SerializableSuperclass
      Member2 m2;
    }Sender sends an instance of Class1 and then immediately an instance of Class2. Receiver attempts to readObject() from the input stream and gets this exception:
    Exception in thread "Thread-4" java.lang.ClassCastException: cannot assign instance of Class2 to field Class1.m1 of type Member1 in instance Class1
    Isn't that bizarre? Two separate classes, and it is attempting to merge the two in some odd way.
    How do I fix or work around this?
    Thanks

    These classes do not have those methods. They are simply message classes designed to hold data. Do you need to see the methods that call ObjectOutputStream's writeObject() and ObjectInputStream's readObject() methods?
    The serializable superclass is there because it has other stuff including a field identifying the sender. It's basically a base message class.
    Also, the member classes are serializable (serializability isn't the issue anyway; "class cast" is the issue).

  • Static fields ARE being serialized

    Hi there,
    I wrote a small test class that serializes an object, writes the serialized object to file, read the serialized object from the file and then deserialize the object. The object being serialized contains normal fields, a transient field, and a few 4 static fields with varying access modifiers. For some reason the static variables ARE being serialized. From what I've read this should not happen, and for very good reasons.
    Here is the object being serialized:
    package serialization;
    import java.io.Serializable;
    import java.util.Formatter;
    public class MySerializableObject implements Serializable {
         private static final long serialVersionUID = 1L;
         private int a = 1;
         private int b = 2;
         private transient int c = 3;
         static public int d = 4;
         static protected int e = 5;
         static private int f = 6;
         static int g = 7;
         @Override
         public String toString() {
              Formatter formatter = new Formatter();
              formatter.format("a=%1$s b=%2$s c=%3$s d=%4$s e=%5$s f=%6$s g=%7$s", a,b,c,d,e,f,g);
              return formatter.toString();
         public void setNewD(int newVal) {
              d = newVal;
    }And here is the code that does the serialization:
    package serialization;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    public class FileContentsObjectSerializer {
         File file;
         public FileContentsObjectSerializer(String name) {
              this.file = new File(name);
              if (this.file.exists()) {
                   this.file.delete();
              try {
                   this.file.createNewFile();
              } catch (IOException e) {
                   e.printStackTrace();
         public void serialize(Object o) throws IOException {
              FileOutputStream fos = new FileOutputStream(this.file);
              ObjectOutputStream oos = new ObjectOutputStream(fos);
              oos.writeObject(o);
              oos.close();
              fos.close();
         public Object deserialize() throws IOException, ClassNotFoundException {
              FileInputStream fis = new FileInputStream(this.file);
              ObjectInputStream ois = new ObjectInputStream(fis);
              Object o = ois.readObject();
              fis.close();
              ois.close();
              return o;
         public static void main(String args[]) {
              MySerializableObject mso = new MySerializableObject();
              mso.setNewD(100);
              System.out.println("Object being serialized:"+mso.toString());
              FileContentsObjectSerializer ofs = new FileContentsObjectSerializer("c:/temptest.txt");
              try {
                   ofs.serialize(mso);
                   MySerializableObject result = (MySerializableObject) ofs.deserialize();
                   System.out.println("Deserialized Object:    "+result.toString());
              } catch (Exception e) {
                   e.printStackTrace();
    }And here is the results I get:
    Object being serialized:a=1 b=2 c=3 d=100 e=5 f=6 g=7
    Deserialized Object:    a=1 b=2 c=0 d=100 e=5 f=6 g=7As you can see, both results are exactly the same, even though the setNewD value is not called on the deserialized object.
    Any ideas?

    You are misinterpreting the result. Try this main instead:
        public static void main(String args[]) {
            MySerializableObject mso = new MySerializableObject();
            mso.setNewD(100);
            System.out.println("Object being serialized:"+mso.toString());
            FileContentsObjectSerializer ofs = new FileContentsObjectSerializer("c:/temptest.txt");
            try {
                ofs.serialize(mso);
                mso.setNewD(-100); //a-oogah!
                MySerializableObject result = (MySerializableObject) ofs.deserialize();
                System.out.println("Deserialized Object:    "+result.toString());
            } catch (Exception e) {
                e.printStackTrace();
        }

  • FileUpload problem: InputStream does not contain a serialized object

    Hi All,
    I'm using the FileUpload component in a JSPDynPage and the htmlb component seems to work fine but I cannot read the file (InputStream). I get the following error(IOException): "InputStream does not contain a serialized object".
    Please let me know what is wrong with my code. This is a part of the code I used:
    public FileInputStream sourceFileInput;
    public ObjectInputStream input;
    FileUpload fu;
    fu = (FileUpload) this.getComponentByName("myFileUpload");
    IFileParam fileParam = ((FileUpload) getComponentByName("myFileUpload")).getFile();
    File f       = fileParam.getFile();
    file         = fu.getFile().getFile();
    absolutepath = fu.getFile().getFile().getAbsolutePath();
    this.sourceFileInput = new FileInputStream(file);
    input = new ObjectInputStream(sourceFileInput);
    The last line of code seems to generate te error.

    Hi,
    I have found the answers, thank you both.
    (I included the examle code. Perhaps of some use to someone.)
    FileUpload fu;
    fu = null;
    fu = (FileUpload) this.getComponentByName("myFileUpload");
    //       this is the temporary file
    if (fu != null) {
         IFileParam fileParam = ((FileUpload) getComponentByName("myFileUpload")).getFile();
         if (fileParam != null) {
              // get info about this file and create a FileInputStream
              File f = fileParam.getFile();
              if (f != null) {
                   try {
                        fis = new FileInputStream(f);
                   // process exceptions opening files
                   catch (FileNotFoundException ex) {
                        myBean.setMessage(
                             "1" + f + ex.getLocalizedMessage());
                   isr = new InputStreamReader(fis);
                   br = new BufferedReader(isr);
    String textLine = "";
    do {
         try {
              textLine = (String) br.readLine();
         } catch (IOException e) {
              myBean.setMessage(
                   "1" + e.getLocalizedMessage());
         // Jco append table & put data into the record
         // (I_FILE is the table with txt data that is sent to the RFC)
         I_FILE.appendRow();     
         I_FILE.setValue(textLine, "REC");                              
    } while (textLine != null);

  • StreamCorruptedException: does not contain a serialized object?

    Can someone tell me why am I getting this exception:
    C:\javapr>java FetchObject
    Couldn't retrieve binary data: java.io.StreamCorruptedException: InputStream
    does not contain a serialized object
    java.io.StreamCorruptedException: InputStream does
    not contain a serialized object
    at java.io.ObjectInputStream.readStreamHeader
    (ObjectInputStream.java:849)
    at java.io.ObjectInputStream.<init>
    (ObjectInputStream.java:168)
    at FetchObject.main(FetchObject.java:23)
    import java.sql.*;
    import java.util.*;
    import java.io.*;
    class FetchObject implements Serializable {
        public static void main (String[] args) {
            try {
                String driver = "oracle.jdbc.driver.OracleDriver";
                Class.forName(driver);
                String url = "jdbc:oracle:thin:@mymachine:1521:homedeva";
                Connection conn = DriverManager.getConnection(url,"cnn","cnn");
                FetchObject i = new FetchObject();
                    // Select related
                    try
                         byte[] recdBlob = i.selectBlob( 1 , conn ); 
                         ByteArrayInputStream bytes = new ByteArrayInputStream(recdBlob);
                         ObjectInputStream deserialize = new ObjectInputStream( bytes );
              Employee x = (Employee)deserialize.readObject();
                    catch( Exception ex )
                  System.err.println("Couldn't retrieve binary data: " + ex);
                  ex.printStackTrace();
         catch( Exception ex )
              ex.printStackTrace();
        public byte[] selectBlob( int id, Connection conn )
         byte[] returndata = null;
         try
              Statement stmt = conn.createStatement();
              String sql = "SELECT id, rowdata FROM blobs WHERE id = " + id;
              ResultSet rs = stmt.executeQuery(sql);
              if ( rs.next() )
                           try
                               ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
                               BufferedInputStream bis = new BufferedInputStream( rs.getBinaryStream("rowdata") );
                             byte[] bindata = new byte[4096];
                               int bytesread = 0;
                               if ( !rs.wasNull() )
                                       if ( (bytesread = bis.read(bindata,0,bindata.length)) != -1 )
                                          baos.write(bindata,0,bytesread);
                                returndata = baos.toByteArray();
                             baos.flush();
                                bis.close();
                       catch ( Exception ex )
                            System.err.println("Problem retrieving binary data: " + ex);
                        rs.close();
                         stmt.close();  
               catch ( Exception ex )
                    System.err.println("Couldn't retrieve binary data: " + ex);
            return returndata;
    import java.io.*;
    class Employee implements Serializable
         private String lastName;
         private String firstName;
         public Employee(String lastName, String firstName)
              this.lastName = lastName; 
              this.firstName = firstName;
    }

    To clarify I have stored an Employee Object as a Blob in the Oracle database and am attempting to retreive the
    Employee Object from this Blob.
    Thanks

  • Field Validation on Read Only Field

    I'm trying to create a pop up error box if a field contains null values. The problem is that the field I'm trying to do the validation on is a read-only field. It's the Account field on the Contact Object or Module. It won't allow me to include validation. The goal here is to have a POP UP ERROR box come up if someone does not select a value for that field. Making it required doesn't generate a popup box, it only has a small "required" text next to the field which can be easily missed by a user. Any ideas?

    Hi !
    I found the way to do what you wan't, but it sounds a bit strange for me...
    You have to put a field validation on the Account Id field. I made some tests to know what is in the AccountId field when it's blank and i see that the value is "No Match Row Id" !!
    So your validation rule must be simply
    *&lt;&gt; "No Match Row Id"*
    It worked for me, the error message appears... But I think this is something we have to report to Oracle...
    Hope this will help, feel free to ask more !
    Max

  • Java.io.StreamCorruptedException: InputStream does not contain a serialized object

              I have an applet which calls a JSP to write data object to the db and then the
              JSP sends back the updated data object. The writing part is ok but the response
              is giving the following error. The data object is in a separate class which implements
              Serialized.
              Here's the code in the applet calling the JSP and the response from the JSP
              URL server = null;
              String urlConnectionString = "http://localhost:7001/isLoginValid.jsp";
              try
              server = new URL(urlConnectionString);
              catch(MalformedURLException e)
              System.out.println("URL exception: " + e );
              // send request
              ObjectInputStream response = null;
              Object result = null;
              try
              URLConnection conn = server.openConnection();
              conn.setDoOutput(true);
              conn.setUseCaches(false);
              conn.setRequestProperty("Content-Type", "application/octet-stream");
              ObjectOutputStream request = new ObjectOutputStream(new
              BufferedOutputStream(conn.getOutputStream()));
              request.writeObject((Object)dvo);
              request.flush();
              request.close();
              // get the result input stream
              response = new ObjectInputStream(new BufferedInputStream
              (conn.getInputStream()));
              // read response back from the server
              result = response.readObject();
              if( result!=null && (result instanceof DataVO))
              dvo = (DataVO)result;
              String vo = dvo.printDataVO();
              System.out.println("*DataVO*\n"+vo);
              else
              System.out.println("not an instanceof DataVO");
              catch(IOException ignored)
              System.out.println("Error in DataVO response");
              ignored.printStackTrace();
              Here's the code in the JSP sending the response back to the applet. The 'dvo'
              object is the object which is serialized and has gets and sets for the diff. data
              elements. When I print the 'dvo' before writing the object to outputStream it
              prints the correct values for the data element.
              // send response
              response.setStatus(HttpServletResponse.SC_OK);
              ObjectOutputStream outputStream = new ObjectOutputStream (new BufferedOutputStream
              (response.getOutputStream()));
              outputStream.writeObject(dvo);
              outputStream.flush();
              ERROR is as follows:
              Error in DataVO response
              java.io.StreamCorruptedException: InputStream does not contain a serialized object
              at java/io/ObjectInputStream.readStreamHeader
              at java/io/ObjectInputStream.<init>
              What am I doing wrong?. Please respond soon. The applet is run on IIS and the
              JSP in on weblogic 6.1. I'm not sure if that makes any difference.
              

              I have an applet which calls a JSP to write data object to the db and then the
              JSP sends back the updated data object. The writing part is ok but the response
              is giving the following error. The data object is in a separate class which implements
              Serialized.
              Here's the code in the applet calling the JSP and the response from the JSP
              URL server = null;
              String urlConnectionString = "http://localhost:7001/isLoginValid.jsp";
              try
              server = new URL(urlConnectionString);
              catch(MalformedURLException e)
              System.out.println("URL exception: " + e );
              // send request
              ObjectInputStream response = null;
              Object result = null;
              try
              URLConnection conn = server.openConnection();
              conn.setDoOutput(true);
              conn.setUseCaches(false);
              conn.setRequestProperty("Content-Type", "application/octet-stream");
              ObjectOutputStream request = new ObjectOutputStream(new
              BufferedOutputStream(conn.getOutputStream()));
              request.writeObject((Object)dvo);
              request.flush();
              request.close();
              // get the result input stream
              response = new ObjectInputStream(new BufferedInputStream
              (conn.getInputStream()));
              // read response back from the server
              result = response.readObject();
              if( result!=null && (result instanceof DataVO))
              dvo = (DataVO)result;
              String vo = dvo.printDataVO();
              System.out.println("*DataVO*\n"+vo);
              else
              System.out.println("not an instanceof DataVO");
              catch(IOException ignored)
              System.out.println("Error in DataVO response");
              ignored.printStackTrace();
              Here's the code in the JSP sending the response back to the applet. The 'dvo'
              object is the object which is serialized and has gets and sets for the diff. data
              elements. When I print the 'dvo' before writing the object to outputStream it
              prints the correct values for the data element.
              // send response
              response.setStatus(HttpServletResponse.SC_OK);
              ObjectOutputStream outputStream = new ObjectOutputStream (new BufferedOutputStream
              (response.getOutputStream()));
              outputStream.writeObject(dvo);
              outputStream.flush();
              ERROR is as follows:
              Error in DataVO response
              java.io.StreamCorruptedException: InputStream does not contain a serialized object
              at java/io/ObjectInputStream.readStreamHeader
              at java/io/ObjectInputStream.<init>
              What am I doing wrong?. Please respond soon. The applet is run on IIS and the
              JSP in on weblogic 6.1. I'm not sure if that makes any difference.
              

Maybe you are looking for

  • What should the read in/outs normally be for a Raptor?

    Hi, I installed a 80g Raptor a couple days ago as my start-up disk and had to clone my old HD to the new. After keeping an eye on Act. Monitor it looks like the Raptors data in/outs is not consistently fast (it will hit 40mb/s but usually stays in re

  • Width BarCode

    Hello everybody, I need a little help. I'm putting together a SapScript based J_1B_BOLETO_ITAU first problem was with the printing of bar code, because it does not leave. Now this DLL and prints to set straight the test of SO10, however Boleto both t

  • No HspEssbaseEnv in java.library.path (Planning + Weblogic + JRockit)

    Hello! When I'm running Planning in 64-bit JRockit JVM in SPARC box, аfter initialization EssBase API, in the log I get the following error: java.lang.UnsatisfiedLinkError: no HspEssbaseEnv in java.library.path at java.lang.ClassLoader.loadLibrary(Cl

  • Artist picture not showing.

    So, I realised that the artist picture that shows up in your library is actually the picture from the iTunes Store. I've purchased songs from artists that have a "profile" picture but when the song goes in my iPod, the album cover shows up instead of

  • ADF search with af:tree

    Hi all, I am trying to display data from the join of 6 tables. The data should be displayed according to the hierarchy of parent to child table..as in grandfather >> father >> child I want to implement it by using tree search af:tree or af:treetable.