Solved

SQL ResultSet NotSerializableException

Posted on 1997-05-08
5
347 Views
Last Modified: 2008-02-26
I got this exception while trying to pass a ResultSet object by rmi. My version of JDK is 1.0.2 and I have the last rmi version for JDK 1.0.2.

This is the execption -->

rmiClient exception: Error unmarshaling return; nested exception is:
        java.io.WriteAbortedException: Writing aborted by exception; java.io.Not
SerializableException: sun.jdbc.odbc.JdbcOdbcResultSet
java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
        java.io.WriteAbortedException: Writing aborted by exception; java.io.Not
SerializableException: sun.jdbc.odbc.JdbcOdbcResultSet
        at domtar.server.rmiServer_Stub.getResultSet(rmiServer_Stub.java:65)
        at domtar.client.rmiClient.getResultSet(rmiClient.java:57)
        at Client.executeQuery(Client.java:258)
        at Client.start(Client.java:247)
        at sun.applet.AppletPanel.run(AppletPanel.java:271)
        at java.lang.Thread.run(Thread.java:294)
java.lang.NullPointerException
        at Client.fillGridSecteur(Client.java:309)
        at Client.executeQuery(Client.java:260)
        at Client.start(Client.java:247)
        at sun.applet.AppletPanel.run(AppletPanel.java:271)
        at java.lang.Thread.run(Thread.java:294)
0
Comment
Question by:pjroy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Expert Comment

by:mlimotte
ID: 1220257
I believe that the ResultSet object keeps an open cursor to the database.  It does not load in the complete contents of the query, and therefore, can not be serialized (all the data is not available).  

As a work around, try loading all the data into a common data structure (an array or vector).
0
 
LVL 1

Expert Comment

by:mlimotte
ID: 1220258
I believe that the ResultSet object keeps an open cursor to the database.  It does not load in the complete contents of the query, and therefore, can not be serialized (all the data is not available).  

As a work around, try loading all the data into a common data structure (an array or vector).
0
 
LVL 6

Expert Comment

by:jpk041897
ID: 1220259
For what its worth, marshaling is the proces by which the client and server guarantee that data is being transfered in a safe and compatible manner.

An unmarhaling exeption is usualy cast when when you have IDL level incompatibilities between the client and the server. (integer size for exaple).

In DB oriented apps, it can also be cast when you bind local variables to SQL columns that do not match. (Java 2-byte chars to SQL 1 byte chars for instance.)

Now if the error is actualy related to the serialization process (and is not appearing as a side effect of an IDL definition error). Than Java is trying to serialize a value of one data type but actualy obtaining a value of another.

Hope this helps to gain an insight into the problem.
0
 

Accepted Solution

by:
rkin005 earned 0 total points
ID: 1220260
Well, the class ResultSet doesn't implement the interface
Serializable.  Therefore you can't pass it thru RMI.

0
 

Expert Comment

by:exprd
ID: 2205006
Since the Resultset is not serialiazable, it looses it's state while been transfered from server to client. So, put the values from resultset to a vector since u don't know the size of the resultset , vector is recomended, and send.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question