Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.security.AccessControlException:access denied (java.net.SocketPermission 172.20.68.45:1521 ...

 
bill zhang
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a swing program needs to access db which resides on 172.20.68.45 on port 1521.
I signed the program and policy file looks like:

grant signedBy "susan" {
permission java.io.FilePermission "C:\\Backup\\SignJarTest\\*", "read";
permission java.net.SocketPermission "172.20.68.45", "listen,accept,connect,resolve";
};

If I remove FilePermission from the policy, program throws error on opening a config file. So fist setting solves this problem. However no matter what I do with the second setting for Socket Permission, it keeps giving me error when I run the program:
java.security.AccessControlException:access denied (java.net.SocketPermission 172.20.68.45:1521 connect, resolve.
Can someone tell me why? Thanks.
 
Vishalkumar srivastava
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use the port no. also as shown below

permission java.net.SocketPermission "172.20.68.45:1521", "listen,accept,connect,resolve";
 
Amit Ghorpade
Bartender
Posts: 2851
10
Fedora Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Vishal India " please check your private messages. You can check them by clicking the My Private Messages link above.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic