You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Elias Kopsiaftis <ye...@gmail.com> on 2013/02/26 02:14:53 UTC

Tomcat wont allow me to create files

I am running a webapp on Tomcat 7 and I am using log4j for logging.
However, log4j cannot create a log file and Im getting a permission denied
error in the catalina.out file. I am runnning on linux, and made sure that
the current working directory(which I got by printing it from within the
application), /var/lib/tomcat7, and all its subdirectories were in the
tomcat7 group, which should give the web app permissions to create files,
but its not working. any suggestions?

Re: Tomcat wont allow me to create files

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

André,

On 2/26/13 12:02 AM, André Warnier wrote:
> Hi. Do not top-post. Follow the example of the previous person who 
> answered your request.
> 
> Elias Kopsiaftis wrote:
>> 
>> On Mon, Feb 25, 2013 at 8:39 PM, Ben Stringer <be...@burbong.com>
>> wrote:
>> 
>>> 
>>> On 26/02/2013, at 12:14 PM, Elias Kopsiaftis
>>> <ye...@gmail.com> wrote:
>>> 
>>>> I am running a webapp on Tomcat 7 and I am using log4j for
>>>> logging. However, log4j cannot create a log file and Im
>>>> getting a permission
>>> denied
>>>> error in the catalina.out file. I am runnning on linux, and
>>>> made sure
>>> that
>>>> the current working directory(which I got by printing it from
>>>> within the application), /var/lib/tomcat7, and all its
>>>> subdirectories were in the tomcat7 group, which should give
>>>> the web app permissions to create files, but its not working.
>>>> any suggestions?
>>> Hi Elias,
>>> 
>>> That directory will also need "group write" permission set.
>>> Best way to work through this problem is to "sudo" to the
>>> userid that will be running tomcat, then try and create a file
>>> in that directory from the shell.
>>> 
>>> If it is the group write that is missing, this command will add
>>> it:
>>> 
>>> chmod g+w /var/lib/tomcat7
>>> 
>>> But that is not where you should be writing logs. /var/log is
>>> a conventional place to keep logs. What is your log4j
>>> configuration?
>>> 
> 
>> Hi Ben,
>> 
>> I didnt mention that but I did check that write permissions were
>> on. Currently I dont have a log4j configuration. I am just trying
>> to get
> it to
>> work.
> 
> You need to check where log4j is (trying to) writing its logfiles.
> That is part of your log4j configuration.

Also, Elias, are you running under a SecuritManager? If so, you'll
have to adjust permissions in your policy file.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEs0CAACgkQ9CaO5/Lv0PCPgQCgucSbG2gpDLf9pLiivDtp05Lz
2UUAni1IaI1HPV66qjPTCs58ZDlxD4+w
=YCvx
-----END PGP SIGNATURE-----

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


Re: Tomcat wont allow me to create files

Posted by André Warnier <aw...@ice-sa.com>.
Hi. Do not top-post. Follow the example of the previous person who answered your request.

Elias Kopsiaftis wrote:
> 
> On Mon, Feb 25, 2013 at 8:39 PM, Ben Stringer <be...@burbong.com> wrote:
> 
>>
>> On 26/02/2013, at 12:14 PM, Elias Kopsiaftis <ye...@gmail.com> wrote:
>>
>>> I am running a webapp on Tomcat 7 and I am using log4j for logging.
>>> However, log4j cannot create a log file and Im getting a permission
>> denied
>>> error in the catalina.out file. I am runnning on linux, and made sure
>> that
>>> the current working directory(which I got by printing it from within the
>>> application), /var/lib/tomcat7, and all its subdirectories were in the
>>> tomcat7 group, which should give the web app permissions to create files,
>>> but its not working. any suggestions?
>> Hi Elias,
>>
>> That directory will also need "group write" permission set. Best way to
>> work through this problem is to "sudo" to the userid that will be running
>> tomcat, then try and create a file in that directory from the shell.
>>
>> If it is the group write that is missing, this command will add it:
>>
>> chmod g+w /var/lib/tomcat7
>>
>> But that is not where you should be writing logs. /var/log is a
>> conventional place to keep logs. What is your log4j configuration?
>>

 > Hi Ben,
 >
 > I didnt mention that but I did check that write permissions were on.
 > Currently I dont have a log4j configuration. I am just trying to get it to
 > work.

You need to check where log4j is (trying to) writing its logfiles. That is part of your 
log4j configuration.


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


Re: Tomcat wont allow me to create files

Posted by Elias Kopsiaftis <ye...@gmail.com>.
Hi Ben,

I didnt mention that but I did check that write permissions were on.
Currently I dont have a log4j configuration. I am just trying to get it to
work.

On Mon, Feb 25, 2013 at 8:39 PM, Ben Stringer <be...@burbong.com> wrote:

>
>
> On 26/02/2013, at 12:14 PM, Elias Kopsiaftis <ye...@gmail.com> wrote:
>
> > I am running a webapp on Tomcat 7 and I am using log4j for logging.
> > However, log4j cannot create a log file and Im getting a permission
> denied
> > error in the catalina.out file. I am runnning on linux, and made sure
> that
> > the current working directory(which I got by printing it from within the
> > application), /var/lib/tomcat7, and all its subdirectories were in the
> > tomcat7 group, which should give the web app permissions to create files,
> > but its not working. any suggestions?
>
> Hi Elias,
>
> That directory will also need "group write" permission set. Best way to
> work through this problem is to "sudo" to the userid that will be running
> tomcat, then try and create a file in that directory from the shell.
>
> If it is the group write that is missing, this command will add it:
>
> chmod g+w /var/lib/tomcat7
>
> But that is not where you should be writing logs. /var/log is a
> conventional place to keep logs. What is your log4j configuration?
>
> Cheers, Ben
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Tomcat wont allow me to create files

Posted by Ben Stringer <be...@burbong.com>.

On 26/02/2013, at 12:14 PM, Elias Kopsiaftis <ye...@gmail.com> wrote:

> I am running a webapp on Tomcat 7 and I am using log4j for logging.
> However, log4j cannot create a log file and Im getting a permission denied
> error in the catalina.out file. I am runnning on linux, and made sure that
> the current working directory(which I got by printing it from within the
> application), /var/lib/tomcat7, and all its subdirectories were in the
> tomcat7 group, which should give the web app permissions to create files,
> but its not working. any suggestions?

Hi Elias,

That directory will also need "group write" permission set. Best way to work through this problem is to "sudo" to the userid that will be running tomcat, then try and create a file in that directory from the shell.

If it is the group write that is missing, this command will add it:

chmod g+w /var/lib/tomcat7

But that is not where you should be writing logs. /var/log is a conventional place to keep logs. What is your log4j configuration?

Cheers, Ben
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org