tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Meier <>
Subject Problems with writting to the filesystem, ... "Permission-Problem"?
Date Wed, 28 Apr 2004 23:32:36 GMT

I want to write files from scratch to the local file-system.
Shortly said, aFile.mkdirs() fails, if the parent dir of aFile does not 
already exist.
mkdirs() returns false and the followning aFile.createNewFile() throws 
an IOException.

Actually i want to do this from a class within a Tomcat-WebApp, this 
fails, yet.
When i do exactly the same from a class wich i can start from the shell 
(by its static void main()) it works! (-> TestClass)

File-Permissions (e.g. rwx, but i tried several 
File-System-Permission-combinations) are exactly identical for the class 
within the Tomcat-App and for the TestClass, the same is true for the 
user which runs the Tomcat-Process or starts the TestClass.

Comparing the behaviour of the TestClass with the Tomcat-WebApp-Class 
may indicate that the failure of the WebApp-Class is due to some 
„Tomcat-Permissions“ ... ...

Well, when starting Tomcat without security-option, no 
security-Permission – or a default – is applied, i thought. (default i 
understand like „permission;“)
- but what the f... is prohibiting to create the directories in the 
WebApp comapred to the TestClass ...

I also tried it by starting tomcat with the security-option pointing to 
a cataliny.policy allowing +/- all .....
Has anyone a concrete hint or an idea why it works with the TestClass 
but not within the Tomcat-WebApp and what i could do to solve the problem?

Thanks in advance,
kind regards,

System: running Tomcat 5.19 on a Linux with a jre1.4.2


File aFile = new File(aFilePath);
if (!aFile.mkdirs()){
if (aFile.exists()){
if (!aFile.delete()){
try {
} catch (IOException e) {
// adding some xml into the file ...

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message