You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by BOSECKER Nancy <Na...@3ds.com> on 2020/06/08 21:54:11 UTC

File access error on Windows Server 2019 after upgrading to Tomcat 8.5.45

I've been tasked with upgrading Tomcat from 8.5.41, but have run into a problem that begins with release 8.5.45. Hopefully someone here can help.

I have a servlet that tries to update a file that was previously written by a separate servlet. Prior to 8.5.45, this works as expected and the file is updated.

In 8.5.45, I get the Java error: File not Found exception - Access is denied. The file exists and is readable, but must be being held onto by some unknown process. I've tried Windows process manager and resource manager, but neither of these can tell me what is holding the file handle. I can open the file in an editor with no error. I can also delete the file without any error.

Note that the error occurs on Windows Server 2019. When I run the same code on Windows 10 there is no error.

Thanks!
Nancy

This email and any attachments are intended solely for the use of the individual or entity to whom it is addressed and may be confidential and/or privileged.

If you are not one of the named recipients or have received this email in error,

(i) you should not read, disclose, or copy it,

(ii) please notify sender of your receipt by reply email and delete this email and all attachments,

(iii) Dassault Syst?mes does not accept or assume any liability or responsibility for any use of or reliance on this email.


Please be informed that your personal data are processed according to our data privacy policy as described on our website. Should you have any questions related to personal data protection, please contact 3DS Data Protection Officer at 3DS.compliance-privacy@3ds.com<ma...@3ds.com>


For other languages, go to https://www.3ds.com/terms/email-disclaimer

Re: File access error on Windows Server 2019 after upgrading to Tomcat 8.5.45

Posted by Bill Stewart <bs...@iname.com>.
On Tue, Jun 9, 2020 at 9:56 AM calder wrote:

> A bit off-topic, but wanted to jump in and clear this up, as the Java
> error messages are somewhat misleading.

Thanks for the clarification.

Regards

Bill

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


RE: File access error on Windows Server 2019 after upgrading to Tomcat 8.5.45

Posted by BOSECKER Nancy <Na...@3ds.com>.
>> Also, "file not found" is not the same as "access denied". You should
>> post the exact error line(s) from your log.

>A bit off-topic, but wanted to jump in and clear this up, as the Java error messages are somewhat misleading.
>If I write a class to open a read-only file with java.io.FileOutputStream, I will see this stack trace

>calder@stimpy:~/bin> ./jdk180-221/bin/java AccessDenied
>java.io.FileNotFoundException: tester.txt (Permission denied)
        at java.io.FileOutputStream.open0(Native Method) ...
>calder@stimpy:~/bin> ls -l tester.txt
>-r--r--r-- 1 calder users 0 Jun  9 10:12 tester.txt

>FileOutputStream ctors and methods throw the FileNotFoundException and the more specific error [in this case] is "Permission denied".
>So yea, it's confusing.

>If you check the source code for FileNotFoundException, we even see a comment related to this [quote] This exception will be thrown by the {@link FileInputStream}, {@link  FileOutputStream}, and {@link RandomAccessFile} constructors when a file  with the >specified pathname does not exist.  It will also be thrown by these  constructors if the file does exist but for some reason is inaccessible, for  example when an attempt is made to open a read-only file for writing.
>[/quote]

I agree it is confusing. In my case, the error thrown from Java 'new FileOutputStream(file)' is:
java.io.FileNotFoundException: <path to file> (Access is denied)

Since the file exists and is readable (per Java checks), I assumed the 'for some reason is inaccessible' meant the file was opened somewhere else. But it seems it may actually be the default Tomcat user having less privileges.
This email and any attachments are intended solely for the use of the individual or entity to whom it is addressed and may be confidential and/or privileged.

If you are not one of the named recipients or have received this email in error,

(i) you should not read, disclose, or copy it,

(ii) please notify sender of your receipt by reply email and delete this email and all attachments,

(iii) Dassault Systèmes does not accept or assume any liability or responsibility for any use of or reliance on this email.


