Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can't serialize object



Hello,

After a couple of fruitless days trying to solve this problem, I now turn to
my most trusted resource: this list.

I'm using Java 1.5.0 and Netbeans 5.0. I'm running on Mac OS X 1.4.7, with a
G5 dual processor PPC (1.8GHz.)

I've created a rather complicated object which takes a very long time to
instantiate. My application needs several of these objects, and the wait
time to create them all is unacceptable. I don't understand what the
performance issue is yet, but I thought of this workaround:

Instantiate the object once, and save it to a file as a serialized object.
Then read the object from disk, rather than construct it, as many times as
needed.

I don't know if this will be time-effective because I'm getting an error
when I try to write the serialized object to disk.

I tried serializing the entire object and failed because of the exception
I've described below. So instead I tried serializing the most complex
component, and also failed for the same reason.

When I try to write the object or its most complex component, a
"NotSerializableException" is thrown. Here are the first few lines of the
stack trace. If this is not enough information, please let me know -- I've
saved it all.


java.io.NotSerializableException: apple.laf.AquaScrollListBorder
        at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
        at 
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:380)
        at javax.swing.JComponent.writeObject(JComponent.java:5296)
        at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
        at ....[snip]

The object I'm trying to serialize is composed of components. Each is a
netbean provided for me using the Netbeans IDE. I can succesfully serialize
each of the components, but not this complex component, nor the entire
object. 

As for the apple.laf.AquaScrollListBorder, I have no idea where it comes
from. I've checked the properties of each component that has a border
property, and all the borders are either Swing borders, or if Aqua borders
they're not this particular one.

Any ideas how I can get rid of apple.laf.AquaScrollListBorder, or otherwise
serialize this object?

Many thanks for your advice.

-Lou Cohen

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.