Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 761621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:51:36+00:00 2026-05-14T15:51:36+00:00

In a simple RMI game I’m writing (an assignment in uni), I reveice: java.rmi.MarshalException:

  • 0

In a simple RMI game I’m writing (an assignment in uni), I reveice:

java.rmi.MarshalException: error marshalling arguments; nested exception is:
        java.net.SocketException: Broken pipe
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:138)
        at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
        at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
        at $Proxy2.drawWorld(Unknown Source)
        at PlayerServerImpl$1.actionPerformed(PlayerServerImpl.java:180)
        at javax.swing.Timer.fireActionPerformed(Timer.java:271)
        at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        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)

The error message appears after the second Player is registered with the RMI Server and the server starts to send the image (the array of pixels) to the 2 applets. The PlayerImpl and the PlayerServerImpl both extend UnicastRemoteObject.

I have been struggling with other error messages for some time now, but I cannot understand how to troubleshoot this one. Please help.

The relevant parts of the code are:

PlayerServerImpl.java:


                        ...
        timer = new Timer(10, new ActionListener() { // every 10 milliseconds do:
            @Override
            public void actionPerformed(ActionEvent e) {
                        ...
                    BufferedImage buff_image = new BufferedImage(GAME_APPLET_WIDTH, GAME_APPLET_HEIGHT, BufferedImage.TYPE_INT_RGB);
                    // create a graphics context on the buffered image
                    Graphics buff_g = buff_image.createGraphics();
                        ...
                    // draw the score somewhere on the screen
                    buff_g.drawString(score, GAME_APPLET_WIDTH - 20, 10);
                        ...
                    int[] rgbs = new int[GAME_APPLET_WIDTH * GAME_APPLET_HEIGHT];
                    int imgPixelsGrabbed[] = buff_image.getRGB(0,0,GAME_APPLET_WIDTH,GAME_APPLET_HEIGHT,rgbs,0,GAME_APPLET_WIDTH);
                    // send the new state to the applets
                    for (Player player : players) {
                        player.drawWorld(imgPixelsGrabbed);
                        System.out.println("Sent image to player");
                    }

PlayerImpl.java:


    private PlayerApplet applet;    

    public PlayerImpl(PlayerApplet applet) throws RemoteException {
        super();
        this.applet = applet;
    }
        ...
    @Override
    public void drawWorld(int[] imgPixelsGrabbed) throws RemoteException {
        applet.setWorld(imgPixelsGrabbed);
        applet.repaint(); 
    }
        ...

PlayerApplet.java:


        ...
    private int[] world; // an array of pixels for the new image to be drawn
        ...
        // register players
                player = new PlayerImpl(applet);
                String serverIPAddressPort = ipAddressField.getText();
                if (validateIPAddressPort(serverIPAddressPort)) {
                    server = (PlayerServer) Naming.lookup("rmi://"
                            + serverIPAddressPort + "/PlayerServer");
                    server.register(player);
                    idPlayer = server.sendPlayerID();
        ...
    @Override
    public void update(Graphics g) {
        buff_img = createImage((ImageProducer) new MemoryImageSource(getWidth(), getHeight(), world, 0, getWidth()));
        Graphics gr = buff_img.getGraphics();
        paint(gr);
        g.drawImage(buff_img, 0, 0, this);
    }

    public void setWorld(int[] world) {
        this.world = world;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:51:36+00:00Added an answer on May 14, 2026 at 3:51 pm

    I have rewritten the whole thing. I have received the same error message several times, and every time it was indicating a network problem. So I guess the question is solved.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a very simple RMI server, and I am seeing intermittent java.rmi.NoSuchObjectExceptions
I'm writing a simple distributed java rmi application and I have a bunch of
I have a very simple Java RMI Server that looks like the following: import
I'm currently writing a simple client/server in Java using sockets. I want the server
I wrote an simple project using java rmi and exported to an executable jar
I am programming a simple client/server application using Java-RMI. I would like to know
Simple as the title states: Can you use only Java commands to take a
I'm trying to do a simple program for RMI. But, I'm getting the following
My uni is teaching a distributed system course, which has sample programs using java
I've wrote simple RMI code to learn how it works. While everything works fine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.