Meaningless Drivel is fun!
The moose likes Distributed Java and the fly likes registry binding problem in RMI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "registry binding problem in RMI" Watch "registry binding problem in RMI" New topic

registry binding problem in RMI

Aj Manch
Ranch Hand

Joined: May 07, 2001
Posts: 50
Sorry about the lengthy mail. But it will hardly take 5 min to go thru it as most of it is basic code. I am a newbie to RMI and am trying to bind a server object with the rmiregistry. I have written a very simple remote class which basically returns a string as follows. I am using JDK 1.3 on Windows 2000 Professional.
1. Remote Interface:

2. Implementation of the remote interface:

Note that I have used localhost as the rmi registry location.
3. java.policy I am using:

4. The above files are located in:
I have compiled the src files and put them in appropriate directories under D:\del-data\rmiexample. Then I generated ComputeEngine_Skel.class and ComputeEngine_Stub.class and placed them with ComputeEngine.class in D:\del-data\rmiexample\engine directory.
5. I have set the classpath to D:\del-data\rmiexample and added the same as a virtual directory //localhost/rmiexample in my IBM HTTP Server.
6. I execute the following set of commands at my commad prompt:
D:\del-data\rmiexample>set CLASSPATH=
D:\del-data\rmiexample>start rmiregistry
D:\del-data\rmiexample>set CLASSPATH=.;D:\del-data\rmiexample
-Djava.rmi.sever.hostname=localhost engine.ComputeEngine
I am getting the following error. Apparently, it is failing at line 25 in which is "Naming.rebind(name, engine);"
ComputeEngine exception: access denied ( connect,resolve) access denied ( connect,resolve)
at java.lang.SecurityManager.checkPermission(
at java.lang.SecurityManager.checkConnect(
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(
at sun.rmi.transport.tcp.TCPChannel.createConnection(
at sun.rmi.transport.tcp.TCPChannel.newConnection(
at sun.rmi.server.UnicastRef.newCall(
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(
at engine.ComputeEngine.main(
1. When I invoke the 'start rmiregistry', a separate command prompt is started and it doesn't do anything. I can't even type in it. To shut down the registry I am just killing the command prompt.Is that normal.
2. java.policy is stored in D:\del-data\rmiexample and is accessible both by classpath as well as web server. Is that ok or does it have to go in any other directory.
The web server is up and running. Can anybody tell me what/where you think I am going wrong. Appreciate your help.
Thanks in advance.
Kunal Aher

Joined: Apr 07, 2000
Posts: 20
u have spelled policy wrong !! will u pls correct it and try.
also u can add the codebase to ur grant statement in your policy like
grant "file :/del-data/rmiexample/*"

All the best
[This message has been edited by Kunal Aher (edited July 06, 2001).]

Aj Manch
Ranch Hand

Joined: May 07, 2001
Posts: 50
Thanks for your response, Kunal. I did figure this out a day after I posting the message. Sorry, I didn't post the resolution here. My bad. But appreciate your help!

[This message has been edited by Aj Manch (edited July 06, 2001).]
I agree. Here's the link:
subject: registry binding problem in RMI
It's not a secret anymore!