It is on a Linux server, The file system mentions is actually a CIFS mount from 
a windows server. Its not creating a directory, only that file. Odd thing is 
that I can manually create a file in that directory as the user Tomcat is 
running as using touch.

    ​​​​
Shawn   Beard    • Team Lead Middleware
Middleware Engineering
[cid:image919906.png@69DD10BD.86A7ACEB]
3840 109th Street       ,       Urbandale       ,       IA      50322
Phone: +1-515-564-2528<tel:+1-515-564-2528>
Email:  sbe...@wrberkley.com<mailto:sbe...@wrberkley.com>
Website: https://berkleytechnologyservices.com/

Right Team. Right Technology. Simple and Secure.


-----Original Message-----
From: Christopher Schultz <ch...@christopherschultz.net>
Sent: Tuesday, February 6, 2024 4:18 PM
To: users@tomcat.apache.org
Subject: Re: Operation not permitted errors [EXTERNAL]

** CAUTION: External message


Shawn,

On 2/6/24 13:52, Beard, Shawn wrote:
> An application we have running in Tomcat 9 using Java 8 is throwing
> this error when trying to create a file:
>
> java.nio.file.FileSystemException
> /path/to/filesystem/202311WEB/040389461310_08_37_246.jpg: Operation
> not permitted at
> sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
> at
> sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
> at
> sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
> at sun.nio.fs.UnixCopyFile.copyFile(UnixCopyFile.java:283) at
> sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:581) at
> sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:253
> ) at java.nio.file.Files.copy(Files.java:1274) at
> org.apache.commons.io.FileUtils.copyFile(FileUtils.java:850) at
> org.apache.commons.io.FileUtils.copyFile(FileUtils.java:756) at
> com.genexus.specific.java.FileUtils.copyFile(FileUtils.java:45) at
> com.genexus.util.GXFileInfo.copy(GXFileInfo.java:88) at
> com.genexus.util.GXFile.copy(GXFile.java:298) at
> com.binet17.webservices.awsingresodenunciabs_img_impl.privateExecute(a
> wsingresodenunciabs_img_impl.java:477
>
> We have tried opening up permissions on the files and directories,
> adding users to the owner group, entries in the catalina.policy and
> nothing seems to work. Any ideas?

This could be due to a lot of things, and it's unlikely to be related to Tomcat 
itself.

Based upon your file path and stack trace, I suspect you are using a UNIX-like 
operating system. That means it's not likely to be a locking issue like you can 
have on Windows. Those are a real pain to catch in the act. I would check a few 
things:

1. What is the euid and egid of the Tomcat process? Does it jive with the file 
permissions for /path/to/filesystem/2023....blah.jpg? Remember that in order 
for a process to be able to write to a directory, it needs to have execute 
permissions from / all the way down to the last directory in the path.

2. Double-check the UMASK that the process is using. If you are creating 
directories, you'll need to make sure those directories have permissions which 
are appropriate for writing files in there afterward.

3. Remember that the problem could be either the source file or the destination 
file. From your path, I can't tell if the "operation not permitted" is on the 
source or destination.

-chris

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

CONFIDENTIALITY NOTICE: This e-mail and the transmitted documents contain 
private, privileged and confidential information belonging to the sender. The 
information therein is solely for the use of the addressee. If your receipt of 
this transmission has occurred as the result of an error, please immediately 
notify us so we can arrange for the return of the documents. In such 
circumstances, you are advised that you may not disclose, copy, distribute or 
take any other action in reliance on the information transmitted.

Please know that our company will never ask that you transfer money without 
verbal confirmation. If you receive an e-mail from our company or any third 
party purporting to represent our company requesting money be transferred, 
please report it to me immediately. Our company will only transfer money after 
receiving verbal confirmation.

Reply via email to