• Post Reply Bookmark Topic Watch Topic
  • New Topic

CodeBase

 
deneb shah
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I want to know why do you use the codebase.
Heasrd that its a global classpath for a machine.. but could you let me more about it..
basically i am stuck
lets say
i have
1 hello interface
2 helloimpl class
3 helloserver class
4 helloclient class
now i have the helloclient class in some machine with ip as "x" and the helloimpl class is in some machine with ip "y".
i want to dynamically import the stub...
helloclient is not an applet
could you help me ???



------------------
denice the menace
 
Lucy C
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK. The codebase is, basically, a URL (file, HTTP, or FTP) where the RMI Class Loader can look for any classes it needs (eg a stub class, or the class code for any serialized parameters the client recieves) that aren't in the local classpath. You set the codebase property for your server, and then the information is added to the stream each time a serialized object is sent to the client.
So, in your example, you can do this by running the HelloServer with the -Djava.rmi.server.codebase=(whatever your codebase is) flag. For instance, you could set the codebase to the document root of your HTTP server and put the appropriate stub class files there. (If you use a file URL, the classes can only be downloaded by a client that has access to your server's local file system.)
You also need to use a security manager to do this type of dynamic class loading, and also create an appropriate security policy - the default one doesn't give enough permissions to use RMI. You can find out how to do this in the Java Tutorial RMI bit, as far as I remember...
Hope that's helpful.
[This message has been edited by Lucy C (edited May 31, 2000).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!