*
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "registry binding problem in RMI" Watch "registry binding problem in RMI" New topic
Author

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:
D:\del-data\rmiexample
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
D:\del-data\rmiexample>java
-Djava.rmi.server.codebase=file:/d:\del-data\rmiexample/
-Djava.rmi.sever.hostname=localhost
-Djava.security.policy=java.poilcy engine.ComputeEngine
I am getting the following error. Apparently, it is failing at line 25 in ComputeEngine.java which is "Naming.rebind(name, engine);"
ComputeEngine exception: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
at java.security.AccessController.checkPermission(AccessController.java:399)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1044)
at java.net.Socket.<init>(Socket.java:262)
at java.net.Socket.<init>(Socket.java:100)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:25)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:120)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:499)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:190
)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:318)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at engine.ComputeEngine.main(ComputeEngine.java:25)
Questions:
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.
AJ
Kunal Aher
Greenhorn

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).]


Kunal
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!
-AJ

[This message has been edited by Aj Manch (edited July 06, 2001).]
 
 
subject: registry binding problem in RMI