• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

can't solve the problem on RMI client code

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
anyone who can help me with this code....see if there is any problem FYI i'm just a beginner in java application

the rmi server code is running well but i can't really see the problem on how to solve the rmi client code(below);

import java.rmi.*;
import java.rmi.registry.*;
//import java.net.*;

public class RmiClient{
@SuppressWarnings("empty-statement")
static public void main(String args[]){
ReceiveMessageInterface RmiServer = null;
Registry registry;
String serverAddress=args[0];
String serverPort=args[1];
String text=args[2];
System.out.println ("sending " + text + " to " +serverAddress + ":" + serverPort);
try{
registry=LocateRegistry.getRegistry (serverAddress,(new Integer(serverPort)).intValue());
RmiServer=(ReceiveMessageInterface)(registry.lookup("rmiServer"));
// call the remote method
/*RmiServer.ReceiveMessageInterface(text)*/;
}
catch(RemoteException e){
e.printStackTrace();
}
catch(NotBoundException e){
System.err.println(e);
}
}
}

please do help me ~~
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseCodeTags. You can use the edit button () to add them.

What isn't working? You say that the client code needs to be solved, but you don't say what it is that needs to be solved. ItDoesntWorkIsUseless.
 
Jessica Simon
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ow SORRY for that

the problem occur here;

String serverAddress=args[0]; (where it stated there "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0")
 
Rob Spoor
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You expect at least one command line argument but you give none.
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java RmiClient ip_addr port_no "text"
 
Mustafa Dasorwala
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The posted code doesn't work on ipv6 machines. Can anyone suggest changes to incorporate support for ipv6 too.
 
Rob Spoor
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ItDoesntWorkIsUseless. What doesn't it do? Do you get any exceptions? If so, can you show the stack traces?
 
Mustafa Dasorwala
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Complete Details:

https://coderanch.com/t/560445/java/java/RMI-client-server-don-work
 
Rob Spoor
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let's continue in that thread instead. Next time, please UseOneThreadPerQuestion. It's good that you created the new thread, you just shouldn't have posted in this one.
 
Mustafa Dasorwala
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will take care............... kindly help me with the issue.....................
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic