Hello,

So I am running a 64 bit Linux Ubuntu and I'm creating a Shared Whiteboard application using JAVA RMI, The thing is I am getting the error:
Java Code:
run:
Whiteboard server exception:
java.security.AccessControlException: access denied (java.net.SocketPermission localhost:571 listen,resolve)
        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
        at java.security.AccessController.checkPermission(AccessController.java:546)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
        at java.lang.SecurityManager.checkListen(SecurityManager.java:1120)
        at java.net.ServerSocket.bind(ServerSocket.java:327)
        at java.net.ServerSocket.<init>(ServerSocket.java:194)
        at java.net.ServerSocket.<init>(ServerSocket.java:106)
        at sun.rmi.transport.proxy.RMIDirectSocketFactory.createServerSocket(RMIDirectSocketFactory.java:27)
        at sun.rmi.transport.proxy.RMIMasterSocketFactory.createServerSocket(RMIMasterSocketFactory.java:333)
        at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:649)
        at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:299)
        at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:218)
        at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:393)
        at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:129)
        at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:190)
        at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:293)
        at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:235)
        at whiteboardserver.ServerWindow.showGUI(ServerWindow.java:118)
        at whiteboardserver.ServerWindow.access$000(ServerWindow.java:21)
        at whiteboardserver.ServerWindow$1.run(ServerWindow.java:189)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:641)
        at java.awt.EventQueue.access$000(EventQueue.java:84)
        at java.awt.EventQueue$1.run(EventQueue.java:602)
        at java.awt.EventQueue$1.run(EventQueue.java:600)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:611)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
My RemoteInterface class looks as follows:
Java Code:
package whiteboardserver;
import java.awt.Color;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.ArrayList;

/**
 *
 * @author arturas
 */
public interface RemoteInterface extends Remote {
    void connectClient(Color client) throws RemoteException;
    void disconnectClient(Color client) throws RemoteException;
    void addLine(Color color, int x1, int y1, int x2, int y2) throws RemoteException;
    ArrayList<Line> getLines(Color color) throws RemoteException;
}
The server class where the error occurs looks like this:
Java Code:
package whiteboardserver;

import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import javax.swing.*;
import javax.swing.border.Border;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
import java.util.ArrayList;

/**
 *
 * @author arturas
 */
public class ServerWindow implements RemoteInterface {

    boolean yellowClient, greenClient, redClient;
    ArrayList<Line> yellowLines, greenLines, redLines;
    private int penColor;
    private JButton buttonYellow;
    private JButton buttonGreen;
    private JButton buttonRed;
    private JButton buttonClear;
    DrawArea layoutDrawingArea;
    //RemoteInterface serverWindow;

    ServerWindow() {
        penColor = 0;
        yellowClient = false;
        greenClient = false;
        redClient = false;
        yellowLines = new ArrayList<Line>();
        greenLines = new ArrayList<Line>();
        redLines = new ArrayList<Line>();
    }

    ServerWindow(int nothing) {
        super();
    }

    private ServerWindow(RemoteInterface serverWindow) {
        super();
    }

    public void connectClient(Color Client) {
        if (Client == Color.yellow) {
            yellowClient = true;
        } else if (Client == Color.green) {
            greenClient = true;
        } else if (Client == Color.red) {
            redClient = true;
        }
    }

    public void disconnectClient(Color Client) {
        if (Client == Color.yellow) {
            yellowClient = false;
            yellowLines.clear();
        } else if (Client == Color.green) {
            greenClient = false;
            greenLines.clear();
        } else if (Client == Color.red) {
            redClient = false;
            redLines.clear();
        }
    }

    public void addLine(Color color, int x1, int y1, int x2, int y2) {
        Line newLine = new Line(x1, y1, x2, y2);
        if (color == Color.yellow) {
            yellowLines.add(newLine);
        } else if (color == Color.green) {
            greenLines.add(newLine);
        } else if (color == Color.red) {
            redLines.add(newLine);
        }
        layoutDrawingArea.syncLines(yellowLines, greenLines, redLines);
    }

    public ArrayList<Line> getLines(Color color) {
        if (color == Color.yellow) {
            return yellowLines;
        } else if (color == Color.green) {
            return greenLines;
        } else if (color == Color.red) {
            return redLines;
        } else {
            return null;
        }
    }

    public void SetupButtons() {
        buttonYellow.setEnabled(yellowClient);
        buttonGreen.setEnabled(greenClient);
        buttonRed.setEnabled(redClient);
    }

    private static void showGUI() {
        //Create and set up the window.
        JFrame window = new JFrame("Shared Whiteboard Client");
        window.setPreferredSize(new Dimension(450, 300));
        window.setResizable(false);
        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        if (System.getSecurityManager() == null) {
            System.setSecurityManager(new SecurityManager());

        }
        
        try {
            RemoteInterface serverWindow = new ServerWindow();
            String name = "WhiteboardServer";
            RemoteInterface stub = (RemoteInterface) UnicastRemoteObject.exportObject(serverWindow, 571);
            Registry registry = LocateRegistry.getRegistry();
            registry.rebind(name, stub);
            System.out.println("Whiteboard server bound");
            ServerWindow crazy = new ServerWindow(serverWindow);
            crazy.addComponents(window.getContentPane());
        } catch (Exception e) {
            System.err.println("Whiteboard server exception:");
            e.printStackTrace();
        }

        //Display the window.        
        window.pack();
        window.setLocationRelativeTo(null);
        window.setVisible(true);
    }

    public void addComponents(Container pane) {
        // It's supposed to be a Whiteboard with a drawing area

        // The Title over the drawing area
        JPanel layoutHeader = new JPanel();
        JLabel label1 = new JLabel("Draw in the white area");
        layoutHeader.add(label1);
        //layoutHeader.setBackground(Color.yellow);

        // The extended JPanel for the Drawing Area
        layoutDrawingArea = new DrawArea();
        layoutDrawingArea.setBackground(Color.white);
        layoutDrawingArea.setPreferredSize(new Dimension(400, 250));
        layoutDrawingArea.setBorder(BorderFactory.createLineBorder(Color.black, 2));
        //layoutDrawingArea.repaint();

        // The buttons for choosing pen color
        buttonYellow = new JButton("Yellow");
        buttonYellow.setBackground(Color.yellow);
        buttonGreen = new JButton("Green");
        buttonGreen.setBackground(Color.green);
        buttonRed = new JButton("Red");
        buttonRed.setBackground(Color.red);
        buttonClear = new JButton("Clear whiteboard");
        buttonClear.setBackground(Color.white);

        JPanel layoutButtons = new JPanel();
        layoutButtons.add(buttonYellow);
        layoutButtons.add(buttonGreen);
        layoutButtons.add(buttonRed);
        layoutButtons.add(buttonClear);

        JPanel LeftSide = new JPanel();
        JPanel RightSide = new JPanel();
        LeftSide.setPreferredSize(new Dimension(25, 25));
        RightSide.setPreferredSize(new Dimension(25, 25));
        pane.add(layoutHeader, BorderLayout.PAGE_START);
        pane.add(LeftSide, BorderLayout.LINE_START);
        pane.add(layoutDrawingArea, BorderLayout.CENTER);
        pane.add(RightSide, BorderLayout.LINE_END);
        pane.add(layoutButtons, BorderLayout.PAGE_END);

        buttonYellow.setEnabled(false);
        buttonGreen.setEnabled(false);
        buttonRed.setEnabled(false);
        buttonClear.setEnabled(false);
    }

    public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                showGUI();
            }
        });
    }
}
So please somebody if anybody has any thoughts on it, please help. Thanks in advance.