Creating a directory from a webapp

2010-03-04 Thread Florent Georges
  Hi,

  Within my webapp, I try to create a new directory on the file
system by using File.mkdir().  This webapp has the permissions
read  write on the parent directory:

grant codeBase file:${catalina.base}/webapps/myapp/- {
  permission java.io.FilePermission /somewhere/-, read,write;
}

  The creation fails, but of course, I do not have any info
(because mkdir returns true or false instead of throwing an
exception).

  Is there anything else I could check out?  I cannot find any
clue of what I did wrong.

  Regards,

-- 
Florent Georges
http://www.fgeorges.org/





-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Creating a directory from a webapp

2010-03-04 Thread Peter Crowther
On 4 March 2010 10:40, Florent Georges li...@fgeorges.org wrote:

  Hi,

  Within my webapp, I try to create a new directory on the file
 system by using File.mkdir().  This webapp has the permissions
 read  write on the parent directory:

grant codeBase file:${catalina.base}/webapps/myapp/- {
  permission java.io.FilePermission /somewhere/-, read,write;
}

  The creation fails, but of course, I do not have any info
 (because mkdir returns true or false instead of throwing an
 exception).

 Can you run Tomcat with something that traces system calls?  strace(1) on
most UNIXes, Process Explorer on Windows.  Then you can see exactly what
mkdir call is being issued - or, if none is issued, you can see that and
chase down why.

- Peter


Re: Creating a directory from a webapp

2010-03-04 Thread Konstantin Kolinko
2010/3/4 Florent Georges li...@fgeorges.org:
  Is there anything else I could check out?  I cannot find any
 clue of what I did wrong.
 File.mkdir()

Try with File.mkdirs()

Note, that catalina.policy is only used when you are running with a
SecurityManager enabled. (Many people run without it).

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Creating a directory from a webapp

2010-03-04 Thread Florent Georges
Konstantin Kolinko wrote:


  Is there anything else I could check out?  I cannot find any
 clue of what I did wrong.
 File.mkdir()

 Try with File.mkdirs()

  Thanks.  But the parent dir does exists and yes, I've tried that without 
success ;-)

 Note, that catalina.policy is only used when you are running with a
 SecurityManager enabled. (Many people run without it).


  Yes.  But it is enabled (this is a virtual box with the Tomcat fro the APT 
system on a Ubuntu server, which will be at the end of the day in production).

  I will try to use strace(1) to get more infos.  I suspect that's a permission 
issue.  Is there a simple way to disable the security manager in order to be 
sure this is such an issue?

  Regards,

-- 
Florent Georges
http://www.fgeorges.org/





-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Creating a directory from a webapp

2010-03-04 Thread Konstantin Kolinko
2010/3/4 Florent Georges li...@fgeorges.org:
  Is there a simple way to disable the security manager in order to be sure 
 this is such an issue?

There is a setting somewhere. I do not run Ubuntu and thus do not know
exactly, but it was mentioned several times in the archives of this
list.

At least, you can replace your catalina.policy with
grant {
permission java.security.AllPermission;
};

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Creating a directory from a webapp

2010-03-04 Thread Florent Georges
Konstantin Kolinko wrote:

 At least, you can replace your catalina.policy with
 grant {
   permission java.security.AllPermission;
 };

  Good to know, thanks for the hint!

  In the meantime, using strace, I figured out what the problem
was: as simple as a wrong owner of one of the parent directories.
I must admit I am not really proud of this, but well, there is no
diagnostic at all with mkdir() :-(

  Thanks all,

-- 
Florent Georges
http://www.fgeorges.org/





-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Creating a directory from a webapp

2010-03-04 Thread Peter Crowther
On 4 March 2010 15:43, Florent Georges li...@fgeorges.org wrote:

 In the meantime, using strace, I figured out what the problem
 was: as simple as a wrong owner of one of the parent directories.
 I must admit I am not really proud of this, but well, there is no
 diagnostic at all with mkdir() :-(

 Glad you found it - that's what the diagnostic tools are for!

- Peter