Here's my guess: You don't need to specify the protocol (which is what "rmi:" is in the URL) because you're registering, or looking up, a remote object. The protocol used to retrieve the object has no bearing on it's name. As I said, it's my guess. If anybody else wants to supply the correct answer, please do so. I'm curious. Burk
SCJP, SCJD, SCEA 5 "Any sufficiently analyzed magic is indistinguishable from science!" Agatha Heterodyne (Girl Genius)
posted 16 years ago
[to Mark] "I was gratified to be able to answer promptly. I said I don't know." Mark Twain. "The important thing is not to stop questioning." Albert Einstein.
[ April 16, 2004: Message edited by: Denis Spirin ]
Hi Denis, You do not need to specify the protocol in the URL, however it doesn't hurt to do so (especially if you are persisting the URL in some file where the average reader may not understand what it is for). Basically the RMI methods expect to use RMI to connect. (Funny about that. ) So they don't need the "rmi:" protocol prefix. The same as web browsers usually expect to be connecting to a web server, so they usually do not need you to enter the http: protocol prefix. If you type in www.javaranch.com your browser will normally automatically assume that you mean to use HTTP, and automagically prefix your URL so that it appears as http://www.javaranch.com. Specifying the protocol is only necessary if you want to use some other protocol - for example, if you want to connect to an FTP server via your web browser, in which case you would prefix the URL with "ftp:" (for example ftp://homelinux.yi.org/). Most web browsers (in fact all that I can remember) also do not need the port you are connecting to - they automatically assume that you are connecting to port 80. So you can be explicit and say http://www.javaranch.com:80/, or you can say http://www.javaranch.com and your browser will still get to exactly the same place. Specifying the port is only necessary if you want to go to a non standard port (For example, the ISSN web page is on port 8080, not port 80, so if you want to go to their page you have to enter the port number in the URL: http://www.issn.org:8080/pub/). The same applies to RMI: by default, all the RMI methods assume that you are going to use RMI, that you are connecting to the local host, and that you are using port 1099. So all the following are equivalent:
(And many more, I got bored after the first four ) But, as mentioned earlier, you might want to give a fully qualified URL if there is any possibility that someone may look at your properties file directly - in this case having the fully qualified URL would make more sense to the reader. Regards, Andrew [Sorry, UBB automatically prefixes http: to URLs with no protocol, so my example of www.javaranch.com does not really work the way I wanted it to] [ April 15, 2004: Message edited by: Andrew Monkhouse ]
Andrew, thank you for the answer! Ive never seen explanation about "rmi:" anywhere, Sun only mentions default port and host, bu not protocol. Anyway, I compared documentation for 1.3 and 1.4 versions. In 1.4 "without the scheme component" appears, but it is absent in 1.3. Thats one of the reasons why on documntation we can earn 70 points Regards