commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Priest" <Robert.Pri...@bentley.com>
Subject RE: FileUpload\Windows 2003 Server\Tomcat
Date Thu, 28 Oct 2004 15:06:00 GMT
> Or, I think there is something about the threshold only being used for
certain things.

I even tried bumping the threshold up:

   upload.setSizeThreshold(10240); 

But I still got the same error.

-----Original Message-----
From: Robert Priest 
Sent: Thursday, October 28, 2004 10:30 AM
To: Jakarta Commons Users List
Subject: RE: FileUpload\Windows 2003 Server\Tomcat

 Hello Dakota Jack,

I am using the latest version of fileupload
(commons-fileupload-1.1-dev.jar), which is using the latest version of
commons-io-1.1-dev.jar

The code for getTempFile() in the latest version of DefaultFileItem,
looks like this:


/**
     * Creates and returns a {@link java.io.File File} representing a
uniquely
     * named temporary file in the configured repository path. The
lifetime of
     * the file is tied to the lifetime of the <code>FileItem</code>
instance;
     * the file will be deleted when the instance is garbage collected.
     *
     * @return The {@link java.io.File File} to be used for temporary
storage.
     */
    protected File getTempFile()
    {
        File tempDir = repository;
        if (tempDir == null)
        {
            tempDir = new File(System.getProperty("java.io.tmpdir"));
        }

        String fileName = "upload_" + getUniqueId() + ".tmp";

        File f = new File(tempDir, fileName);
        FileCleaner.track(f, this);
        return f;
    }


That FileCleaner, is out of commons-io-1.1-dev.jar.

I think you may be on to something with the point about the threshold.
Another point about this problem is that if the file is 51KB or less, it
works fine.
However, If I try it with a file of 52 KB or more, it fails. Any idea? 

I did check the tmpdir, and it has been created.
Indeed, the 51 KB file is uploaded correctly to the exact same
directory.

However 52 KB, fails.


Here is how I call upload:

 			  // Create a new file upload handler
                    DiskFileUpload upload = new DiskFileUpload();
                    // Set upload parameters
                    upload.setSizeMax(-1); //no limit
                    upload.setSizeThreshold(4096);
                    upload.setRepositoryPath(importDir);
                    upload.setHeaderEncoding("UTF-8");
                    // Parse the request
                    List items = null;
                    try
                        {
                        items = upload.parseRequest(hsrRequest);
                        }
                    catch(Exception e)
                        {
                        mLog.log("Encountered Situation parsing file
upload request",LogConstants.LEVEL_ERROR,e);
                        }



And here is the stack trace I get back when it fails (when filesize > 51
KB)

NDC:			
Category:	com.projectwise.web.server.lite.LiteServlet
Message:		Encountered Situation parsing file upload
request
Location:	
Thrown:
org.apache.commons.fileupload.FileUploadException: Processing of
multipart/form-data request failed. Stream ended unexpectedly
	at
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase
.java:364)
	at
com.projectwise.web.server.lite.formhandler.FormHandler.arrangeRequest(F
ormHandler.java:655)
	at
com.projectwise.web.server.lite.formhandler.FormHandler.processRequest(F
ormHandler.java:3856)
	at
com.projectwise.web.server.lite.LiteServlet.doGet(LiteServlet.java:470)
	at
com.projectwise.web.server.lite.LiteServlet.doPost(LiteServlet.java:527)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:260)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:235
0)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:180)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
	at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
lve.java:170)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:171)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:174)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
	at
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:256)
	at
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:361)
	at
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:565)
	at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:
537)
	at
org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:640)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:533)
	at java.lang.Thread.run(Thread.java:536)


-----Original Message-----
From: Dakota Jack [mailto:crackwillow@gmail.com]
Sent: Wednesday, October 27, 2004 7:53 PM
To: Jakarta Commons Users List
Subject: Re: FileUpload\Windows 2003 Server\Tomcat

What is your code for his, Robert?  And, what is the stack trace of the
error?  It looks like the problem is in OutputStream os =
item.getOutputStream();  and this goes back to


    protected File getTempFile()
    {
        File tempDir = repository;
        if (tempDir == null)
        {
            tempDir = new File(System.getProperty("java.io.tmpdir"));
        }

        String fileName = "upload_" + getUniqueId() + ".tmp";

        File f = new File(tempDir, fileName);
        f.deleteOnExit();
        return f;
    }

Have you checked out your temporary directory?  Or, I think there is
something about the threshold only being used for certain things.

Jack


On Wed, 27 Oct 2004 18:01:11 -0400, Robert Priest
<robert.priest@bentley.com> wrote:
> Hello, I am running a version of tomcat 4.1 on Windows 2003 Server and

> I keep getting the following problem from the
> 
> DiskFileUpload.parseRequest() call:
> 
> Date:                   Wed Oct 27 17:23:18 EDT 2004 (1098912198367)
> Thread:         Thread-11
> Message #:      274
> Level:          ERROR
> NDC:
> Category:       com.projectwise.web.server.lite.LiteServlet
> Message:                Encountered Situation parsing file upload
> request
> Location:
> Thrown:
> org.apache.commons.fileupload.FileUploadException: Processing of 
> multipart/form-data request failed. Stream ended unexpectedly
>         at
> org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBa
> se
> .java:364)
>         at
> com.projectwise.web.server.lite.formhandler.FormHandler.arrangeRequest
> (F
> ormHandler.java:655)
>         ...
> 
> This code works fine on other machines (w2k, XP, etc). I am only 
> seeing this when I am running on a Windows 2003 Server.
> 
> It seems to happen when on
> 
> FileUploadBase line:349
> 
>                finally
>                         {
>      line 349: -->     os.close();
>                         }
> 
> the original exception is a
> 
> org.apache.commons.fileupload.MultipartStream$MalformedStreamException
> "Stream ended unexpectedly"
> 
> is anyone else seeing this issue?
> 
> I am using a version of fileupload which  I compiled today from the 
> cvs repository.
> 
> it is:  commons-fileupload-1.1-dev.jar
> 
> Does anyone have any suggestions?
> 
> I would appreciate the help. Thanks.
> 
> Robert.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 


--
"You can't wake a person who is pretending to be asleep."

~Native Proverb~

"Each man is good in His sight. It is not necessary for eagles to be
crows."

~Hunkesni (Sitting Bull), Hunkpapa Sioux~

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message