help needed passing objects from rmi server to application

Discussion in 'Java' started by steve, Jun 16, 2005.

  1. steve

    steve Guest

    I have a jukebox application written in java, I want to be able to
    remotely select a song from a client to the server.

    The problem I have is you have to run the server as a seperate
    process/application via "java Server" this ofcourse means that the
    server application has the object passed to it via remote method, which
    would be the song file to play. However, the Jukebox application is
    running at the same time and this is where all audio processing and
    playing is carried out.

    So, the question is, how do I get the file object from the Server
    application to the Jukebox application.

    I tried instantiating the Server as an internal class within the
    Jukebox application code, e.g. JukeboxServer js1 = new JukeboxServer();

    rmiregistry call

    Server code

    public class JukeboxServer
    {
    public JukeboxServer()
    {
    try
    {
    RemoteMusicImp remote1 = new RemoteMusicImp();
    Naming.rebind("rmi://localhost:1099/MFS",remote1);
    }
    catch(Exception e)
    {
    System.out.println("JukeboxServer exception could not instantiate");
    return;
    }
    System.out.println("jukebox server started and listening on port
    1099");
    }

    }

    This fails to start the Server, it works only if I run it as a seperate
    application, but then i can't get the song file object passed to the
    Jukebox application.

    Am I missing something obvious? Please help if you can.

    Thanks in advance Steve
     
    steve, Jun 16, 2005
    #1
    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:
    603
    Sudsy
    Aug 25, 2004
  2. Norris Watkins
    Replies:
    6
    Views:
    1,628
    Esmond Pitt
    Jan 3, 2005
  3. JScoobyCed

    RMI Vs RMI over IIOP

    JScoobyCed, Jan 28, 2005, in forum: Java
    Replies:
    1
    Views:
    779
    Dag Sunde
    Jan 28, 2005
  4. Jan Schulze
    Replies:
    1
    Views:
    599
    Esmond Pitt
    Mar 26, 2005
  5. Sebastian
    Replies:
    0
    Views:
    381
    Sebastian
    Nov 10, 2010
Loading...

Share This Page