• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Restrictions on RMI - what does that mean to me?

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
for my URLYBird i have the following RMI restrictions:

(a) you must not require a HTTP server
(b) you must not require the installation of a security manager
(c) you must provide all classes pre-installed so that no dynamic class downloading occurs.

(1)The most interesting one is req. c - if I understand this correctly, I must run rmic to generate the stub/skeleton class files- is this correct??..if so, I have a problem - because in my java 1.5 jdk there is no rmic anymore!!!....

(2) After testing every single availabe rmi tutorial on the web, i finally managed to make one running...lol...this is how the server registers the object:



To run it i must provide a property: -Djava.rmi.server.codebase=file:C:\temp\RMIHelloWorld\bin\


IS THIS APPROACH feasible for the certificate??....I mean most likely the sun-guys do not want to specify some code base...., but how can i avoid this...?..

Thanks...
 
Ranch Hand
Posts: 590
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This doesn't answer your question. But here's an example on RMI that I managed to get working https://coderanch.com/t/529290/java/java/Classpath . Might be of some use.
 
Sheriff
Posts: 11606
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi oli,

(1) My JDK 1.6.0_16 installation has a rmic tool, the jre installation has not. I generated my stubs (see the ant build script in ScjdFaq). Roberto Perillo passed without generating these files (and he documented his decision in choice.txt)

(2) Indeed you are not allowed to provide extra command line arguments when executing the jar file. My code to run the rmi server and registering my business service implementation is similar to the code snippet you provided. And I simply use the command java -jar runme.jar server to start the application in server mode, no additional arguments/options necessary.

Kind regards,
Roel
 
oli mueller
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

thank you for reply...i played a bit around and I found out that IF I start the rmiregistry from the folder in which my classes are, I do not need to specify the codebase with a VM argument...

..this actually leads me to another question: (1) is it correct, that you MUST start the rmiregistry (in a separate cmd window) before you start the server program (or have you started the rmiregistry somehow inside your source code..) (2) if i am correct that you need to start "rmiregistry" manually, I wonder if the sun-people really start it from the right folder, because if they dont they would probably get the same ClassNotFoundExceptions that i am getting...which would be a bad thing....for me...

thanks.
 
Roel De Nijs
Sheriff
Posts: 11606
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't start the RMI registry through the tool rmiregistry. Maybe you should have a closer look to the class LocateRegistry, it might have some method to create an rmi registry for you...
 
oli mueller
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi nils,

ok, thanks for the hint...I will have a look....
 
Roel De Nijs
Sheriff
Posts: 11606
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

oli mueller wrote:hi nils,


Who is nils
 
Sean Keane
Ranch Hand
Posts: 590
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

oli mueller wrote:Hi,

thank you for reply...i played a bit around and I found out that IF I start the rmiregistry from the folder in which my classes are, I do not need to specify the codebase with a VM argument...



I think that starting the rmiregistry from the folder that contains your classes is not the recommend approach.

Read this example here. In particular this extract:

Note: Before you start the rmiregistry, you must make sure that the shell or window in which you will run the registry either has no CLASSPATH set or has a CLASSPATH that does not include the path to any classes that you want downloaded to your client, including the stubs for your remote object implementation classes.

If you start the rmiregistry, and it can find your stub classes in its CLASSPATH, it will ignore the server's java.rmi.server.codebase property, and as a result, your client(s) will not be able to download the stub code for your remote object. For an explanation of how code downloading works in RMI, please take a look at the tutorial on Dynamic code downloading using RMI.



And this extract here:

Note: A stub class is dynamically downloaded to a client's virtual machine only when the class is not already available locally and the java.rmi.server.codebase property has been set properly to specify where the class files are located on the server.



I'm no RMI expert, but my basic understanding of this is that if you start the RMI Registry up in the folder that contains the classes, then you aren't actually testing that the classes are being dynamically loaded - because they aren't being dynamically loaded, because the RMI Registry has access to the classes directly.

I'm only starting to read up on RMI. So don't take my word for it! Maybe someone else on here can confirm\clarify.
 
Roel De Nijs
Sheriff
Posts: 11606
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just use the createRegistry method from LocateRegistry to start the rmi registry.

If you want to check if dynamic class downloading does not occur, you can find here a bit of inspiration.
 
Sean Keane
Ranch Hand
Posts: 590
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sean Keane wrote:I'm no RMI expert, but my basic understanding of this is that if you start the RMI Registry up in the folder that contains the classes, then you aren't actually testing that the classes are being dynamically loaded - because they aren't being dynamically loaded, because the RMI Registry has access to the classes directly.



I'm just reading this again and it may be misleading! After some more reading on RMI and the use of RMI in the assignment I think I've a better understanding now. Just to clear up my previous post as it may seem misleading in the context of this assignment.

If you want your classes to be dynamically loaded then you shouldn't start the RMI registry in a manner that it has access to the class files that are meant to be dynamically loaded - for the reasons outlined in the article I referenced in my previous post.

But this is not a concern for the assignment as one of the requirements for the assignment is that dynamic loading is not used.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic