Solved

SQL ResultSet NotSerializableException

Posted on 1997-05-08
5
320 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
5 Comments
 
LVL 1

Expert Comment

by:mlimotte
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Well, the class ResultSet doesn't implement the interface
Serializable.  Therefore you can't pass it thru RMI.

0
 

Expert Comment

by:exprd
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

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…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now