Solved

SQL ResultSet NotSerializableException

Posted on 1997-05-08
5
335 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
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ForLoop Example 3 52
How to convert from xls to xlsx using java 7 55
going to wrong jsp page 2 33
Notify sent to other threads in Java 9 33
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

839 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