I am trying to send the following but I get the following error below. TableUser implements serializable but it seems that the issue is the the FXCollections, but I don't know how to serialize that.

Here is the TableUser class.

package application;


public class TableUser implements Serializable{

    private static final long serialVersionUID = 1L;
    private String username = "";

    public TableUser(String name) {
        this.username = name;

    public String getUsername(){
        return username;

    public void setUsername(String user){
        username = user;


//NOT apart of TableUser - This is the code that isn't working
private static ObservableList<TableUser> clientList = FXCollections.observableArrayList(); 

Object[] data = new Object[2];
        data[0] = "CLIENTS";
        data[1] = clientList;

        for(int i = 0; i < clients.size(); i++){

//I don't know if this helps but here is the sendData method
protected void sendData(Object[] data){
        try {
            oos.writeObject(data); //
        } catch (IOException e) {

//This is from the Client application that is also part of the issue
if((fromServer = (Object[]) ois.readObject()) != null){ // writing aborted; com.sun.javafx.collections.ObservableListWrapper
    at Source)
    at Source)
    at Source)
    at Source)
    at application.ChatRoomController$
    at Source)
Caused by: com.sun.javafx.collections.ObservableListWrapper
    at Source)
    at Source)
    at Source)
    at Source)
    at application.ServerMultiClient.sendData(
1/9/2014 1:01:47 AM

Accepted Answer

Given that ObservableListWrapper is not serializable you could try looping through your TableUser objects, and adding them one by one to data

Something like this:

Object[] data = new Object[clientList.size()+1];
data[0] = "CLIENTS";
int counter = 1;
for(TableUser tu: clientList) {
    data[counter] = tu;
1/9/2014 1:55:06 AM

A NotSerializableException is thrown when an object that is trying to be serialized has not implemented the Serializable class. In your case, since it is telling you that ObservableListWrapper is not serializable, I would infer that clientList is not serializable.

Instead of using a JavaFX ObservableList, you can use a list, such as java.util.ArrayList, which happens to implement Serializable.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow