File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes can't solve the problem on RMI client code Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Reply Bookmark "can Watch "can New topic
Author

can't solve the problem on RMI client code

Jessica Simon
Greenhorn

Joined: Mar 27, 2010
Posts: 2
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
Saloon Keeper

Joined: Oct 27, 2005
Posts: 18365

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.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Jessica Simon
Greenhorn

Joined: Mar 27, 2010
Posts: 2
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
Saloon Keeper

Joined: Oct 27, 2005
Posts: 18365

You expect at least one command line argument but you give none.
Mustafa Dasorwala
Greenhorn

Joined: Sep 01, 2011
Posts: 25
java RmiClient ip_addr port_no "text"
Mustafa Dasorwala
Greenhorn

Joined: Sep 01, 2011
Posts: 25
The posted code doesn't work on ipv6 machines. Can anyone suggest changes to incorporate support for ipv6 too.
Rob Spoor
Saloon Keeper

Joined: Oct 27, 2005
Posts: 18365

ItDoesntWorkIsUseless. What doesn't it do? Do you get any exceptions? If so, can you show the stack traces?
Mustafa Dasorwala
Greenhorn

Joined: Sep 01, 2011
Posts: 25
Complete Details:

http://www.coderanch.com/t/560445/java/java/RMI-client-server-don-work
Rob Spoor
Saloon Keeper

Joined: Oct 27, 2005
Posts: 18365

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

Joined: Sep 01, 2011
Posts: 25
I will take care............... kindly help me with the issue.....................
 
IntelliJ Java IDE
 
subject: can't solve the problem on RMI client code
 
Threads others viewed
RMI from Webservice
RMI pass by value or by reference ?
RMI client server don't work on ipv6 machines
Help needed in RMI
how to start server in command line...
IntelliJ Java IDE