Please be informed that your personal data are processed according to our data privacy policy as described on our website. Should you have any questions related to personal data protection, please contact 3DS Data Protection Officer at 3DS.compliance-privacy@3ds.com<ma...@3ds.com>


For other languages, go to https://www.3ds.com/terms/email-disclaimer

Re: File access error on Windows Server 2019 after upgrading to Tomcat 8.5.45

Posted by calder <ca...@gmail.com>.
On Tue, Jun 9, 2020 at 8:08 AM Bill Stewart <bs...@iname.com> wrote:
[ snip ]
> Also, "file not found" is not the same as "access denied". You should
> post the exact error line(s) from your log.

A bit off-topic, but wanted to jump in and clear this up, as the Java
error messages are somewhat misleading.
If I write a class to open a read-only file with
java.io.FileOutputStream, I will see this stack trace

calder@stimpy:~/bin> ./jdk180-221/bin/java AccessDenied
java.io.FileNotFoundException: tester.txt (Permission denied)
        at java.io.FileOutputStream.open0(Native Method)
...
calder@stimpy:~/bin> ls -l tester.txt
-r--r--r-- 1 calder users 0 Jun  9 10:12 tester.txt

FileOutputStream ctors and methods throw the FileNotFoundException and
the more specific error [in this case] is "Permission denied".
So yea, it's confusing.

If you check the source code for FileNotFoundException, we even see a
comment related to this
[quote]
This exception will be thrown by the {@link FileInputStream}, {@link
 FileOutputStream}, and {@link RandomAccessFile} constructors when a file
 with the specified pathname does not exist.  It will also be thrown by these
 constructors if the file does exist but for some reason is inaccessible, for
 example when an attempt is made to open a read-only file for writing.
[/quote]

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


Re: File access error on Windows Server 2019 after upgrading to Tomcat 8.5.45

Posted by Bill Stewart <bs...@iname.com>.
On Mon, Jun 8, 2020 at 3:54 PM BOSECKER Nancy wrote:

> In 8.5.45, I get the Java error: File not Found exception -
> Access is denied. The file exists and is readable, but must be
> being held onto by some unknown process. I've tried Windows
> process manager and resource manager, but neither of these can
> tell me what is holding the file handle. I can open the file in
> an editor with no error. I can also delete the file without any
> error.

Your assumption that the file is being held open by an unknown process
may not be correct.

The ability to write/update/delete files is based on the account being
used to run Tomcat.

Also, "file not found" is not the same as "access denied". You should
post the exact error line(s) from your log.

Bill

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


RE: File access error on Windows Server 2019 after upgrading to Tomcat 8.5.45

Posted by BOSECKER Nancy <Na...@3ds.com>.
> I've been tasked with upgrading Tomcat from 8.5.41, but have run into a problem that begins with release 8.5.45. Hopefully someone here can help.
>>What was the last version where this worked? 8.5.43? I ask as 8.5.44 was not formally released.

8.5.43 worked, 8.5.45 does not.

>>This might be related to the user Tomcat is running under. As of 8.5.44 the default user is LocalService rather than LocalSystem. LocalService has fewer privileges.

Great, I didn't realize this changed, and it seems likely to be my problem. Thank you very much!

This email and any attachments are intended solely for the use of the individual or entity to whom it is addressed and may be confidential and/or privileged.

If you are not one of the named recipients or have received this email in error,

(i) you should not read, disclose, or copy it,

(ii) please notify sender of your receipt by reply email and delete this email and all attachments,

(iii) Dassault Systèmes does not accept or assume any liability or responsibility for any use of or reliance on this email.


Please be informed that your personal data are processed according to our data privacy policy as described on our website. Should you have any questions related to personal data protection, please contact 3DS Data Protection Officer at 3DS.compliance-privacy@3ds.com<ma...@3ds.com>


For other languages, go to https://www.3ds.com/terms/email-disclaimer

RE: File access error on Windows Server 2019 after upgrading to Tomcat 8.5.45

Posted by jo...@wellsfargo.com.INVALID.
Thank you!


