Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

can't solve the problem on RMI client code  RSS feed

 
Jessica Simon
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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 ~~
 
Rob Spoor
Sheriff
Posts: 20904
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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
  • 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: 20904
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You expect at least one command line argument but you give none.
 
Mustafa Dasorwala
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java RmiClient ip_addr port_no "text"
 
Mustafa Dasorwala
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • 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: 20904
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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
 
Rob Spoor
Sheriff
Posts: 20904
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I will take care............... kindly help me with the issue.....................
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!