• 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

acces denied java.io.FilePermission

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a sun cobalt linux server.
With Apache tomcat installed.
The jsp pages work properly, the problem is when I call a classe.
java.security.AccessControlException: access denied (java.io.FilePermission /home/.sites/143/site2/web/WEB-INF/classes read)
Here is my tmcat policy, I tried to grant for everything but there is nothing to do
// Permissions for tomcat.
// javac
grant codeBase "file:${java.home}/../lib/-" {
permission java.security.AllPermission;
};
grant {
// Allow everything for now
permission java.security.AllPermission;
};
// Tomcat gets all permissions
grant codeBase "file:${tomcat.home}/lib/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${tomcat.home}/classes/-" {
permission java.security.AllPermission;
};
// Example webapp policy
// By default Tomcat grants read access on webapp dir and read of the
// line.separator, path.separator, and file.separator PropertyPermissions.
// Any permissions you grant here are in addition to the default.
// Disabled for Cobalt Linux
// grant codeBase "file:${tomcat.home}/webapps/matchcote" {
// Allow the example web application to read all java properties
// permission java.util.PropertyPermission "*", "read,write,delete";
// };
grant
{ permission java.util.PropertyPermission "*", "read";
}
grant {
// OS Specific properties to allow read access
permission java.util.PropertyPermission "os.name", "read";
permission java.util.PropertyPermission "os.version", "read";
permission java.util.PropertyPermission "os.arch", "read";
// JVM properties to allow read access
permission java.util.PropertyPermission "java.version", "read";
permission java.util.PropertyPermission "java.vendor", "read";
permission java.util.PropertyPermission "java.vendor.url", "read";
permission java.util.PropertyPermission "java.class.version", "read";
permission java.util.PropertyPermission "java.specification.version", "read";
permission java.util.PropertyPermission "java.specification.vendor", "read";
permission java.util.PropertyPermission "java.specification.name", "read";
permission java.util.PropertyPermission "java.vm.specification.version", "read";
permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
permission java.util.PropertyPermission "java.vm.specification.name", "read";
permission java.util.PropertyPermission "java.vm.version", "read";
permission java.util.PropertyPermission "java.vm.vendor", "read";
permission java.util.PropertyPermission "java.vm.name", "read";
permission java.util.PropertyPermission "line.separator", "read";
permission java.util.PropertyPermission "file.separator", "read";
};
grant codeBase "file:/home/sites/www.matchcote.com/web/-" {
permission java.net.SocketPermission "localhost:1024-", "listen,connect,resolve";
permission java.util.PropertyPermission "*", "read,write";
permission java.lang.RuntimePermission "accessClassInPackage.sun.io";
};
grant codeBase "file:/home/.sites/143/site2/web/-" {
permission SocketPermission "localhost:1024-", "listen,connect,resolve";
permission java.util.PropertyPermission "*", "read,write";
permission java.io.FilePermission "/home/.sites/143/site2/-", "read,write,delete";
permission java.io.FilePermission "/home/.sites/143/site2/web/WEB-INF/classes/*", "read,write";
permission java.lang.RuntimePermission "accessClassInPackage.sun.io";
};
 
Saloon Keeper
Posts: 21254
137
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unlike applets, J2EE servers aren't constrained in their ability to access local files = at least unless you override the standard access rules. However, you can get this error if the Tomcat process doesn't have OS-level access to the file even though you have Java access rights.
Or, in other words, OS access limitations supercede Java permissions.
 
I think I'll just lie down here for a second. And ponder this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!