FileNotFoundException (file too large)
I am getting this exception when I try to upload a file
Caused by: java.io.FileNotFoundException: /repository/PWWVFSYWDW0STLHYVEEKHMYBXZTTETGROCQ4FGdsadadaXR1407709207964905350810526.jpg (File too large)
at java.io.FileOutputStream.open(Native Method)
It is clear that the file exists. Also, this same program works correctly on my PC, but there is a problem with the server which is Unix
Any ideas what might be causing this?
source to share
I think this is an incomprehensible bug that actually comes from the OS layer or the JVM code implementation. File Too Large is the error you get if you use the perror
C library method to display the error number EFBIG
.
This shouldn't normally happen now. According to UNIX / Linux manual entries, various library calls open
should not interrupt with EFBIG.
However, I have seen various bug reports that imply that fopen
(etcetera) may crash on some filesystems and / or when a C / C ++ program was built to support 64-bit file size.
So what does this mean?
Unclear, but I suspect this means that you either:
-
using flaky Java implementation,
-
starts a debug version of UNIX / Linux, or
-
you are trying to use some type of filesystem that is not supported by your server OS. (Could this be on the FUSE filesystem?)
Possibly Java related error:
- http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7009975 (Java 7 on Solaris.)
source to share
POSIX systems (and therefore Unix) can impose a maximum length on the path (what you get from File.getPath()
or path components (the last one you can get with File.getName()
). Seeing this issue because of the long filename.
In this scenario, the file open
will crash the operating system with an ENAMETOOLONG
error code .
However, the "File Too Large" message is usually associated with an error code EFBIG
. Most likely it will be triggered by a system call write
:
An attempt was made to write a file that exceeds the implementation-specific maximum file size or process file size limit.
Perhaps the file is being opened for appending, and the implied lseek
at the end of the file gives an error EFBIG
.
source to share