I'm trying to make my tomcat servlet download a number of files, but I have apache and tomcat running on the same server, so I assume that is why it doesn't work. I've tested on servers not running apache, and all is well.
Here's the exception I'm getting when I try to use new Url( fileUrl ).openStream():
Opening input stream Attempted to download: http://www.stefankendall.com/files/test.txt java.security.AccessControlException: access denied (java.net.SocketPermission www.stefankendall.com:80 connect,resolve)
How can I run http downloads via tomcat while running apache at the same time? Am I stuck?
EDIT:
No matter what I do, I can't get past tomcat. Here's 03catalina.policy:
// ========== CATALINA CODE PERMISSIONS =======================================
// These permissions apply to the logging API
grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" {
permission java.util.PropertyPermission "java.util.logging.config.class", "read";
permission java.util.PropertyPermission "java.util.logging.config.file", "read";
permission java.lang.RuntimePermission "shutdownHooks";
permission java.io.FilePermission "${catalina.base}${file.separator}conf${file.separator}logging.properties", "read";
permission java.util.PropertyPermission "catalina.base", "read";
permission java.util.logging.LoggingPermission "control";
permission java.io.FilePermission "${catalina.base}${file.separator}logs", "read, write";
permission java.io.FilePermission "${catalina.base}${file.separator}logs${file.separator}*", "read, write";
permission java.lang.RuntimePermission "getClassLoader";
// To enable per context logging configuration, permit read access to the appropriate file.
// Be sure that the logging configuration is secure before enabling such access
// eg for the examples web application:
// permission java.io.FilePermission "${catalina.base}${file.separator}webapps${file.separator}examples${file.separator}WEB-INF${file.separator}classes${file.separator}logging.properties", "read";
};
// These permissions apply to the server startup code
grant codeBase "file:${catalina.home}/bin/bootstrap.jar" {
permission java.security.AllPermission;
permission java.net.socketPermission "*:80", "connect, resolve";
};
// These permissions apply to the servlet API classes
// and those that are shared across all class loaders
// located in the "lib" directory
grant codeBase "file:${catalina.home}/lib/-" {
permission java.security.AllPermission;
permission java.net.socketPermission "*:80", "connect, resolve";
};
grant codeBase "file:${catalina.home}/webapps/-" {
permission java.security.AllPermission;
permission java.net.socketPermission "*:80", "connect, resolve";
};