• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help me to run my first RMI app

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ???
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You also need "resolve" listed in the SocketPermission section in the policy file.
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic