tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid <...@pidster.com>
Subject Re: Tomcat 5.5 creates 0 byte files
Date Fri, 02 Jul 2010 13:20:20 GMT
On 02/07/2010 14:02, Murat Birben wrote:
> ubuntu 8.04 server

What does the command 'df -k' report?
Please paste the results.


p

> On Fri, Jul 2, 2010 at 3:50 PM, Pid <pid@pidster.com
> <mailto:pid@pidster.com>> wrote:
>=20
>     On 02/07/2010 12:20, Murat Birben wrote:
>     > I'm getting "There is no space left on disk" message when i try t=
o do
>     > some work on the server after this 0 byte files are created
>=20
>     What is your OS and exact version?
>=20
>=20
>     p
>=20
>=20
>     > On Fri, Jul 2, 2010 at 1:13 PM, Pid <pid@pidster.com
>     <mailto:pid@pidster.com>
>     > <mailto:pid@pidster.com <mailto:pid@pidster.com>>> wrote:
>     >
>     >     On 02/07/2010 11:01, Murat Birben wrote:
>     >     > Yes 0 byte files are causing the disk to run out of space
>     >
>     >     You understand my surprise?
>     >
>     >     Are you sure the disk is running out of space, or is it that
>     the number
>     >     of files permitted in a directory has been exceeded?
>     >
>     >
>     >     p
>     >
>     >
>     >     > @Andre Warnier
>     >     > I'm not actually saving files on the server. I just tried t=
o
>     >     simplify my
>     >     > problem and tried that simple code. Now i'll give a try to
>     apache
>     >     > fileupload api, thanks for advice
>     >     >
>     >     > On Fri, Jul 2, 2010 at 11:52 AM, Pid <pid@pidster.com
>     <mailto:pid@pidster.com>
>     >     <mailto:pid@pidster.com <mailto:pid@pidster.com>>
>     >     > <mailto:pid@pidster.com <mailto:pid@pidster.com>
>     <mailto:pid@pidster.com <mailto:pid@pidster.com>>>> wrote:
>     >     >
>     >     >     On 02/07/2010 09:43, Murat Birben wrote:
>     >     >     > Hi all,
>     >     >     >
>     >     >     > I have a very simple file upload mechanism in java. I=

>     just take
>     >     >     the file and
>     >     >     > save it on the server. I'm testing this simple code w=
ith
>     >     selenium
>     >     >     and *when
>     >     >     > a timeout occurs in the selenium test *tomcat creates=

>     0 byte
>     >     files
>     >     >     under
>     >     >     > tomcat_home/work/Catalina/localhost/uploadServlet/
>     directory as
>     >     >     MultiPart*
>     >     >     > files. It creates thousands of files, until there is
>     no disk
>     >     space
>     >     >     left on
>     >     >     > device. What may cause this problem? How can I solve
>     this? Is
>     >     >     there anyone
>     >     >     > has an idea about this?
>     >     >
>     >     >     Thousands of 0 byte files are causing the disk to run o=
ut of
>     >     space?
>     >     >
>     >     >
>     >     >     p
>     >     >
>     >     >     > My environment is: Ubuntu - 8.04 server, apache tomca=
t
>     - 5.5.29,
>     >     >     sun java
>     >     >     > 1.6
>     >     >     >
>     >     >     > Thanks,
>     >     >     >
>     >     >     > Here is the code snippet that i use
>     >     >     >
>     >     >     >         File fFile =3D null;
>     >     >     >         FileOutputStream fileOutputStream =3D null;
>     >     >     >         FileInputStream fileInputStream =3D null;
>     >     >     >         try {
>     >     >     >
>     >     >     >             String strFileName =3D
>     >     request.getParameter("FileName");
>     >     >     >             String strPath =3D request.getParameter("=
Path");
>     >     >     >             //String strMediaType =3D
>     >     request.getParameter("MediaType");
>     >     >     >
>     >     >     >             //String strDescription =3D
>     >     >     request.getParameter("Description");
>     >     >     >             fFile =3D (File)
>     request.getAttribute("Content");
>     >     >     >
>     >     >     >             int index =3D strPath.length() - 1; //If =
the
>     user
>     >     forgets to
>     >     >     > put the last / for the path... We put it for him/her
>     >     >     >
>     >     >     >             if (strPath.charAt(index) !=3D '/') {
>     >     >     >                 strPath +=3D "/";
>     >     >     >             }
>     >     >     >             if (!new File(strPath).exists()) {
>     >     >     >                 new File(strPath).mkdirs();
>     >     >     >             }
>     >     >     >
>     >     >     >             File file =3D new File(strPath + strFileN=
ame);
>     >     >     >             fileOutputStream =3D new FileOutputStream=
(file);
>     >     >     >             fileInputStream =3D new FileInputStream(f=
File);
>     >     >     >
>     >     >     >             byte[] bBuf =3D new byte[1024];
>     >     >     >
>     >     >     >             int iBufLen =3D 0;
>     >     >     >             int iReadLen =3D 1024;
>     >     >     >             int iTotelLen =3D 0;
>     >     >     >             /*read 1024 bytes at a time*/
>     >     >     >             while ((iBufLen =3D
>     fileInputStream.read(bBuf)) !=3D
>     >     -1) {
>     >     >     >
>     >     >     >                 fileOutputStream.write(bBuf);
>     >     >     >                 fileOutputStream.flush();
>     >     >     >                 iTotelLen +=3D iBufLen;
>     >     >     >                 if (fileInputStream.available() <
>     iReadLen) {
>     >     >     >                     iReadLen =3D
>     fileInputStream.available();
>     >     >     >
>     >     >     >                     break;
>     >     >     >                 }
>     >     >     >             }
>     >     >     >
>     >     >     >             byte[] tempbBuf =3D new byte[iReadLen];
>     >     >     >             fileInputStream.read(tempbBuf, 0, iReadLe=
n);
>     >     >     >
>     >     >     >             fileOutputStream.write(tempbBuf);
>     >     >     >
>     >     >     >
>     >     >     >         } catch (IOException ex) {
>     >     >     >             ex.printStackTrace();
>     >     >     >         } finally {
>     >     >     >             fileOutputStream.close();
>     >     >     >             fileInputStream.close();
>     >     >     >
>     >     >     >             if (fFile.exists()) {
>     >     >     >
>     >     >     >                 fFile.delete();
>     >     >     >             }
>     >     >     >         }
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >
>     >     >
>     >     >
>     >     >
>     >     >
>     >     > --
>     >     > Murat BIRBEN
>     >
>     >
>     >
>     >
>     >
>     > --
>     > Murat BIRBEN
>=20
>=20
>=20
>=20
>=20
> --=20
> Murat BIRBEN



Mime
View raw message