You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Daniel Wieneck <Da...@framfab.com> on 2008/02/08 14:14:37 UTC

[FILE UPLOAD] Streaming API & Portlets

Hi all,
i have a proble using the commons-fileupload lib.
Here is the scenario:
I have a form for creating and editing a user profile. There are a ffew
simple text fields and a filed to upload a picture.

In the first step i tried to implement the example of the user guide (of
commons-fileupload). This example throws the following exception:

java.lang.IllegalStateException: No new trackers can be added once
exitWhenFinished() is called
	at
org.apache.commons.io.FileCleaner.addTracker(FileCleaner.java:133)
	at org.apache.commons.io.FileCleaner.track(FileCleaner.java:90)
	at org.apache.commons.io.FileCleaner.track(FileCleaner.java:73)
	at
org.apache.commons.fileupload.disk.DiskFileItem.getTempFile(DiskFileItem
.java:590)
	at
org.apache.commons.fileupload.disk.DiskFileItem.getOutputStream(DiskFile
Item.java:530)
	at
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase
.java:369)
	at
org.apache.commons.fileupload.portlet.PortletFileUpload.parseRequest(Por
tletFileUpload.java:113) [...]

When calling the method PortletFileUpload.parseRequest().
After a few tries with and without the listner
org.apache.commons.fileupload.servlet.FileCleanerCleanup (does it work
in a portlet web-app?)
and some changes of the repository and the threshold-size, i gave up and
tried the Streaming-API.

I have tried to implement the example of the Stream-API as well.
The exception i get is the following one:

java.lang.NoSuchMethodError:
org.apache.commons.fileupload.portlet.PortletFileUpload.getItemIterator(
Ljavax/portlet/ActionRequest;)Lorg/apache/commons/fileupload/FileItemIte
rator; [...]

But this method is documented in the java-docs and my Netbeans accepts
this line of code:

FileItemIterator iter = upload.getItemIterator(ar);  // ar is the
ActionRequest

Has someone an idea what i do wrong? I have the commons-fileupload.jar
and the commons-io.jar inside of the classpath...

best regards,

D. Wieneck