You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Ripplinger, Lyle M." <lr...@state.nd.us> on 2004/04/27 15:16:51 UTC

file upload memFileSize issue

I have an application that needs the ability to upload files of various
sizes.  If the size of the file to be uploaded is larger than 256K, then the
upload does not work.  It tells me that it cannot find the file specified.
If I add memFileSize=512K to the controller element in the struts-config.xml
file, then I can upload files up to 512K in size. 

So the problem appears to be that once the file starts getting swapped out
to disk, then it is unable to find it again during the upload process.  Has
anyone encountered this problem or have any ideas on how to correct it?  I
am using WSAD 5.1.1 and struts 1.1

I have also specified a temp directory within the controller element in the
struts file and received the same results.

Attached is a copy of my stack trace.

Thanks.

Lyle


[03/31 01:35:12 PM] ERROR XYZ_Application [xyz.web.common.AttachmentAddAC]
AttachmentAddAC.doWork(AttachmentAddAC.java:217)
java.io.FileNotFoundException:
C:\workspaces5\XYZ_Application\.metadata\.plugins\com.ibm.etools.server.core
\tmp0\cache\localhost\Default_Server\XYZ_Application\XYZ_ApplicationWeb.war\
upload_00000015.tmp (The system cannot find the file specified)
java.io.FileNotFoundException:
C:\workspaces5\XYZ_Application\.metadata\.plugins\com.ibm.etools.server.core
\tmp0\cache\localhost\Default_Server\XYZ_Application\XYZ_ApplicationWeb.war\
upload_00000015.tmp (The system cannot find the file specified)
	at java.io.FileInputStream.<init>(FileInputStream.java:110)
	at
org.apache.commons.fileupload.DefaultFileItem.getInputStream(DefaultFileItem
.java:218)
	at
org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFile.getI
nputStream(CommonsMultipartRequestHandler.java:612)
	at xyz.web.common.AttachmentAddAC.doWork(AttachmentAddAC.java:250)
	at xyz.web.WorkOrderAction.execute(WorkOrderAction.java:174)
	at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
sor.java:486)
	at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:281)
	at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1485)
	at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:527)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:787)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:854)
	at
com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager
.java:850)
	at
com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycl
eServlet.java:199)
	at
com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServle
t.java:298)
	at
com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycle
Servlet.java:111)
	at
com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:51
1)
	at
com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletMan
ager.java:1013)
	at
com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManag
er.java:914)
	at
com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(W
ebAppRequestDispatcher.java:789)
	at
com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequest
Dispatcher.java:536)
	at
com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestD
ispatcher.java:161)
	at
com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:205)
	at
com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.
java:337)
	at
com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedIn
vocation.java:68)
	at
com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequ
estProcessor.java:157)
	at
com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener
.java:400)
	at
com.ibm.servlet.engine.http11.HttpConnection.handleRequest(HttpConnection.ja
va:61)
	at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:571)
	at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:431)
	at com.ibm.ws.util.CachedThread.run(ThreadPool.java:169)
	at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:431)
	at com.ibm.ws.util.CachedThread.run(ThreadPool.java:169) 

Re: file upload memFileSize issue

Posted by Joe Germuska <Jo...@Germuska.com>.
The problem I had which was like this was using the struts-chain 
libraries.  They were using code which always rolled back the upload 
transaction, and the rollback includes removing the temporary file.

In that case, it was just because the file upload/multipart request 
parts of struts-chain hadn't been tested thoroughly; it seems 
unlikely that this would be the problem in Struts 1.1.  However, I 
thought I should share my experience.

My workaround until I fixed it was, of course, to bump the 
memFileSize as high as it could go; however, if you have pages with 
several uploads, you will run into out-of-memory problems.

By the way, the struts-chain libraries have since been patched to 
handle multipart uploads correctly.

Joe


At 8:16 AM -0500 4/27/04, Ripplinger, Lyle M. wrote:
>I have an application that needs the ability to upload files of various
>sizes.  If the size of the file to be uploaded is larger than 256K, then the
>upload does not work.  It tells me that it cannot find the file specified.
>If I add memFileSize=512K to the controller element in the struts-config.xml
>file, then I can upload files up to 512K in size.
>
>So the problem appears to be that once the file starts getting swapped out
>to disk, then it is unable to find it again during the upload process.  Has
>anyone encountered this problem or have any ideas on how to correct it?  I
>am using WSAD 5.1.1 and struts 1.1
>
>I have also specified a temp directory within the controller element in the
>struts file and received the same results.
>
>Attached is a copy of my stack trace.
>
>Thanks.
>
>Lyle
>
>
>[03/31 01:35:12 PM] ERROR XYZ_Application [xyz.web.common.AttachmentAddAC]
>AttachmentAddAC.doWork(AttachmentAddAC.java:217)
>java.io.FileNotFoundException:
>C:\workspaces5\XYZ_Application\.metadata\.plugins\com.ibm.etools.server.core
>\tmp0\cache\localhost\Default_Server\XYZ_Application\XYZ_ApplicationWeb.war\
>upload_00000015.tmp (The system cannot find the file specified)
>java.io.FileNotFoundException:
>C:\workspaces5\XYZ_Application\.metadata\.plugins\com.ibm.etools.server.core
>\tmp0\cache\localhost\Default_Server\XYZ_Application\XYZ_ApplicationWeb.war\
>upload_00000015.tmp (The system cannot find the file specified)
>	at java.io.FileInputStream.<init>(FileInputStream.java:110)
>	at
>org.apache.commons.fileupload.DefaultFileItem.getInputStream(DefaultFileItem
>.java:218)
>	at
>org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFile.getI
>nputStream(CommonsMultipartRequestHandler.java:612)
>	at xyz.web.common.AttachmentAddAC.doWork(AttachmentAddAC.java:250)
>	at xyz.web.WorkOrderAction.execute(WorkOrderAction.java:174)
>	at
>org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
>sor.java:486)
>	at
>org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:281)
>	at
>org.apache.struts.action.ActionServlet.process(ActionServlet.java:1485)
>	at
>org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:527)
>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:787)
>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:854)
>	at
>com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager
>.java:850)
>	at
>com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycl
>eServlet.java:199)
>	at
>com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServle
>t.java:298)
>	at
>com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycle
>Servlet.java:111)
>	at
>com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:51
>1)
>	at
>com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletMan
>ager.java:1013)
>	at
>com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManag
>er.java:914)
>	at
>com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(W
>ebAppRequestDispatcher.java:789)
>	at
>com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequest
>Dispatcher.java:536)
>	at
>com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestD
>ispatcher.java:161)
>	at
>com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:205)
>	at
>com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.
>java:337)
>	at
>com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedIn
>vocation.java:68)
>	at
>com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequ
>estProcessor.java:157)
>	at
>com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener
>.java:400)
>	at
>com.ibm.servlet.engine.http11.HttpConnection.handleRequest(HttpConnection.ja
>va:61)
>	at
>com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:571)
>	at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:431)
>	at com.ibm.ws.util.CachedThread.run(ThreadPool.java:169)
>	at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:431)
>	at com.ibm.ws.util.CachedThread.run(ThreadPool.java:169)


-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
       "Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining."
             -- Jef Raskin

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