Dream * Excel * Explore * Inspire
Jon McAlexander
Asst Vice President

Middleware Product Engineering
Enterprise CIO | Platform Services | Middleware | Infrastructure Solutions

8080 Cobblestone Rd | Urbandale, IA 50322
MAC: F4469-010
Tel 515-988-2508 | Cell 515-988-2508

jonmcalexander@wellsfargo.com


This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation.


-----Original Message-----
From: Mark Thomas <ma...@apache.org> 
Sent: Wednesday, June 10, 2020 10:59 AM
To: users@tomcat.apache.org
Subject: Re: File access error on Windows Server 2019 after upgrading to Tomcat 8.5.45

On 09/06/2020 17:22, jonmcalexander@wellsfargo.com.INVALID wrote:
> Mark,
> 
> Was the change with 8.5.44 implemented when you run the service.bat file?

It should be. The change was made in Commons Daemon (the .exe files) so it should apply however you install the service.

Mark


> 
> Thanks,
> 
> 
> Dream * Excel * Explore * Inspire
> Jon McAlexander
> Asst Vice President
> 
> Middleware Product Engineering
> Enterprise CIO | Platform Services | Middleware | Infrastructure 
> Solutions
> 
> 8080 Cobblestone Rd | Urbandale, IA 50322
> MAC: F4469-010
> Tel 515-988-2508 | Cell 515-988-2508
> 
> jonmcalexander@wellsfargo.com
> 
> 
> This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation.
> 
> 
> -----Original Message-----
> From: Mark Thomas <ma...@apache.org>
> Sent: Tuesday, June 9, 2020 8:46 AM
> To: users@tomcat.apache.org
> Subject: Re: File access error on Windows Server 2019 after upgrading 
> to Tomcat 8.5.45
> 
> On 08/06/2020 22:54, BOSECKER Nancy wrote:
>> I've been tasked with upgrading Tomcat from 8.5.41, but have run into a problem that begins with release 8.5.45. Hopefully someone here can help.
> 
> What was the last version where this worked? 8.5.43? I ask as 8.5.44 was not formally released.
> 
>> I have a servlet that tries to update a file that was previously written by a separate servlet. Prior to 8.5.45, this works as expected and the file is updated.
>>
>> In 8.5.45, I get the Java error: File not Found exception - Access is denied. The file exists and is readable, but must be being held onto by some unknown process. I've tried Windows process manager and resource manager, but neither of these can tell me what is holding the file handle. I can open the file in an editor with no error. I can also delete the file without any error.
>>
>> Note that the error occurs on Windows Server 2019. When I run the same code on Windows 10 there is no error.
> 
> This might be related to the user Tomcat is running under. As of 8.5.44 the default user is LocalService rather than LocalSystem. LocalService has fewer privileges.
> 
> Mark
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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


Re: File access error on Windows Server 2019 after upgrading to Tomcat 8.5.45

Posted by Mark Thomas <ma...@apache.org>.
On 09/06/2020 17:22, jonmcalexander@wellsfargo.com.INVALID wrote:
> Mark,
> 
> Was the change with 8.5.44 implemented when you run the service.bat file?

It should be. The change was made in Commons Daemon (the .exe files) so
it should apply however you install the service.

Mark


