File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes RMI stub and rmi registry Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "RMI stub and rmi registry" Watch "RMI stub and rmi registry" New topic
Author

RMI stub and rmi registry

Jair Elton
Greenhorn

Joined: Jan 19, 2007
Posts: 9
I need to generate the stub using rmic, and I can't start the rmi registry programatically?

Reading the post below I was with a little of fear, I don't use the rmic and I start the rmi registry like this:

Registry registry = LocateRegistry.createRegistry(port);

I can't? I need to start rmi registry via command line?

http://www.coderanch.com/t/188775/java-developer-SCJD/certification/Building-ant


Jair Elton<br /><a href="http://jairelton.com" target="_blank" rel="nofollow">http://jairelton.com</a>
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11279
    
  59

Hi Jair,
  • You need to generate the stubs using rmic


  • If the stubs are not present in the classpath of the client JVM, then it will request them from the server, and the server will dynamically generate the stubs and provide them to the client. However since it is the server that is providing the stubs, you will be breaking the rule that no dynamic downloading of class files are allowed.

  • You may start the rmi registry programatically from within your server.


  • There is nothing in the instructions which forbids this.

    There is the instruction "Your programs must not require use of command line arguments other than the single mode flag". Given this, starting the RMI registry from the command line can be problematic, as your codebase will not be set, and you may need a security manager. There are ways around these two problems, but why generate more work for yourself? Since you do not get extra marks for going beyond the specifications, and the specifications allow an easy solution, go with the easy solution! Hope this helps.

    Regards, Andrew


    The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
    Jair Elton
    Greenhorn

    Joined: Jan 19, 2007
    Posts: 9
    Nice!

    Thank you!
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: RMI stub and rmi registry
     
    Similar Threads
    packaging stubs
    RMI things to be done
    Why my RMI connection throw exceptions?
    RMI, stub and skeleton locations
    Javadoc question