RMI under Linux -> exception: Connection reset

Discussion in 'Java' started by =?iso-8859-1?Q?L=E9on?= Planken, Nov 14, 2003.

  1. Hello,

    I'm trying to get RMI running on our lab pcs, but I think there's
    something wrong with the configuration.
    I'm using the example in the tutorial on
    <http://www.ccs.neu.edu/home/kenb/com3337/rmi_tut.html>; a 'Hello,
    World' program using RMI.

    The involved classes/interfaces are straightforward; see URL or below
    (comments snipped).

    Compiling with javac and rmic yields no errors.
    Running the server gives the following exception:

    Hello Server failed: java.rmi.UnmarshalException: Error unmarshaling
    return header; nested exception is:
    java.net.SocketException: Connection reset

    This differs from when the rmi registry isn't running, or is listening
    to another port than the default 1099. In that case I get 'connection
    refused'.

    I think this somehow has to do with the configuration of the system. I
    toyed with the address given to Naming.rebind and with SecurityManagers,
    with a security policy and with the code base, but I don't think these
    settings actually cause the problem. The same program runs correctly on
    other systems.

    Finally, here's the output from `uname -a`:
    Linux xxx.yyy.zz 2.4.20-19.9 #1 Tue Jul 15 17:18:13 EDT 2003 i686 i686 i386 GNU/Linux

    Any help appreciated.

    Leon

    here are the three files:

    // HelloInterface.java
    import java.rmi.*;
    public interface HelloInterface extends Remote {
    public String say() throws RemoteException;
    }

    // Hello.java
    import java.rmi.*;
    import java.rmi.server.*;
    public class Hello extends UnicastRemoteObject implements HelloInterface
    {
    private String message;
    public Hello (String msg) throws RemoteException
    {
    message = msg;
    }
    public String say() throws RemoteException
    {
    return message;
    }
    }

    // HelloServer.java
    public class HelloServer
    {
    public static void main (String[] argv)
    {
    try {
    java.rmi.Naming.rebind ("Hello", new Hello ("Hello, world!"));
    System.out.println ("Hello Server is ready.");
    } catch (Exception e) {
    System.out.println ("Hello Server failed: " + e);
    }
    }
    }

    --
    "Linux is very fast.
    It can do an infinite loop in about 5 seconds."
    -- Linus Torvalds
    =?iso-8859-1?Q?L=E9on?= Planken, Nov 14, 2003
    #1
    1. Advertising

  2. On Fri, 14 Nov 2003 13:07:28 +0000, Léon Planken wrote:

    > Hello,
    >
    > I'm trying to get RMI running on our lab pcs, but I think there's
    > something wrong with the configuration.
    > I'm using the example in the tutorial on
    > <http://www.ccs.neu.edu/home/kenb/com3337/rmi_tut.html>; a 'Hello,
    > World' program using RMI.
    >
    > The involved classes/interfaces are straightforward; see URL or below
    > (comments snipped).
    >
    > Compiling with javac and rmic yields no errors.
    > Running the server gives the following exception:
    >
    > Hello Server failed: java.rmi.UnmarshalException: Error unmarshaling
    > return header; nested exception is:
    > java.net.SocketException: Connection reset
    >
    > This differs from when the rmi registry isn't running, or is listening
    > to another port than the default 1099. In that case I get 'connection
    > refused'.
    >


    1) Is the RMI server running?
    2) Is it listening on the standard port?
    3) Has your program (server side) been registered with the RMI server?

    By answering these three questions, odds are you will solve your problem.

    Aloha,
    La'ie Techie
    =?UTF-8?b?TMSByrtpZSBUZWNoaWU=?=, Nov 16, 2003
    #2
    1. Advertising

  3. Hi,

    I failed miserably to keep a straight face when I read that
    on Sun, 16 Nov 2003 23:01:26 GMT, L??ie Techie wrote:
    > On Fri, 14 Nov 2003 13:07:28 +0000, Léon Planken wrote:
    >
    >> I'm trying to get RMI running on our lab pcs, but I think there's
    >> something wrong with the configuration.
    >> I'm using the example in the tutorial on
    >> <http://www.ccs.neu.edu/home/kenb/com3337/rmi_tut.html>; a 'Hello,
    >> World' program using RMI.
    >>
    >> The involved classes/interfaces are straightforward; see URL or below
    >> (comments snipped).
    >>
    >> Compiling with javac and rmic yields no errors.
    >> Running the server gives the following exception:
    >>
    >> Hello Server failed: java.rmi.UnmarshalException: Error unmarshaling
    >> return header; nested exception is:
    >> java.net.SocketException: Connection reset
    >>
    >> This differs from when the rmi registry isn't running, or is listening
    >> to another port than the default 1099. In that case I get 'connection
    >> refused'.
    >>

    >
    > 1) Is the RMI server running?
    > 2) Is it listening on the standard port?
    > 3) Has your program (server side) been registered with the RMI server?
    >
    > By answering these three questions, odds are you will solve your problem.


    As I stated, the example did work on another system. I also wrote that
    I got a 'connection refused' when listening to the nonstandard port, so
    that probably wasn't the problem. As to your first point, the example
    program was the RMI server only, not the client, so that doesn't make
    sense.

    But I found out what the problem was. An incompatible version of
    rmiregistry was being used.

    Thanks anyway,

    Léon (aka Oliphaunt)
    --
    "Linux is very fast.
    It can do an infinite loop in about 5 seconds."
    -- Linus Torvalds
    =?iso-8859-1?Q?L=E9on?= Planken, Nov 17, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Buu Nguyen

    RMI, JINI or RMI/IIOP

    Buu Nguyen, Aug 25, 2004, in forum: Java
    Replies:
    1
    Views:
    561
    Sudsy
    Aug 25, 2004
  2. JScoobyCed

    RMI Vs RMI over IIOP

    JScoobyCed, Jan 28, 2005, in forum: Java
    Replies:
    1
    Views:
    735
    Dag Sunde
    Jan 28, 2005
  3. abhi
    Replies:
    1
    Views:
    9,364
    Manish Pandit
    Sep 27, 2006
  4. Helene Unterwieser
    Replies:
    14
    Views:
    3,664
    Esmond Pitt
    Jul 3, 2007
  5. pcgallagher
    Replies:
    2
    Views:
    2,453
    Mark Space
    Dec 27, 2008
Loading...

Share This Page