You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Ashok Madhavan <as...@yahoo.com> on 2003/06/11 04:09:55 UTC

Upload Problem

Hi all,
I am using the Struts version RC-1. 

I am using the Struts upload and i am able to load
files upto about 230KB size. WHen the size of the
uploaded file goes more than 300KB, i am getting the
following exception.
<Jun 10, 2003 7:01:03 PM PDT> <Error> <HTTP> <101017>
<[ServletContext(id=5921274,name=prototype,context-path=/prototype)]
Root cause of ServletException
java.lang.NullPointerException
        at
org.apache.commons.fileupload.DeferredFileOutputStream.thresholdReached(DeferredFileOutputStream.java:163)
        at
org.apache.commons.fileupload.ThresholdingOutputStream.checkThreshold(ThresholdingOutputStream.java:260)
        at
org.apache.commons.fileupload.ThresholdingOutputStream.write(ThresholdingOutputStream.java:167)
        at
org.apache.commons.fileupload.MultipartStream.readBodyData(MultipartStream.java:513)
        at
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:360)
        at
org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(CommonsMultipartRequestHandler.java:233)
        at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1125)
        at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
        at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
        at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
        at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1058)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:401)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:306)
        at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5445)
        at
weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:780)
        at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3105)
        at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2588)
        at
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
        at
weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
> 

How do i fix this. 
Am i missing something.

Regards
Ashok Madhavan
1

Re: Upload Problem

Posted by Ashok Madhavan <as...@yahoo.com>.
hi ROb,
I added the controller tag to the struts-config.xml
just after the <action-mappings>.
i added something like this :
<controller maxFileSize="2M" />

I then tried to add a 570K file and i still got the
same exception.
then i made the maxFileSize="-1". even then i was
getting the same exception.

Am i missing something major here.

regards
Ashok

--- Rob Leland <rl...@apache.org> wrote:
> Ashok Madhavan wrote:
> 
> Do you have a <controller > statement in your
> struts-config.xml and if 
> so are you setting
> the upload file size limit ? For example:
> 
>   <controller maxFileSize="2M" />
> 
> There are other parameters that can be set also.
> Another problem you may 
> run into is
> that if you are uploading really large files I have
> done 650MB and 1 GB 
> files with fileupload,
> and using tomcat there is a setting in the
> server.xml tomcat file that 
> prevents the session from timing out
> during file uploads.
> 
> -Rob
> 
> 
> >Hi all,
> >I am using the Struts version RC-1. 
> >
> >I am using the Struts upload and i am able to load
> >files upto about 230KB size. WHen the size of the
> >uploaded file goes more than 300KB, i am getting
> the
> >following exception.
> ><Jun 10, 2003 7:01:03 PM PDT> <Error> <HTTP>
> <101017>
>
><[ServletContext(id=5921274,name=prototype,context-path=/prototype)]
> >Root cause of ServletException
> >java.lang.NullPointerException
> >        at
>
>org.apache.commons.fileupload.DeferredFileOutputStream.thresholdReached(DeferredFileOutputStream.java:163)
> >        at
>
>org.apache.commons.fileupload.ThresholdingOutputStream.checkThreshold(ThresholdingOutputStream.java:260)
> >        at
>
>org.apache.commons.fileupload.ThresholdingOutputStream.write(ThresholdingOutputStream.java:167)
> >        at
>
>org.apache.commons.fileupload.MultipartStream.readBodyData(MultipartStream.java:513)
> >        at
>
>org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:360)
> >        at
>
>org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(CommonsMultipartRequestHandler.java:233)
> >        at
>
>org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1125)
> >        at
>
>org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
> >        at
>
>org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
> >        at
>
>org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
> >        at
>
>org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
> >        at
>
>javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> >        at
>
>javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> >        at
>
>weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1058)
> >        at
>
>weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:401)
> >        at
>
>weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:306)
> >        at
>
>weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5445)
> >        at
>
>weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:780)
> >        at
>
>weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3105)
> >        at
>
>weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2588)
> >        at
>
>weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
> >        at
>
>weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
> >  
> >
> >
> >How do i fix this. 
> >Am i missing something.
> >
> >Regards
> >Ashok Madhavan
> >1
> >
>
>---------------------------------------------------------------------
> >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
> 


Re: Upload Problem

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 17 Jun 2003, Ashok Madhavan wrote:

