Forums Register Login

Help me to run my first RMI app

+Pie Number of slices to send: Send
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 ???
+Pie Number of slices to send: Send
You also need "resolve" listed in the SocketPermission section in the policy file.
+Pie Number of slices to send: Send
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 ??
+Pie Number of slices to send: Send
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 ???)
+Pie Number of slices to send: Send
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.
Tell me how it all turns out. Here is a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1189 times.
Similar Threads
RMI - java.security issue
RMI Server Connection Problem on XP prof
Problem with Sun's Bootstraping Example
RMI Newbie
Why does AccessControlException happen? Please help me!
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 08:13:13.