我試圖讓我的tomcat的servlet下載多個文件,但我有Apache和Tomcat在同一臺服務器上運行,所以我想這就是爲什麼它不工作。我在不運行Apache的服務器上測試過,一切都很好。的AccessControlException連接到HTTP服務器從Tomcat Servlet時
這裏的時候我嘗試使用新的網址(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)
如何通過Tomcat的運行HTTP下載,而在同一時間運行的Apache?我卡住了嗎?
編輯:
無論我做什麼,我都無法超越tomcat。這裏的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";
};
行顯然,我不明白的問題,因爲我相信我的唯一區別的設置是阿帕奇的存在。我會試試看看它是否有效。使用預配置軟件的危險.... – 2009-10-08 17:20:01
沒有工作。見評論。 – 2009-10-08 19:18:19
更改需要在50local.policy中。 – 2009-10-08 20:10:05