Hi everyone,

Im trying to store an arraylist by serializing it.

The problem is, that it wont work, im getting the not serializable exception:
Code:
java.io.NotSerializableException: ImageResults
	at java.io.ObjectOutputStream.writeObject0(Unknown Source)
	at java.io.ObjectOutputStream.writeObject(Unknown Source)
	at java.util.ArrayList.writeObject(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
Is there any way around this? do i need to serialize every object in the arraylist or something? My serialising class and the class of the objects which are found in the arraylist are below:

please help - thanks

The class where i serialize the arraylist
Code:
import java.io.*;
import java.util.*;
 
public class FeatureDatabase {
 
	public void writeToDatabase (ArrayList imageResults) {
 
		for (int i=0; i<imageResults.size(); i++) {
			
			ImageResults ir = (ImageResults)imageResults.get(i);			
			System.out.println(ir.name);
		}
		
		ObjectOutput output = null;
 
		try {
			// use buffering
			OutputStream file = new FileOutputStream("FeatureDatabase.db");
			OutputStream buffer = new BufferedOutputStream(file);
			output = new ObjectOutputStream(buffer);
			output.writeObject(imageResults);
		}
 
		catch (IOException ex) {
			ex.printStackTrace();
			System.out.println("\n\nCannot perform output: "+ex.getLocalizedMessage());
		}
 
		finally {
 
			try {
 
				if (output != null) {
					// flush and close "output" and its underlying streams
					output.close();
				}
 
			}
 
			catch (IOException ex) {
				System.out.println("Cannot close output stream.");
			}
		}
	}
 
	public ArrayList getDatabase () {}

My arraylist which im trying to serialize is full of these objects:
Do i need to make this class extend serializable???????
Code:
import java.util.Vector;
 
public class ImageResults {
 
	public String name;
	public String location;
	private Vector ccvResults;
	private Vector acResults;
	private Vector dctResults;
	private Vector gmResults;
	private Vector histogramResults;
	private Vector miResults;
 
        /* getter and setter methods */