• Post Reply Bookmark Topic Watch Topic
  • New Topic

registry binding problem in RMI  RSS feed

Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.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 connect,resolve)
java.security.AccessControlException: access denied (java.net.SocketPermission 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)
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.
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!