> Date: Tue, 17 Jun 2003 11:07:52 -0700 (PDT)
> From: Ashok Madhavan <as...@yahoo.com>
> Reply-To: Jakarta Commons Users List <co...@jakarta.apache.org>
> To: Jakarta Commons Users List <co...@jakarta.apache.org>
> Subject: Re: Upload Problem
>
> hi Craig,
>
> The stream.write() method returns void.

Yep ... I was incorrectly thinking about input processing rather than
output.  Sorry for the noise.

Craig

Re: Upload Problem

Posted by Ashok Madhavan <as...@yahoo.com>.
hi Craig,

The stream.write() method returns void. 
I had taken the original code snippet from one of your
other postings. 
I had the 
"while (sent < data.length) 
{
  sent += stream.write(data, sent, data.length -
sent);
}" code but it does not compile. 
Thatz the reason i didnt do the "while" check.

What is the proper way to make sure all the data
reaches teh browser.

Regards
Ashok


--- "Craig R. McClanahan" <cr...@apache.org> wrote:
> 
> 
> On Tue, 10 Jun 2003, Ashok Madhavan wrote:
> 
> > Date: Tue, 10 Jun 2003 21:11:21 -0700 (PDT)
> > From: Ashok Madhavan <as...@yahoo.com>
> > Reply-To: Jakarta Commons Users List
> <co...@jakarta.apache.org>
> > To: Jakarta Commons Users List
> <co...@jakarta.apache.org>
> > Subject: Re: Upload Problem
> >
> > hi Rob,
> > Thanks for the info. I am testing that now.
> > I got a another question.
> > I have a typical upload/download functionality.
> For
> > the upload i use the commons-fileupload and for
> the
> > download i use the ServletOutpurStream like this.
> >
> > 	ServletOutputStream stream =
> > response.getOutputStream();
> > 	int sent = 0;
> >          stream.write(data, sent, data.length -
> sent);
> > 	stream.flush();
> > 	stream.close();
> >         return null;
> >
> 
> The download code snippet above seems bogus --
> perhaps there were some
> omitted lines?  You cannot assume that
> stream.write() will write all of
> the bytes of your data the frst time you call it, so
> you have to
> encapsulate thngs in a while loop (assuming "data"
> is a byte array);
> 
>   ServletOutputStream stream =
> response.getOutputStream();
>   int sent = 0;
>   while (sent < data.length) {
>     sent += stream.write(data, sent, data.length -
> sent);
>   }
>   stream.flush();
>   stream.close();
>   return null;
> 
> If you do not do something like this, it's entirely
> possible that you will
> receive only the beginning of the data, rather than
> all of it.  The
> precise behavior is totally subject to the JDK an
> servlet container you
> are using, coupled with the dynamic situation when
> the request is made --
> in short, what you'll actually see with your code is
> "undefined" behavior
> :-).
> 
> > After a few times (some times just one ) uploading
> and
> > downloading the browser seems to get slower and if
> i
> > click any link on the site, the request does not
> go to
> > the server at all. But if i click any link the
> second
> > time, it goes to the server.
> >
> 
> That could also be a result of not processing the
> entire byte array, and
> somehow leaving a reference to it that occupies
> memory.
> 
> > Any idea why this weird error is happening?
> >
> 
> What wierd error?  All you've described is a
> performance issue :-).  Such
> a thing could easily result from dangling references
> to the byte array,
> but that's most likely an application issue.
> 
> > I am using the weblogic 7.0 and working in Struts
> 1.1
> > RC1.
> >
> > regards
> > Ashok
> >
> 
> Craig
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> 


Re: Upload Problem

Posted by Tom Maccariella <tm...@yahoo.com>.
void, not null.  sorry for the typo.

Tom Maccariella <tm...@yahoo.com> wrote:I'm not sure if this code works either. The OutputStream.write(byte[] b, int off, int len) method returns null in JDK1.4, not int. Am I missing something?

Tom

"Craig R. McClanahan" wrote:


On Tue, 10 Jun 2003, Ashok Madhavan wrote:

