7

I am getting this exception when trying to download a file

Caused by: java.io.FileNotFoundException: /repository/PWWVFSYWDW0STLHYVEEKHMYBXZTTETGROCQ4FGdsadadaXR1407709207964905350810526.jpg (File too large)
at java.io.FileOutputStream.open(Native Method)

It is clear that file the exists. In addition to that, the same program works properly on my PC, but there is a problem with the server, which is Unix

Any ideas what might be causing this?

Raedwald
  • 46,613
  • 43
  • 151
  • 237
Poyraz
  • 359
  • 1
  • 5
  • 12
  • Is there really the file exists? Are you sure? what do you mean by **File too large**? – Keerthivasan Aug 11 '14 at 11:34
  • Maybe simply "file is not found"? – Eel Lee Aug 11 '14 at 11:35
  • Could you post the code snippet that you use? – Uğurcan Şengit Aug 11 '14 at 11:35
  • 1
    Name mentioned by you PWWVFSYW......jpg is I think problematic becuase in windows some times we are getting error related to this. Sometimes it is happened that file path is also large in which case it may be occur. so please check that once. – hcl Aug 11 '14 at 11:36
  • 1
    it is clear that file is exist.. in addition to that same process working properly my local pc but there is a problem with the server which is unix – Poyraz Aug 11 '14 at 11:39
  • for a long time, it had been used by clients without any problem – Poyraz Aug 11 '14 at 11:43
  • I'm seeing old notes on websites indicating a bug in some versions of unix related to files over 2Gb. How big is the file being downloaded? – arcy Aug 11 '14 at 12:18
  • I get this when I try to do `FileReader fr = new FileReader("");`. Note to self: supply a filename next time – demongolem Dec 21 '17 at 22:44

6 Answers6

1

I think that this is an obscure error that is actually coming from the OS level or the JVM's native code implementation. The message "File too large" is the error message that you would get if the perror C library method was used to render the EFBIG error number.

Now ordinarily, this should not happen. According to the UNIX / Linux manual entries, the various open library calls should not fail with EFBIG.

However, I have seen various error reports that imply that fopen (etcetera) can fail like that on some file systems, and/or when the a C / C++ program has been built with 64bit file size support disabled.


So what does this mean?

It is not clear, but I suspect that it means that you are either:

  • using a flaky implementation of Java,

  • running a flaky release of UNIX / Linux, or

  • you are trying to use some type of file system that is not well supported by your server's OS. (Might it be on a FUSE file system?)

A possibly related Java bug:

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
1

So , it is solved. The problem is that, disk is full as a result stream takes long time, I clean up the disk after that there is no problem,

Poyraz
  • 359
  • 1
  • 5
  • 12
1

I received this message when trying to write a file to a directory on a RedHat server that already had the maximum number of files in it. I subdivided my files into subdirectories and the error did not reappear.

duhaime
  • 25,611
  • 17
  • 169
  • 224
0

POSIX (and thus Unix) systems are allowed to impose a maximum length on the path (what you get from File.getPath() or the components of a path (the last of which you can get with File.getName()). You might be seeing this problem because of the long name for the file.

In that case, the file open operating system call will fail with an ENAMETOOLONG error code.

However, the message "File too large" is typically associated with the EFBIG error code. That is more likely to result from a write system call:

An attempt was made to write a file that exceeds the implementation-dependent maximum file size or the process' file size limit.

Perhaps the file is being opened for appending, and the implied lseek to the end of the file is giving the EFBIG error.

Raedwald
  • 46,613
  • 43
  • 151
  • 237
0

Irrespective of the JVM error output (which might be misleading or slightly off), you may want to check the that your Unix process has enough open file handles. Exhausting process file handles can lead to all kinds of FS-related error codes.

mgaert
  • 2,338
  • 21
  • 27
0
problem: 
java.io.FileNotFoundException: /sent/plain/2009/04/Sterling_AS2_to_edt_AS2_Sterling_SJMVM00 A.20090429115945.All_to_cil_QM_214.GS13173.cgs_to_cil.PR120301900.node (File too large)

Files that do not have a very long filename are successfully written out to the same directory.

solution:
Reduce the assign filename length or remove older archived files with the longer filenames from that directory and try again.
Ali Tofigh
  • 116
  • 5