aspose file tools*
The moose likes Distributed Java and the fly likes HFJ - RMI issues. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "HFJ - RMI issues." Watch "HFJ - RMI issues." New topic
Author

HFJ - RMI issues.

Yasin Kothia
Ranch Hand

Joined: Sep 25, 2009
Posts: 39
I followed the example on the books but i am getting a lot of errors.

I ran rmiregistry.

I then done.

java MyremoteImpl
which gave me the following error:



MyRemoteClient gives me the following error:



Here is my MyRemoteImpl code:


MyRemoteClient Code:


MyRemote Code:

Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

In your error page, it seems like you haven't generated the stub and skeliton. Did you?

I will check your complete code now, and will come back. Just make sure whether you have generated the stub and skeliton ( Skeliton is in the view of theory. From java 1.2 onwards, the need of skeliton has been overcome by the stub )


Are you better than me? Then please show me my mistakes..
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Yes, stub and skeliton was the issue. Other than that, the code is fine.

For the BEST PRACTICE, follow these things.

1. Implement the RMI security using " System.setSecurityManager(new RMISecurityManager()); ". Then you will need to set the java security policy to run the program
2. Throw remote exception in your implemented methods from the interface in the MyRemoteImpl class.
3. call the constructor of the UnicastRemoteObject class in the MyRemoteImpl class constructor using the " super() " method (Not needed, but good )
Agr Raj
Greenhorn

Joined: Feb 03, 2012
Posts: 9
I ran the same code from hfj and it works fine on the same machine, but when i work on a different machine it blows up at runtime. i have changed the ip address from 127.0.0.1 to 120.138.114.174.
Any help
Agr Raj
Greenhorn

Joined: Feb 03, 2012
Posts: 9
Also my ip address keeps changing everytime i restart my router
Yasin Kothia
Ranch Hand

Joined: Sep 25, 2009
Posts: 39
The reason your IP keeps changing is because you do not have a static IP from your ISP.
Agr Raj
Greenhorn

Joined: Feb 03, 2012
Posts: 9
Yasin Kothia wrote:The reason your IP keeps changing is because you do not have a static IP from your ISP.


Yes, that's fine but I don't understand why the code fails when i try to access the server through the Internet.
Yasin Kothia
Ranch Hand

Joined: Sep 25, 2009
Posts: 39
did you generate a _Skel class?
A.G Rajkotia
Greenhorn

Joined: Aug 11, 2011
Posts: 28
Yasin Kothia wrote:did you generate a _Skel class?


i used rmic but that created only _stub class
Yasin Kothia
Ranch Hand

Joined: Sep 25, 2009
Posts: 39
Use to generate the Skeleton.

Skeleton classes are not needed any more, however the HFJ example is a bit dated so it may be needed for that example.
 
wood burning stoves
 
subject: HFJ - RMI issues.