> Date: Tue, 10 Jun 2003 21:11:21 -0700 (PDT)
> From: Ashok Madhavan 
> Reply-To: Jakarta Commons Users List 
> To: Jakarta Commons Users List 
> Subject: Re: Upload Problem
>
> hi Rob,
> Thanks for the info. I am testing that now.
> I got a another question.
> I have a typical upload/download functionality. For
> the upload i use the commons-fileupload and for the
> download i use the ServletOutpurStream like this.
>
> ServletOutputStream stream =
> response.getOutputStream();
> int sent = 0;
> stream.write(data, sent, data.length - sent);
> stream.flush();
> stream.close();
> return null;
>

The download code snippet above seems bogus -- perhaps there were some
omitted lines? You cannot assume that stream.write() will write all of
the bytes of your data the frst time you call it, so you have to
encapsulate thngs in a while loop (assuming "data" is a byte array);

ServletOutputStream stream = response.getOutputStream();
int sent = 0;
while (sent < data.length) {
sent += stream.write(data, sent, data.length - sent);
}
stream.flush();
stream.close();
return null;

If you do not do something like this, it's entirely possible that you will
receive only the beginning of the data, rather than all of it. The
precise behavior is totally subject to the JDK an servlet container you
are using, coupled with the dynamic situation when the request is made --
in short, what you'll actually see with your code is "undefined" behavior
:-).

> After a few times (some times just one ) uploading and
> downloading the browser seems to get slower and if i
> click any link on the site, the request does not go to
> the server at all. But if i click any link the second
> time, it goes to the server.
>

That could also be a result of not processing the entire byte array, and
somehow leaving a reference to it that occupies memory.

> Any idea why this weird error is happening?
>

What wierd error? All you've described is a performance issue :-). Such
a thing could easily result from dangling references to the byte array,
but that's most likely an application issue.

> I am using the weblogic 7.0 and working in Struts 1.1
> RC1.
>
> regards
> Ashok
>

Craig

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






---------------------------------
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!


 



---------------------------------
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

Re: Upload Problem

Posted by Tom Maccariella <tm...@yahoo.com>.
I'm not sure if this code works either.  The OutputStream.write(byte[] b, int off, int len) method returns null in JDK1.4, not int.  Am I missing something?
 
Tom

"Craig R. McClanahan" <cr...@apache.org> wrote:


On Tue, 10 Jun 2003, Ashok Madhavan wrote:

> Date: Tue, 10 Jun 2003 21:11:21 -0700 (PDT)
> From: Ashok Madhavan 
> Reply-To: Jakarta Commons Users List 
> To: Jakarta Commons Users List 
> Subject: Re: Upload Problem
>
> hi Rob,
> Thanks for the info. I am testing that now.
> I got a another question.
> I have a typical upload/download functionality. For
> the upload i use the commons-fileupload and for the
> download i use the ServletOutpurStream like this.
>
> ServletOutputStream stream =
> response.getOutputStream();
> int sent = 0;
> stream.write(data, sent, data.length - sent);
> stream.flush();
> stream.close();
> return null;
>

The download code snippet above seems bogus -- perhaps there were some
omitted lines? You cannot assume that stream.write() will write all of
the bytes of your data the frst time you call it, so you have to
encapsulate thngs in a while loop (assuming "data" is a byte array);

ServletOutputStream stream = response.getOutputStream();
int sent = 0;
while (sent < data.length) {
sent += stream.write(data, sent, data.length - sent);
}
stream.flush();
stream.close();
return null;

If you do not do something like this, it's entirely possible that you will
receive only the beginning of the data, rather than all of it. The
precise behavior is totally subject to the JDK an servlet container you
are using, coupled with the dynamic situation when the request is made --
in short, what you'll actually see with your code is "undefined" behavior
:-).

> After a few times (some times just one ) uploading and
> downloading the browser seems to get slower and if i
> click any link on the site, the request does not go to
> the server at all. But if i click any link the second
> time, it goes to the server.
>

That could also be a result of not processing the entire byte array, and
somehow leaving a reference to it that occupies memory.

> Any idea why this weird error is happening?
>

What wierd error? All you've described is a performance issue :-). Such
a thing could easily result from dangling references to the byte array,
but that's most likely an application issue.

> I am using the weblogic 7.0 and working in Struts 1.1
> RC1.
>
> regards
> Ashok
>

Craig

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


 



---------------------------------
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

Re: Upload Problem

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 10 Jun 2003, Ashok Madhavan wrote:

