• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.rmi.server.codebase & Policy file Question

 
Mike Sullivan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would greatly appreciate feedback from
others regarding the following issues.
Since java.rmi.server.codebase property specifies the location containing the downloadable stubs, will it suffice to specify it as command line argument only for the Server? Or is it needed as a command
line argument for the client as well?
Also I understand that the policy file needs to be specified for both client & server. Will this be 2 copies of the same file for both client & server side granting all permissions for downloaded code? Or will there be different policy files for client & server side?
[This message has been edited by Mike Sullivan (edited July 01, 2001).]
 
Akanimo Udoh
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. I believe it is sufficient to specify the codebase property for the server alone UNLESS your implementation requires the CLIENT to upload class files to the server, which would be very unlikely.
2. About policy files there's no hard and fast rule for whether you should use a SHARED policy file OR two INDIVIDUAL policy files. Either is correct. I used a single SHARED file which gave adequate permissions for both the client and the server.
Akanimo.
 
Mike Sullivan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Akanimo, for your reply.
But for running the server, is there a need for a policy file?
I think policy file will be needed only for running the client.
Please let me know.
Further how do you share the same copy of
the policy file since client and server
code reside on different machines?
[This message has been edited by Mike Sullivan (edited July 02, 2001).]
[This message has been edited by Mike Sullivan (edited July 02, 2001).]
 
Akanimo Udoh
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need a policy file at the server end for two major reasons:
a) Permission for the server to read and write db.db file.
b) Permission to listen, and accept connections on the defined port range.
You may not get error messages for (a) if the db.db file is in the application's directory (in which case it has default permission to read the file). You will definitely get error messages for (b) if you try and use RMI without granting those socket specific permission.
If you haven't gotten any of these errors then it means that the default policy file that comes with your java installation has probably granted all the permissions by default (see \{jdk-path}\jre\lib\security\java.policy). Take a look.
About the shared policy file. When you do your packaging and make your server and client into executable jar files, it is convenient to place a single policy file at this same level to be used for either the client or the server (since both basically need the same permissions: file access and socket access).
Hope this helps.
Akanimo
 
chandana nannapaneni
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I have a very basic question.
How do we create policy files?Is it just a .txt file whose name is java.policy?
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it is a file with the .policy extension. It can be any name.

However, for this certification, you don't need to create such files.
Also, your programs must not require use of command line property specifications (and this is a command line property). And finally, about using this property:

  • The java.rmi.server.codebase property specifies the location, a codebase URL, from which the definitions for classes originating from this server can be downloaded. If the codebase specifies a directory hierarchy (as opposed to a JAR file), you must include a trailing slash at the end of the codebase URL.


  • This implies that dynamic download will occur, which is not allowed as well.

    You can check about this command line property here.
    [ December 18, 2008: Message edited by: Roberto Perillo ]
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic