• 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

HFJ - RMI issues.

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
did you generate a _Skel class?
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic