I am unable to get the values from the remote method                         'new DatabaseSelection2().siti.getDatabasesName()' to fill the array databasesNames in 'DatabaseSelection2' class. I make bold the issue line which create the exception. I am unable to solve it someone help me I am posting SchoolInterface, SchoolInterfaceImpl, SchoolServer, and its DatabaseSelection2. I have tried every mean of resource but do not find any answer
class DatabaseSelection2:
     package schoolclient;
    import java.rmi.Naming;
    import java.rmi.RemoteException;
    import java.sql.SQLException;
    import javax.swing.JOptionPane;
    import schoolserver.SchoolInterface;
    public class DatabaseSelection2 {
        SchoolInterface siti = null;
        public static void main (String[] args){
            try {
            new DatabaseSelection2().siti =
                    (SchoolInterface) Naming.lookup("SchoolServer");
            }
            catch (Exception e) {
                e.printStackTrace();
            }
            **for(Object o : getDatabaseTable())**//line 23
            System.out.println(o);
        }
        private static Object[] getDatabaseTable() {
            Object[] databasesNames = new Object[10];
            int i = 0;
            try {
                **for(Object o : new DatabaseSelection2().siti.getDatabasesName())**   //line 32
                    databasesNames[i++] = o;
            }
            catch (SQLException e) {
                JOptionPane.showMessageDialog(null, "SQLException in read"
                        + "Databases\n" + e, "Error", JOptionPane.ERROR_MESSAGE);
            }
            catch (RemoteException e) {
                JOptionPane.showMessageDialog(null, "RemoteException in read Databases\n" + e, 
                        "Error", JOptionPane.ERROR_MESSAGE);
            }   
            return databasesNames;
        } 
    }
Exception in thread "main" java.lang.NullPointerException
    at schoolclient.DatabaseSelection2.getDatabaseTable(DatabaseSelection2.java:32)
    at schoolclient.DatabaseSelection2.main(DatabaseSelection2.java:23)
interface SchoolInterface
package schoolserver;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public interface SchoolInterface extends Remote {
    public ArrayList getDatabasesName() throws RemoteException, SQLException;   
}
class SchoolServer
package schoolserver;
import java.rmi.Naming;
public class SchoolServer {
    public static void main (String[] args) {
        try {
            SchoolInterfaceImpl sii = new SchoolInterfaceImpl();
            Naming.rebind("SchoolServer", sii);
        }
        catch (Exception e) {
        }
    }
}
Class SchoolInterfaceImpl :
package schoolserver;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.sql.Connection;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
public class SchoolInterfaceImpl 
            extends UnicastRemoteObject implements SchoolInterface {
    protected SchoolInterfaceImpl() throws RemoteException {
        super();
        // TODO Auto-generated constructor stub
    }
    public ArrayList getDatabasesName() 
            throws RemoteException, SQLException {
        ArrayList databasesName = null;
        Connection connection = null;
        ResultSet resultSet = null;
        try {
        connection = DriverManager.getConnection(
                "jdbc:sqlserver://localhost\\FAISAL:1433;"
                + "username=fas;password=24071982");
        resultSet = connection.getMetaData().getCatalogs();
        while(resultSet.next()){
            databasesName.add(resultSet.getObject(1));
        }
        }
        catch (SQLException e) {
            throw new SQLException();
        }
        finally{
            try {
                if(connection != null)
                    connection.close();
            }
            catch(SQLException e) {
                throw new SQLException();
            }
            try {
                if(resultSet != null)
                    resultSet.close();
            }
            catch(SQLException e) {
                throw new SQLException();
            }
        }
        return databasesName;
    }
}
 
    