> Date: Tue, 10 Jun 2003 21:11:21 -0700 (PDT)
> From: Ashok Madhavan <as...@yahoo.com>
> Reply-To: Jakarta Commons Users List <co...@jakarta.apache.org>
> To: Jakarta Commons Users List <co...@jakarta.apache.org>
> Subject: Re: Upload Problem
>
> hi Rob,
> Thanks for the info. I am testing that now.
> I got a another question.
> I have a typical upload/download functionality. For
> the upload i use the commons-fileupload and for the
> download i use the ServletOutpurStream like this.
>
> 	ServletOutputStream stream =
> response.getOutputStream();
> 	int sent = 0;
>          stream.write(data, sent, data.length - sent);
> 	stream.flush();
> 	stream.close();
>         return null;
>

The download code snippet above seems bogus -- perhaps there were some
omitted lines?  You cannot assume that stream.write() will write all of
the bytes of your data the frst time you call it, so you have to
encapsulate thngs in a while loop (assuming "data" is a byte array);

  ServletOutputStream stream = response.getOutputStream();
  int sent = 0;
  while (sent < data.length) {
    sent += stream.write(data, sent, data.length - sent);
  }
  stream.flush();
  stream.close();
  return null;

If you do not do something like this, it's entirely possible that you will
receive only the beginning of the data, rather than all of it.  The
precise behavior is totally subject to the JDK an servlet container you
are using, coupled with the dynamic situation when the request is made --
in short, what you'll actually see with your code is "undefined" behavior
:-).

> After a few times (some times just one ) uploading and
> downloading the browser seems to get slower and if i
> click any link on the site, the request does not go to
> the server at all. But if i click any link the second
> time, it goes to the server.
>

That could also be a result of not processing the entire byte array, and
somehow leaving a reference to it that occupies memory.

> Any idea why this weird error is happening?
>

What wierd error?  All you've described is a performance issue :-).  Such
a thing could easily result from dangling references to the byte array,
but that's most likely an application issue.

> I am using the weblogic 7.0 and working in Struts 1.1
> RC1.
>
> regards
> Ashok
>

Craig

Re[2]: Upload Problem

Posted by Anton Tagunov <at...@mail.cnt.ru>.
AM> After a few times (some times just one ) uploading and
AM> downloading the browser seems to get slower and if i
AM> click any link on the site, the request does not go to
AM> the server at all. But if i click any link the second
AM> time, it goes to the server.

AM> Any idea why this weird error is happening?

AM> I am using the weblogic 7.0 and working in Struts 1.1
AM> RC1.

Looks pretty much like a browser problem. Which one do you
use? Also try a different browser. (I personally have 3 of
them: IE5.0SP3, Opera 6.05, Mozilla 1.3.1

- Anton


Re: Upload Problem

Posted by Ashok Madhavan <as...@yahoo.com>.
hi Rob,
Thanks for the info. I am testing that now.
I got a another question.
I have a typical upload/download functionality. For
the upload i use the commons-fileupload and for the
download i use the ServletOutpurStream like this.

	ServletOutputStream stream =
response.getOutputStream();
	int sent = 0;
         stream.write(data, sent, data.length - sent);
	stream.flush();
	stream.close();
        return null;

After a few times (some times just one ) uploading and
downloading the browser seems to get slower and if i
click any link on the site, the request does not go to
the server at all. But if i click any link the second
time, it goes to the server.

Any idea why this weird error is happening?

I am using the weblogic 7.0 and working in Struts 1.1
RC1.

regards
Ashok

	
--- Rob Leland <rl...@apache.org> wrote:
> Ashok Madhavan wrote:
> 
> Do you have a <controller > statement in your
> struts-config.xml and if 
> so are you setting
> the upload file size limit ? For example:
> 
>   <controller maxFileSize="2M" />
> 
> There are other parameters that can be set also.
> Another problem you may 
> run into is
> that if you are uploading really large files I have
> done 650MB and 1 GB 
> files with fileupload,
> and using tomcat there is a setting in the
> server.xml tomcat file that 
> prevents the session from timing out
> during file uploads.
> 
> -Rob
> 
> 
> >Hi all,
> >I am using the Struts version RC-1. 
> >
> >I am using the Struts upload and i am able to load
> >files upto about 230KB size. WHen the size of the
> >uploaded file goes more than 300KB, i am getting
> the
> >following exception.
> ><Jun 10, 2003 7:01:03 PM PDT> <Error> <HTTP>
> <101017>
>
><[ServletContext(id=5921274,name=prototype,context-path=/prototype)]
> >Root cause of ServletException
> >java.lang.NullPointerException
> >        at
>
>org.apache.commons.fileupload.DeferredFileOutputStream.thresholdReached(DeferredFileOutputStream.java:163)
> >        at
>
>org.apache.commons.fileupload.ThresholdingOutputStream.checkThreshold(ThresholdingOutputStream.java:260)
> >        at
>
>org.apache.commons.fileupload.ThresholdingOutputStream.write(ThresholdingOutputStream.java:167)
> >        at
>
>org.apache.commons.fileupload.MultipartStream.readBodyData(MultipartStream.java:513)
> >        at
>
>org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:360)
> >        at
>
>org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(CommonsMultipartRequestHandler.java:233)
> >        at
>
>org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1125)
> >        at
>
>org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
> >        at
>
>org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
> >        at
>
>org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
> >        at
>
>org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
> >        at
>
>javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> >        at
>
>javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> >        at
>
>weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1058)
> >        at
>
>weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:401)
> >        at
>
>weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:306)
> >        at
>
>weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5445)
> >        at
>
>weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:780)
> >        at
>
>weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3105)
> >        at
>
>weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2588)
> >        at
>
>weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
> >        at
>
>weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
> >  
> >
> >
> >How do i fix this. 
> >Am i missing something.
> >
> >Regards
> >Ashok Madhavan
> >1
> >
>
>---------------------------------------------------------------------
> >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
> 


