Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help me to run my first RMI app  RSS feed

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.
I need some help to run my first RMI application.
I have read Java's RMI tutorial and I developed a small application.
my server and remote object implementation exist in the following dirs :

C:\public\com\server\RemoteInterface.class
C:\public\com\server\RemoteInterfaceImpl.class
C:\public\com\server\RemoteInterfaceImpl_Stub.class
C:\public\com\server\RemoteInterfaceImpl_Skel.class
C:\public\runner\ServerRunner.class

my client code locates (and contains) the following dirs :

E:\public\com\server\RemoteInterface.class
E:\public\com\server\RemoteInterfaceImpl.class
E:\public\client\MyClient.class
I have create the following java.policy file :

to run the server, I wrote :
C:\>set CLASSPATH=.;public
java -Djava.rmi.server.codebase=file:/c:\public/ -Djava.rmi.server.hostname=localhost
-Djava.security.policy=java.policy
the server is running ok..
to run the client :
E:\>set CLASSPATH=.;public
java -Djava.rmi.server.codebase=file:/e:\public/ -Djava.security.policy=java.polich client.MyClient
but I got the following exception :
AccessControlException, access denied.
(SocketPermission 127.0.0.1 :1099 connect, resolve)
may I ask you for some help please ???
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You also need "resolve" listed in the SocketPermission section in the policy file.
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried it.
I got the exception :
AccessControlException, access denied (java.util.PropertyPermissiom) file encoded read.
note :
I have installed RMI security manager in the client code and runner code.
any ideas ??
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have changed java.policy file to :

but I got the following exception :
unable to connect to any host due the exception : AccessControlException access denied. (java.util.PropertyPermission file encoded read...)
I create my own RMI security manager and override checkConnect methods (empty implementation),then I installed this security manager in the client's code, and runner's code, but I got the same result...
I changed the policy file to allow all permission, the application works successfully..
well giving all permissions is not good (and can't be used in real life), so could someone please, shed some light on these problems ?
(building RMI apps supposed to be easy, huh ???)
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to add a line like -


To your security properties.

I'm not sure what propertyName needs to be replaced with in your version... the error message isn't too specific.

Programming an RMI application is pretty easy once you get the build procedure down and wrap your head around how remote and serializable things actually work. The security stuff is really a pain, though... which is why most RMI tutorials just cop out and tell you to use all permissions enabled.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!