tomcat-users mailing list archives

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

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 java.security.AllPermission;“)
- 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,
christoph

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

code-snippet:
----------------

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



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message