> 
> Thanks,
> 
> 
> Dream * Excel * Explore * Inspire
> Jon McAlexander
> Asst Vice President
> 
> Middleware Product Engineering
> Enterprise CIO | Platform Services | Middleware | Infrastructure Solutions
> 
> 8080 Cobblestone Rd | Urbandale, IA 50322
> MAC: F4469-010
> Tel 515-988-2508 | Cell 515-988-2508
> 
> jonmcalexander@wellsfargo.com
> 
> 
> This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation.
> 
> 
> -----Original Message-----
> From: Mark Thomas <ma...@apache.org> 
> Sent: Tuesday, June 9, 2020 8:46 AM
> To: users@tomcat.apache.org
> Subject: Re: File access error on Windows Server 2019 after upgrading to Tomcat 8.5.45
> 
> On 08/06/2020 22:54, BOSECKER Nancy wrote:
>> I've been tasked with upgrading Tomcat from 8.5.41, but have run into a problem that begins with release 8.5.45. Hopefully someone here can help.
> 
> What was the last version where this worked? 8.5.43? I ask as 8.5.44 was not formally released.
> 
>> I have a servlet that tries to update a file that was previously written by a separate servlet. Prior to 8.5.45, this works as expected and the file is updated.
>>
>> In 8.5.45, I get the Java error: File not Found exception - Access is denied. The file exists and is readable, but must be being held onto by some unknown process. I've tried Windows process manager and resource manager, but neither of these can tell me what is holding the file handle. I can open the file in an editor with no error. I can also delete the file without any error.
>>
>> Note that the error occurs on Windows Server 2019. When I run the same code on Windows 10 there is no error.
> 
> This might be related to the user Tomcat is running under. As of 8.5.44 the default user is LocalService rather than LocalSystem. LocalService has fewer privileges.
> 
> Mark
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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


RE: File access error on Windows Server 2019 after upgrading to Tomcat 8.5.45

Posted by jo...@wellsfargo.com.INVALID.
Mark,

Was the change with 8.5.44 implemented when you run the service.bat file?

Thanks,


Dream * Excel * Explore * Inspire
Jon McAlexander
Asst Vice President

Middleware Product Engineering
Enterprise CIO | Platform Services | Middleware | Infrastructure Solutions

8080 Cobblestone Rd | Urbandale, IA 50322
MAC: F4469-010
Tel 515-988-2508 | Cell 515-988-2508

jonmcalexander@wellsfargo.com


This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation.


-----Original Message-----
From: Mark Thomas <ma...@apache.org> 
Sent: Tuesday, June 9, 2020 8:46 AM
To: users@tomcat.apache.org
Subject: Re: File access error on Windows Server 2019 after upgrading to Tomcat 8.5.45

On 08/06/2020 22:54, BOSECKER Nancy wrote:
> I've been tasked with upgrading Tomcat from 8.5.41, but have run into a problem that begins with release 8.5.45. Hopefully someone here can help.

What was the last version where this worked? 8.5.43? I ask as 8.5.44 was not formally released.

> I have a servlet that tries to update a file that was previously written by a separate servlet. Prior to 8.5.45, this works as expected and the file is updated.
> 
> In 8.5.45, I get the Java error: File not Found exception - Access is denied. The file exists and is readable, but must be being held onto by some unknown process. I've tried Windows process manager and resource manager, but neither of these can tell me what is holding the file handle. I can open the file in an editor with no error. I can also delete the file without any error.
> 
> Note that the error occurs on Windows Server 2019. When I run the same code on Windows 10 there is no error.

This might be related to the user Tomcat is running under. As of 8.5.44 the default user is LocalService rather than LocalSystem. LocalService has fewer privileges.

Mark

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


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


Re: File access error on Windows Server 2019 after upgrading to Tomcat 8.5.45

Posted by Mark Thomas <ma...@apache.org>.
On 08/06/2020 22:54, BOSECKER Nancy wrote:
> I've been tasked with upgrading Tomcat from 8.5.41, but have run into a problem that begins with release 8.5.45. Hopefully someone here can help.

What was the last version where this worked? 8.5.43? I ask as 8.5.44 was
not formally released.

> I have a servlet that tries to update a file that was previously written by a separate servlet. Prior to 8.5.45, this works as expected and the file is updated.
> 
> In 8.5.45, I get the Java error: File not Found exception - Access is denied. The file exists and is readable, but must be being held onto by some unknown process. I've tried Windows process manager and resource manager, but neither of these can tell me what is holding the file handle. I can open the file in an editor with no error. I can also delete the file without any error.
> 
> Note that the error occurs on Windows Server 2019. When I run the same code on Windows 10 there is no error.

This might be related to the user Tomcat is running under. As of 8.5.44
the default user is LocalService rather than LocalSystem. LocalService
has fewer privileges.

Mark

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