Re: Upload Problem

Posted by Rob Leland <rl...@apache.org>.
Ashok Madhavan wrote:

Do you have a <controller > statement in your struts-config.xml and if 
so are you setting
the upload file size limit ? For example:

  <controller maxFileSize="2M" />

There are other parameters that can be set also. Another problem you may 
run into is
that if you are uploading really large files I have done 650MB and 1 GB 
files with fileupload,
and using tomcat there is a setting in the server.xml tomcat file that 
prevents the session from timing out
during file uploads.

-Rob


>Hi all,
>I am using the Struts version RC-1. 
>
>I am using the Struts upload and i am able to load
>files upto about 230KB size. WHen the size of the
>uploaded file goes more than 300KB, i am getting the
>following exception.
><Jun 10, 2003 7:01:03 PM PDT> <Error> <HTTP> <101017>
><[ServletContext(id=5921274,name=prototype,context-path=/prototype)]
>Root cause of ServletException
>java.lang.NullPointerException
>        at
>org.apache.commons.fileupload.DeferredFileOutputStream.thresholdReached(DeferredFileOutputStream.java:163)
>        at
>org.apache.commons.fileupload.ThresholdingOutputStream.checkThreshold(ThresholdingOutputStream.java:260)
>        at
>org.apache.commons.fileupload.ThresholdingOutputStream.write(ThresholdingOutputStream.java:167)
>        at
>org.apache.commons.fileupload.MultipartStream.readBodyData(MultipartStream.java:513)
>        at
>org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:360)
>        at
>org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(CommonsMultipartRequestHandler.java:233)
>        at
>org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1125)
>        at
>org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
>        at
>org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
>        at
>org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
>        at
>org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
>        at
>javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>        at
>javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>        at
>weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1058)
>        at
>weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:401)
>        at
>weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:306)
>        at
>weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5445)
>        at
>weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:780)
>        at
>weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3105)
>        at
>weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2588)
>        at
>weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
>        at
>weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
>  
>
>
>How do i fix this. 
>Am i missing something.
>
>Regards
>Ashok Madhavan
>1
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>
>  
>



Re: Upload Problem

Posted by Ashok Madhavan <as...@yahoo.com>.
hi Rob, Martin and all,

Thanks a lot. i used the 'controller' element and
moved to the RC2 and the upload works great.

thanks a lot again.

regards
Ashok


