Hello,
I am having problems making my webapps capable of doing read/write
statements. They fail with an 'permission denied' exception.
The webapps run on the server with Plesk 8.1.1 and Tomcat 5.5.23-0jpp.2.fc6
installed.
I use simple statements like:
----------------------------------------------------------------------------
----------------------------------------------
try {
FileWriter filewriter = new
FileWriter("/var/www/vhosts/mydomain/httpdocs/test.html");
filewriter.write("Testline\n");
filewriter.close();
}
catch (IOException ex) {
}
----------------------------------------------------------------------------
----------------------------------------------
AND
----------------------------------------------------------------------------
----------------------------------------------
Result = new File("/var/www/vhosts/mydomain/httpdocs/testdir").mkdirs();
----------------------------------------------------------------------------
----------------------------------------------
I have done a lot of research and testing, but al didn't work out:
1. Modifying catalina.policy:
grant codeBase "file:${catalina.home}/psa-webapps/mydomain/-" {
permission java.io.FilePermission "/var/www/vhosts/asbreuk.biz/httpdocs/-",
"read";
permission java.io.FilePermission "/var/www/vhosts/asbreuk.biz/httpdocs/-",
"write";
permission java.io.FilePermission "/var/www/vhosts/asbreuk.biz/httpdocs/-",
"delete";
}
2. Modifying catalina.policy:
grant codeBase "file:${catalina.home}/psa-webapps/mydomain/-" {
permission java.security.AllPermission;
}
3. Modifying catalina.policy:
grant {
.....
.....
permission java.security.AllPermission;
}
4. I have tried to modify files & directories in different places. The
idea was that perhaps some directories worked out fine and others were
denied.
In practice all directories failed.
5. Searched the Tomat documentation:
http://tomcat.apache.org/tomcat-5.5-doc/security-manager-howto.html
All is said that modifying catalina.policy should do the trick. (not in my
case.)
6. Searched the Tomcat FAQ:
All is said that modifying catalina.policy should do the trick.
7. Searched on Google:
No solutions found. I found some interesting subject on the java-forum
though:
http://forum.java.sun.com/thread.jspa?threadID=5134898
<http://forum.java.sun.com/thread.jspa?threadID=5134898&messageID=9494541>
&messageID=9494541
In the end of this subject, it is said that the problem was solved by
upgrading from Tomcat 5.5. to Tomcat 6.0
Unfortunately, I cannot do this, because Tomcat 5.5.23-0jpp.2.fc6 is part of
Plesk 8.1.1.
Could you please help me out of this?
Kind Regards,
Marco.