Shawn,

On 2/7/24 10:48, Beard, Shawn wrote:
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.

Weird.

I wonder if deep down the UNIX-specific "copy" capabilities of commons-io/sun-io are becoming confused with the CIFS-mounted filesystem.

That's really not support to happen, though.

Can you write a simple Java-based program that simulates what's going on to determine if it's a general Java issue or the specific Tomcat-hosted environment that won't work?

-chris

-----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.*

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

Reply via email to