I have posted my question on the Primefaces forum but no one has responded so I figured I would try here.
I have been attempting to get fileUpload to work for some time now. I am currently running the RC2 build with mojarra 2.0.3 and Tomcat 7.
I have a dialog which will contain the fileUpload component like so.
<p:dialog id="uploadFileDialog" >
<h:form id="uplaodFileForm" prependId="false" enctype="multipart/form-data">
<p:fileUpload fileUploadListener="#{fileUploadController.uploadFile} auto="true"/>
</h:form>
</p:dialog>
The fileUploadController looks like this
public class FileUploadController {
public void uploadFile(FileUploadEvent event) {
byte[] file = event.getFile().getContents();
System.out.println("MADE IT INTO FILE UPLOAD !!! ");
}
}
For some reason when the file is uploaded it never triggers the fileUploadEvent and it never gets into the controller. The upload looks like its working, the flash part renders and gives the impression its doing something but no backing bean is ever being called. I can seem to figure out what I am doing wrong and I have read just about every post on uploading a file using primefaces. Anyone know what I am doing wrong?
java.lang.ClassNotFoundException: org.apache.commons.io.output.DeferredFileOutputStream
PrimeFaces fileupload uses Apache Commons FileUpload under the covers which in turn has another dependency, the Apache Commons IO. Ensure that you've both JAR's in your /WEB-INF/lib.
Update: as per the comments, you also need to ensure that the upload filter is been declared in web.xml as per the users' guide:
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
And you also need to ensure that there are no other filters before in the web.xml which may be reading the HttpServletRequest#getInputStream(), because it can be read only once.
I have also experienced a similar problem. The fix for me (using a Maven project) was to add the following dependencies in the pom.xml file:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>
This is the equivalent of having the corresponding .jar files in your WEB-INF/lib, so try do that if this is not a Maven project.
that is correct you must add
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
AND later this
<!-- JSF mapping -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Map these files with JSF -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
aditionaly if your using maven add this dependencies
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>portlet-api</groupId>
<artifactId>portlet-api</artifactId>
<version>1.0</version>
</dependency>
i think i have solved your problem.
Check on your web.xml the presence of:
<context-param>
<param-name>com.sun.faces.enableViewStateIdRendering</param-name>
<param-value>false</param-value>
</context-param>
You must delete this option or set it do True (the default value).
I have the same issue, I have solved it by adding
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
like BalusC said.
but adding this :
<!-- JSF mapping -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Map these files with JSF -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
Because by default in J2EE 6 this part is optional JSF 2.0 Servlet activates automatically when the WEB-INF/faces-config.xml descriptor is present.
But it necessary to active correctly PrimeFaces Filter
Jboss 6.1.0.Final / PrimeFaces 3.0.RC2
In Websphere 7 the event is fired because when I select file and press upload I can see bar to upload that grow up.
The problem is that in Websphere 7 I suppose that there are a filter that consume HttpRequest and when arrive to event listener is just consumed so don't have data :(
No message are present in log the debugging is very complicate. Exists some trace or logger to enable in JSF 2 Mojarra 2 and PrimeFaces 3.4.2?
Related
I have a EJB and WEB project which has main.jsp and several other java classes built in JBOSS 5 with old richfaces 3.3.3. I now want to migrate the project to Wildlfy 13 server with open JDK 11 compilation. But getting the below error:
ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 71) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host.
org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./SiamLogWeb: java.lang.IllegalStateException: UT010050: Filter richfaces used in filter mapping SERVLET - Faces Servlet not found
ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed
failure description: {
"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host
java.lang.IllegalStateException: UT010050: Filter richfaces used in filter mapping SERVLET - Faces Servlet not found
Caused by: java.lang.IllegalStateException: UT010050: Filter richfaces used in filter mapping SERVLET - Faces Servlet not found"},
"WFLYCTL0288: One or more services were unable to start due to one or more indirect dependencies not being available`
I have removed the old richfaces 3.3.3 jars and placed new richfaces 4.5 JARs which are compatible with Wildfly 13. Also the code is error free and can generate the EAR. But while deploying into wildfly 13 server getting the error
My web.xml looks like:
?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>Project</display-name>
<context-param>
<param-name>org.jboss.jbossfaces.JSF_CONFIG_NAME</param-name>
<param-value>myfaces-2.2.12</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.enableRestoreView11Compatibility</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.CONTROL_SKINNING</param-name>
<param-value>enable</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
You are registering a filter but you don't provide any definition (i.e. a <filter> element). On the other hand I'm fairly sure you don't need that filter in RF 4 so just delete it.
I have the following code, running on jboss eap 6.1:
<h:form id="SatelliteListForm" enctype="multipart/form-data">
...
<p:fileUpload id="datamodelImport" mode="advanced" auto="true" disabled="#{empty satelliteController.selected}" fileUploadListener="#{satelliteController.importDatamodel}" update=":messages" allowTypes="/(\.|\/)(csv)$/"/>
web.xml contains this:
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
pom.xml have this:
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3</version>
</dependency>
the problem? it doesn't not work. The UI seems to be working fine, but the file upload listener is not called.
Using search BalucC suggest to debug http communication. Done, it is not the browser fault. Then he suggest to debug the decode method of the corresponding primefaces class. Done. In the following class
org.primefaces.component.fileupload.CommonsFileUploadDecoder
he do this check:
if(multipartRequest != null) // keep going, otherwise stop
in my case that variable is null. I can't understand why. The generated html code correctly contains the enctype.
BalusC suggest that something could happen during request processing. I'm using atmosphere, but it uses another servlet to communicate. Also he is complaining for quite some time about comet support (someday I will fix that). Don't know if it matters.
What else can I check?
It's irritating that something so simple as file upload is wasting so much of my time...
Thank you for your time.
did you try to add the following parameter to your web.xml?
<context-param>
<param-name>primefaces.UPLOADER</param-name>
<param-value>commons</param-value>
</context-param>
I had the same behaviour until I added these context param
Regards
Michael
"Error 500: com.ocpsoft.pretty.PrettyFilter incompatible with javax.servlet.Filter"
JSF2.1.2
Prettyfaces-jsf2-3.3.2
Primefaces 3.2
WebSphere Application Server 7.0.0.9
Tried with adding custom properties in WebSphere admin console for filter compatibility(Last in FAQ at http://ocpsoft.org/prettyfaces/).
Tomcat 6.0.32 don't have any issues but once deployed the app in WAS got the issue.
Below is webxml
<context-param>
<param-name>defaultHtmlEscape</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.numberOfViewsInSession</param-name>
<param-value>3</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.numberOfLogicalViews</param-name>
<param-value>10</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:WEB-INF/Controller-servlet.xml</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
<context-param>
<description>JSF Injection provider</description>
<param-name>com.sun.faces.injectionProvider</param-name>
<param-value>net.devgrok.jsf.Tomcat6GuiceInjectionProvider</param-value>
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>cupertino</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FULL_STATE_SAVING_VIEW_IDS</param-name>
<param-value>abc.xhtml</param-value>
</context-param>
<!-- JSF Required Context Params END-->
<!-- JSF Required Filters & Listeners START-->
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
<init-param>
<param-name>thresholdSize</param-name>
<param-value>1048576000</param-value><!--51200-->
</init-param>
<init-param>
<param-name>uploadDirectory</param-name>
<param-value>/temp</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>Pretty Filter</filter-name>
<filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Pretty Filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<!-- JSF Required Filters & Listeners END-->
<!-- JSF Required Servlets START -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
Changed war class loader order to "parent last" and policy to "Single class loader for application" in WebSphere admin console to pick apps own JSF version.
Removed the redundant jars (servlet-api.jar and xml-apis-1.0.b2.jar are in my case) from WEB-INF/Lib folder as it collides with server versions.
The above solved this issue. However creating Isolated shared library (https://stackoverflow.com/a/12081307/1341062) would be better option when you have app-specific dependencies that may collide with server versions.
I am using the ?faces-redirect=true in my JSF2, since I would like to redirect the user so the URL will be changed.
In JSF1.2 I added </redirect> in faces-config.
In JSF2 I have to add to my url return home?faces-redirect=true.
The problem is that I see faces-redirect=2 in the URL, what I haven't seen in JSF1.2 when I used </redirect>
How can I use faces-redirect in actions without displaying it in the browser URL?
My Jar's list:
antlr-2.7.6.jar
aopalliance-1.0.jar
aspectjrt.jar
atmosphere-compat-tomcat-0.5.jar
atmosphere-runtime-0.5.jar
commons-beanutils-1.7.0.jar
commons-collections-3.2.jar
commons-dbcp-1.2.2.jar
commons-digester-2.0.jar
commons-fileupload-1.2.1.jar
commons-httpclient-3.1.jar
commons-io-1.4.jar
commons-logging-1.1.1.jar
commons-pool-1.5.4.jar
dom4j.jar
ehcache-1.2.4.jar
hibernate-annotations.jar
hibernate-cglib-repack-2.1_3.jar
hibernate-commons-annotations.jar
hibernate3.jar
itext-1.4.8.jar
javassist.jar
javax.persistence.jar
jhighlight-1.0.jar
jsf-api.jar
jsf-impl.jar
jstl-api-1.2.jar
jstl-impl-1.2.jar
jta-1.1.jar
log4j-1.2.15.jar
mail.jar
mysql-connector-java-5.1.0-bin.jar
org.springframework.aop-3.0.1.RELEASE-A.jar
org.springframework.asm-3.0.1.RELEASE-A.jar
org.springframework.aspects-3.0.1.RELEASE-A.jar
org.springframework.beans-3.0.1.RELEASE-A.jar
org.springframework.context-3.0.1.RELEASE-A.jar
org.springframework.context.support-3.0.1.RELEASE-A.jar
org.springframework.core-3.0.1.RELEASE-A.jar
org.springframework.expression-3.0.1.RELEASE-A.jar
org.springframework.instrument-3.0.1.RELEASE-A.jar
org.springframework.instrument.tomcat-3.0.1.RELEASE-A.jar
org.springframework.jdbc-3.0.1.RELEASE-A.jar
org.springframework.jms-3.0.1.RELEASE-A.jar
org.springframework.orm-3.0.1.RELEASE-A.jar
org.springframework.oxm-3.0.1.RELEASE-A.jar
org.springframework.test-3.0.1.RELEASE-A.jar
org.springframework.transaction-3.0.1.RELEASE-A.jar
org.springframework.web-3.0.1.RELEASE-A.jar
org.springframework.web.portlet-3.0.1.RELEASE-A.jar
org.springframework.web.servlet-3.0.1.RELEASE-A.jar
org.springframework.web.struts-3.0.1.RELEASE-A.jar
poi-3.2-FINAL.jar
primefaces-2.0.3-SNAPSHOT.jar
slf4j-api-1.5.11.jar
slf4j-log4j12-1.5.11.jar
spring-aop.jar
My web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>OnBoard</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<context-param>
<description></description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/applicationContext.xml
classpath:/applicationContext-security.xml
</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.forceLoadConfiguration</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.BUILD_BEFORE_RESTORE</param-name>
<param-value>false</param-value>
</context-param>
<filter>
<filter-name>Security Page Filter</filter-name>
<filter-class>com.mycompany.servlet.SecurityFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Security Page Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/primefaces_resource/*</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
This looks all fine. Something else is disturbing it. Maybe Spring? I don't do Spring so I can't tell anything about it. At least, it works fine here with Mojarra 2.0.2 + PrimeFaces 2.1 + Tomcat 6.0.24.
To nail this problem down anyway, consider creating a brand new web project with only jsf-api.jar and jsf-impl.jar files in the /WEB-INF/lib and two simple XHTML files with a <h:commandButton outcome="otherfile?faces-redirect=true" />. Then add libraries/components/mappings step by step until you get the same setup as the original project. Test the working of faces-redirect during every step. Keep track of what you've added so that you know what may have caused this problem.
That's not what I'm experiencing with Mojarra (the RI). If I return the following in a managed bean:
return "somepage" + "?faces-redirect=true";
JSF redirects to the target somepage view and the URL doesn't include the ?faces-redirect=true.
What implementation are you using?
I am using Primefaces 2.0.1 but the FileUpload component is not working properly. It uses JQuery uploadify behind the scenes. This is my web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/primefaces_resource/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsf</welcome-file>
</welcome-file-list>
</web-app>
This is my index.xhtml :-
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<h:form prependId="false">
<h:commandButton actionListener="#{NewJSFManagedBean.add}" value="add"/>
<p:fileUpload auto="false" widgetVar="fileUpl" fileUploadListener="#{NewJSFManagedBean.saveFile}"/>
</h:form>
</h:body>
</html>
I have following libraries in my classpath :-
primefaces 2.0.1
commons-beanutils
commons-beanutils-bean-collection
commons-digestor
commons-fileUpload
commons-io
commons-logging
jhighlight
The file gets correctly uploaded in /tmp but in browser it always says HTTP error. Please help me. It used to work till yesterday. But today i did a fresh installation of Glassfish and it has stopped working.
A filter needs to be added to web.xml. So, add these lines to web.xml
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
<init-param>
<param-name>thresholdSize</param-name>
<param-value>51200</param-value>
</init-param>
<init-param>
<param-name>uploadDirectory</param-name>
<param-value>/tmp</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
To be able to use the Primefaces fileUpload component, a few Apache Commons dependencies also need to be added:
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
I have had some troubles with this component also. I seem to remember that by adding an id to the fileUpload component and/or the form, things started working for me. Worth a try.
i think you are missing enctype="multipart/form-data" in your h:form tag.
I had the same problem. And note that by deleting the cookies from my browser-firefox-and going to upload my application and it worked.
I'm using PRIMEFACES 2.2.1 and the problem is still there: HTTP error when Chrome or Firefox is used; all fine with IE. In my case, this apparently happens due to a reverse proxy shielding the actual server running the application. If the application is used through a direct URL reference (http://server:port/some path), it works fine; if the reverse proxy URL is used, the requests fail. I don't know why this fails in FF and GC and doesn't do so in IE.