Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

HFJ - RMI issues.  RSS feed

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

 
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 )
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 )
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also my ip address keeps changing everytime i restart my router
 
Yasin Kothia
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The reason your IP keeps changing is because you do not have a static IP from your ISP.
 
Agr Raj
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you generate a _Skel class?
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Yasin Kothia wrote:did you generate a _Skel class?



i used rmic but that created only _stub class
 
Yasin Kothia
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!