--- Martin Cooper <ma...@apache.org> wrote:
> You need a later version of FileUpload. You could
> download FileUpload 1.0
> RC1 directly, but since you're using Struts, I would
> recommend that you
> upgrade to Struts 1.1 RC2 instead. (Struts 1.1 RC2
> includes FileUpload 1.0
> RC1.)
> 
> --
> Martin Cooper
> 
> 
> "Ashok Madhavan" <as...@yahoo.com> wrote in
> message
>
news:20030611020955.65540.qmail@web80212.mail.yahoo.com...
> > Hi all,
> > I am using the Struts version RC-1.
> >
> > I am using the Struts upload and i am able to load
> > files upto about 230KB size. WHen the size of the
> > uploaded file goes more than 300KB, i am getting
> the
> > following exception.
> > <Jun 10, 2003 7:01:03 PM PDT> <Error> <HTTP>
> <101017>
> >
>
<[ServletContext(id=5921274,name=prototype,context-path=/prototype)]
> > Root cause of ServletException
> > java.lang.NullPointerException
> >         at
> >
>
org.apache.commons.fileupload.DeferredFileOutputStream.thresholdReached(Defe
> rredFileOutputStream.java:163)
> >         at
> >
>
org.apache.commons.fileupload.ThresholdingOutputStream.checkThreshold(Thresh
> oldingOutputStream.java:260)
> >         at
> >
>
org.apache.commons.fileupload.ThresholdingOutputStream.write(ThresholdingOut
> putStream.java:167)
> >         at
> >
>
org.apache.commons.fileupload.MultipartStream.readBodyData(MultipartStream.j
> ava:513)
> >         at
> >
>
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.jav
> a:360)
> >         at
> >
>
org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(Common
> sMultipartRequestHandler.java:233)
> >         at
> >
>
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1125)
> >         at
> >
>
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
> ava:821)
> >         at
> >
>
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
> >         at
> >
>
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
> >         at
> >
>
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
> >         at
> >
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> >         at
> >
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> >         at
> >
>
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
> tStubImpl.java:1058)
> >         at
> >
>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
> :401)
> >         at
> >
>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
> :306)
> >         at
> >
>
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
> ebAppServletContext.java:5445)
> >         at
> >
>
weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
> r.java:780)
> >         at
> >
>
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
> ntext.java:3105)
> >         at
> >
>
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
> :2588)
> >         at
> >
>
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
> >         at
> >
>
weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
> > >
> >
> > How do i fix this.
> > Am i missing something.
> >
> > Regards
> > Ashok Madhavan
> > 1
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> 


Re: Upload Problem

Posted by Martin Cooper <ma...@apache.org>.
You need a later version of FileUpload. You could download FileUpload 1.0
RC1 directly, but since you're using Struts, I would recommend that you
upgrade to Struts 1.1 RC2 instead. (Struts 1.1 RC2 includes FileUpload 1.0
RC1.)

--
Martin Cooper


"Ashok Madhavan" <as...@yahoo.com> wrote in message
news:20030611020955.65540.qmail@web80212.mail.yahoo.com...
> Hi all,
> I am using the Struts version RC-1.
>
> I am using the Struts upload and i am able to load
> files upto about 230KB size. WHen the size of the
> uploaded file goes more than 300KB, i am getting the
> following exception.
> <Jun 10, 2003 7:01:03 PM PDT> <Error> <HTTP> <101017>
> <[ServletContext(id=5921274,name=prototype,context-path=/prototype)]
> Root cause of ServletException
> java.lang.NullPointerException
>         at
>
org.apache.commons.fileupload.DeferredFileOutputStream.thresholdReached(Defe
rredFileOutputStream.java:163)
>         at
>
org.apache.commons.fileupload.ThresholdingOutputStream.checkThreshold(Thresh
oldingOutputStream.java:260)
>         at
>
org.apache.commons.fileupload.ThresholdingOutputStream.write(ThresholdingOut
putStream.java:167)
>         at
>
org.apache.commons.fileupload.MultipartStream.readBodyData(MultipartStream.j
ava:513)
>         at
>
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.jav
a:360)
>         at
>
org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(Common
sMultipartRequestHandler.java:233)
>         at
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1125)
>         at
>
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
ava:821)
>         at
>
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
>         at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
>         at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
>         at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>         at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
>
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
tStubImpl.java:1058)
>         at
>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:401)
>         at
>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:306)
>         at
>
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
ebAppServletContext.java:5445)
>         at
>
weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
r.java:780)
>         at
>
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:3105)
>         at
>
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:2588)
>         at
> weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
>         at
> weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
> >
>
> How do i fix this.
> Am i missing something.
>
> Regards
> Ashok Madhavan
> 1