Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes rmi policy file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "rmi policy file" Watch "rmi policy file" New topic
Author

rmi policy file

Ronnie Phelps
Ranch Hand

Joined: Mar 12, 2001
Posts: 329
I'm having trouble starting my server. Here are the contents of my policy file.
java.policy:

This is how I execute the command:

java -Djava.security.policy=java.policy learning.rmi.Request

Here's the exception I get


java.security.Policy: error parsing file:C:/learning/rmi/java.policy
java.security.Policy: line 2: expected permission entry
Exception in thread "main" java.security.AccessControlException: access denied (
java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown S
ource)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S
ource)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Unknown Source)
at learning.rmi.Request.main(Request.java:29)
Thomas Fly
Ranch Hand

Joined: Sep 09, 2002
Posts: 164
Here's my current rmi.policy:[code]grant {
// Allow everything for now
permission java.net.SocketPermission "*:1024-65535", "accept, connect, listen";
};[/code/


Fly by Night Consultants<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr><i>I climbed on the back of a giant albatross<br />which flew through a crack in the cloud<br />to a place where happiness reigned...<br />all year 'round<br />the music played ever so loudly!</i><p><a href="http://thomasfly.com/songs/Traffic/Hole_in_my_Shoe_qt.htm" target="_blank" rel="nofollow">Hole in My Shoe</a><hr></blockquote>
Thomas Fly
Ranch Hand

Joined: Sep 09, 2002
Posts: 164
Here's my current rmi.policy:
Ronnie Phelps
Ranch Hand

Joined: Mar 12, 2001
Posts: 329
Yeah that's right. Thanks Thomas.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: rmi policy file