Hi Guys Somehow I can't make my server use any other port then 1099, the default RMI port. Any clues as to what I am doing wrong ??? Thanks. -Sharma
Sun Certified Enterprise Architect<br />Sun Certified Java Developer<br />Sun Certified Java 2 Programmer<br />IBM OOAD using UML<br />IBM XML and Related Technologies<br />BEA Certified WebLogic Developer (6/7)
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
Are you by any chance using LocateRegistry.getRegistry() or LocateRegistry.getRegistry(hostNameString). If yes by default it will use RMI port 1099. Check the API HTH -Amish
Andrew Monkhouse
author and jackaroo
Marshal Commander
Hi Sharma, If you are starting the rmiregistry from the command line, then show us the command line. If you are starting it programattically then show us the line of code that starts it. Likewise, show us the line of code that registers with the registry, and that does the lookup on the registry. When we see what you are doing, we will be able to make suggestions. Regards, Andrew
I use the following code to start the registry. java.rmi.registry.LocateRegistry.createRegistry(port); surprisingly if I use any other port except 1099 I get an exception. The message says Connection refused to host <my ip address>. [java.net.ConnectException] Thanks for your help already. -sharma
Andrew Monkhouse
author and jackaroo
Marshal Commander
Hi Sharma, Are you specifying the port number in your calls to bind()/rebind()/lookup()? Regards, Andrew
Ken Krebs
Ranch Hand
Joined: Nov 27, 2002
Posts: 451
posted
0
Sharma, Before your LocateRegistry.getRegistry(port) call, you should create a registry for your port of interest. The following works for me.
kktec SCJP1.4, SCWCD
kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg
Joy DeGrazzio
Greenhorn
Joined: Jul 26, 2003
Posts: 5
posted
0
Ken, what is the difference between the Naming and Registry classes? I think the original poster had a problem because he was using the Naming class to bind and unbind remote objects. You created a Registry object to do this however, and avoided the same problems. The API really doesn't seem to tell much.
Ken Krebs
Ranch Hand
Joined: Nov 27, 2002
Posts: 451
posted
0
Joy, As near as I can tell, the difference is that the port number is embedded as part of a URL when using Naming instead of being used as a method argument to a direct call on the registry. I changed my code to use Naming as shown below. Both techniques work. I really don't see a good reason to prefer the Naming technique over the one I used which seems simpler, more straightforward, and easier to debug. You still have to create the registry using either technique.
kktec SCJP1.4 & SCWCD
Ken Krebs
Ranch Hand
Joined: Nov 27, 2002
Posts: 451
posted
0
After thinking about it a little more, I guess a reason to use Naming would be if the registry is created in another process/JVM and our program is adding services to it. There's no need to do that here. kktec SCJP1.4 & SCWCD
mao lao
Greenhorn
Joined: Nov 26, 2002
Posts: 26
posted
0
a question about this, Can I just use command line to start rmiregistry? like >start rmiregistry 1099 and then start the database server? [ September 27, 2003: Message edited by: mao lao ]
Andrew Monkhouse
author and jackaroo
Marshal Commander
Hi Mao, You can, and this is probably what you would have to do for a real project. However if you do this, and the RMI Registry is started in a directory other than where you code is, you will have to define the codebase. The new assignments do not allow you to specify the codebase on the command line, so you would have to programattically set the codebase. Personally I think you will find it much easier to start the RMI Registry from within your program. This also means that the examiner won't have to start the RMI Registry manually. Regards, Andrew
mao lao
Greenhorn
Joined: Nov 26, 2002
Posts: 26
posted
0
thanks
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.