Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Java2 Security Permissions

 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Help. I'm lost in the muck of Java2 Security. I'm fine until I get to connecting to the database, the BOOM! it blows up. I have a was.policy set up in the META-INF of both the EAR and the WAR. Here's the error:

110.110.110.110:4100 : access denied (java.net.SocketPermission 110.110.110.110:4100 connect,resolve)

Here's my was.policy:

grant codeBase "file:${application}" {
permission java.security.AllPermission;
};

grant codeBase "file:${jars}" {
permission java.security.AllPermission;
};

grant codeBase "file:${connectorComponent}" {
permission java.security.AllPermission;
};

grant codeBase "file:${webComponent}" {
permission java.security.AllPermission;
};

grant codeBase "file:${ejbComponent}" {
permission java.security.AllPermission;
};

grant {
permission java.security.AllPermission;
};

// The following permissions apply to all the components under the application.
grant codeBase "file:${application}" {
// The following are required by JavaMail
permission java.io.FilePermission "${was.install.root}${/}lib${/}mail-impl.jar","read";
permission java.io.FilePermission "${was.install.root}${/}lib${/}activation-impl.jar","read";
permission java.net.SocketPermission "*", "connect,resolve";
permission java.util.PropertyPermission "*", "read";
};

// The following permissions apply to all utility .jar files (other
// than enterprise beans JAR files) in the application.
grant codeBase "file:${jars}" {
permission java.net.SocketPermission "*", "connect,resolve";
permission java.util.PropertyPermission "*", "read";
};

// The following permissions apply to connector resources within the application
grant codeBase "file:${connectorComponent}" {
permission java.net.SocketPermission "*", "connect,resolve";
permission java.util.PropertyPermission "*", "read";
};

// The following permissions apply to all the Web modules (.war files)
// within the application.
grant codeBase "file:${webComponent}" {
permission java.io.FilePermission "${was.module.path}${/}-", "read, write";
// where "was.module.path" is the path where the Web module is
// installed. Refer to Dynamic policy concepts for other symbols.
permission java.lang.RuntimePermission "*";
permission java.net.SocketPermission "*", "connect,resolve";
permission java.util.PropertyPermission "*", "read";
};

// The following permissions apply to all the EJB modules within the application.
grant codeBase "file:${ejbComponent}" {
permission java.lang.RuntimePermission "*";
permission java.net.SocketPermission "*", "connect,resolve";
permission java.util.PropertyPermission "*", "read";
};

Obviously, I've copied things throughout since I have very little clue as to what I'm doing. Can anyone clue me in? Thanks.

Pat
 
Don't count your weasels before they've popped. And now for a mulberry bush related tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic