• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S: RMI parameters and suchlike

 
Oliver Weikopf
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got my application up and running quite smoothly, but still have a question or two about RMI, as this was the first time I've used it.

  • It appears that to get the server running, you need the parameter "java.rmi.server.codebase". At first, I passed it on as a VM parameter, but I'm aware that we're not allowed to use any. So I've come up with something like this:


  • Apparently, the exact codebase will still change when I wrap this in an executable jar, but I was wondering whether there was a more elegant way to solve this. Any ideas?
  • RMI also requires a running rmiregistry. Are we supposed to start it from within the application or are we supposed to assume that it is already running?

  •  
    Robert McDonald
    Greenhorn
    Posts: 17
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Oliver,

    I'm no expert with RMI but as i understand it the codebase property is principally used for dynamic class downloading i.e. when the client doesn't have a copy of the relevant class it can download it from a remote server. In my project this is specifically mentioned as not being allowed for RMI. (There may be another reason you need codebase which i'm not aware of but i don't set it in my code and it seems to work fine).

    As to the RMI registry, I take a belt and bootstraps approach and try to create it first. If it is running i get an exception which i catch and then do a get. It's probably not strictly necessary but i ended up with this code when in testing i got exceptions in the create because the jvm from a previous test had not shutdown and left the registry running.
     
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander
    Pie
    Posts: 12007
    215
    C++ Firefox Browser IntelliJ IDE Java Mac Oracle
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Oliver,

    If you start the registry programatically you will not need the codebase.

    Regards, Andrew
     
    Oliver Weikopf
    Ranch Hand
    Posts: 58
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks, Robert and Jeroen!
    Starting the registry from within the application now and it's working fine.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic