Hi!
This issue continues in Primefaces 3.0.M2 as well as in new 3.0.M3:
I use an advanced fileupload component as follows:
<p:fileUpload fileUploadListener="#{mySessionBean.handleFileUpload}"
mode="advanced"
update="filemessages"
auto="true"
multiple="true"
sizeLimit="10000000"
allowTypes="/(\.|\/)(gif|jpe?g|png|pdf|bmp|xcf|psp)$/"/>
<p:growl id="filemessages" showDetail="true"/>
in mySessionBean i have a method:
// primefaces alternative test
public void handleFileUpload(FileUploadEvent event) {
FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);
logger.info("happlily uploaded some file");
}
OK, now it is never the case that my logger reports a "happily uploaded file". The component renders allright, the filetype filters work as well, but on fileuplad it just disappears.. no log messages no growl update. nothing.. Note as well: yes i use <h:form /> with the proper enctype and statesaving method is server.
In the very form I am able to use <t:fileupload /> from tomahawk. My templated file from ui:compositon has <!Doctype html> , a html5 header, so why does all fails?
Thanks in advance for help. I try to get your <p:fileupload/> component to work for several month and put a lot of hard work to it. It would be somehow frustrating to know that <p:fileupload /> is really broken.
File Upload still broken
Busy applying primefaces patches to my local repo at /dev/null
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Can you replicate at showcase?
optimus.prime wrote:Can you replicate at showcase?
On Primefaces 2.2.1:
The fileupload component gets "through" to the server and causes there an error, see stack trace[1]. I tried to reproduce this error with same setting, but re-deploying the project just left the component "bad rendeered". I mean: it was there, but its color was same white color as background and clicking it have done nothing.. not even a file chooser box. I restarted tomcat, but the component was not rendering right. It still gets displayed as code [2]. I have not tried to hard reboot my machine, but I cannot beleave a tomcat restart and a complete history clean on firefox5.0 couldn`t made the component show up again. A few month ago I had simillar issues on Primefaces 2.2.1 with tomcat 6.026, but decieded not to make a bugreport at that time.
Greets,
Adam
[1] Stack trace:
Code: Select all
WARNING: Identifier for execute FlashMap was lost on the postback, thus FlashScope information is gone.
2011-09-06 07:56:02 org.apache.myfaces.shared_impl.util.StateUtils reconstruct
SEVERE: View State cannot be reconstructed
javax.faces.FacesException: javax.faces.application.ViewExpiredException
at org.apache.myfaces.shared_impl.util.StateUtils.decrypt(StateUtils.java:496)
at org.apache.myfaces.shared_impl.util.StateUtils.reconstruct(StateUtils.java:378)
at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.getSavedState(HtmlResponseStateManager.java:239)
at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.getState(HtmlResponseStateManager.java:178)
at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.restoreView(DefaultFaceletsStateManagementStrategy.java:142)
at org.apache.myfaces.application.StateManagerImpl.restoreView(StateManagerImpl.java:113)
at org.apache.myfaces.shared_impl.view.ViewDeclarationLanguageBase.restoreView(ViewDeclarationLanguageBase.java:106)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.restoreView(FaceletViewDeclarationLanguage.java:1620)
at org.apache.myfaces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:296)
at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:83)
at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:123)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:171)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:349)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:636)
Caused by: javax.faces.application.ViewExpiredException
at org.apache.myfaces.shared_impl.util.StateUtils.decrypt(StateUtils.java:489)
... 28 more
2011-09-06 07:56:32 org.apache.myfaces.shared_impl.context.flash.FlashImpl _manageFlashMapTokens
WARNING: Identifier for execute FlashMap was lost on the postback, thus FlashScope information is gone.
2011-09-06 07:56:32 org.apache.myfaces.shared_impl.util.StateUtils reconstruct
SEVERE: View State cannot be reconstructed
javax.faces.FacesException: javax.faces.application.ViewExpiredException
at org.apache.myfaces.shared_impl.util.StateUtils.decrypt(StateUtils.java:496)
at org.apache.myfaces.shared_impl.util.StateUtils.reconstruct(StateUtils.java:378)
at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.getSavedState(HtmlResponseStateManager.java:239)
at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.getState(HtmlResponseStateManager.java:178)
at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.restoreView(DefaultFaceletsStateManagementStrategy.java:142)
at org.apache.myfaces.application.StateManagerImpl.restoreView(StateManagerImpl.java:113)
at org.apache.myfaces.shared_impl.view.ViewDeclarationLanguageBase.restoreView(ViewDeclarationLanguageBase.java:106)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.restoreView(FaceletViewDeclarationLanguage.java:1620)
at org.apache.myfaces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:296)
at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:83)
at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:123)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:171)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:349)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:636)
Caused by: javax.faces.application.ViewExpiredException
at org.apache.myfaces.shared_impl.util.StateUtils.decrypt(StateUtils.java:489)
... 28 more
Code: Select all
<script type="text/javascript"><!--
jQuery(function() {widget_untererTeil_j_id1219769882_48b43643 = new PrimeFaces.widget.Uploader('untererTeil:j_id1219769882_48b43643', {uploader:'/teamware3/javax.faces.resource/fileupload/uploadify.swf.xhtml?ln=primefaces&v=2.2.1',script:'/teamware3/bildblog/test.xhtml',cancelImg:'/teamware3/javax.faces.resource/fileupload/cancel.png.xhtml?ln=primefaces&v=2.2.1',formId:'untererTeil',fileDataName:'untererTeil_j_id1219769882_48b43643_file',multi:true,auto:true,inputFileId:'untererTeil_j_id1219769882_48b43643_file',jsessionid:'B9A1E36C45B14263BBB65AD435E12BF6',update:'untererTeil:filemessages',fileExt:'/(\.|\/)(gif|jpe?g|png|pdf|bmp|xcf|psp)$/',sizeLimit:10000000});});
//--></script><span id="untererTeil:filemessages"></span><script type="text/javascript"><!--
jQuery(function(){});
//--></script>
Busy applying primefaces patches to my local repo at /dev/null
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
2.2.1 is not maintained anymore, if you can replicate on 3.0.M3, then there is a problem, otherwise it seems fine on my tests.
- andyba
- Expert Member
- Posts: 2473
- Joined: 31 Mar 2011, 16:27
- Location: Steinfeld, near Bremen/Osnabrück, DE
- Contact:
This might be restating the obvious but have you setup the File Upload Filter for the application?
It was a little tricky to find the info on how to, I got mine from the PrimeFaces 2.2 User Guide.
You can check how this is done if you checkout the Showcase Maven Repository.
Edit: this is almost certain worth a bug report however current work circumstances prevent me from producing a suitable test case currently.
Currently in 3.0 M3 the advanced mode of fileUpload does not work correctly in IE 7, 8 or 9. In IE 9 there is evidence to suggest that one (or more) AJAX xml response(s) have too many document root tags.
This is circumstantial and the evidence is gleaned from the somewhat lean error message that is supplied by the IE 9 Developer tool. AFAIK this is not reproducible in the 3 Showcase although I was concentrating getting my webapp using 3 M3 running rather than checking things out on the showcase. Oh and the onstart event for fileUpload is still not firing in 3.0 M3.
Having said all that above the general stability of 3.0 M3 has convinced me to use it for a Web App that will shortly be going live via our web site.
Good work, keep it up!
It was a little tricky to find the info on how to, I got mine from the PrimeFaces 2.2 User Guide.
You can check how this is done if you checkout the Showcase Maven Repository.
Edit: this is almost certain worth a bug report however current work circumstances prevent me from producing a suitable test case currently.
Currently in 3.0 M3 the advanced mode of fileUpload does not work correctly in IE 7, 8 or 9. In IE 9 there is evidence to suggest that one (or more) AJAX xml response(s) have too many document root tags.
This is circumstantial and the evidence is gleaned from the somewhat lean error message that is supplied by the IE 9 Developer tool. AFAIK this is not reproducible in the 3 Showcase although I was concentrating getting my webapp using 3 M3 running rather than checking things out on the showcase. Oh and the onstart event for fileUpload is still not firing in 3.0 M3.
Having said all that above the general stability of 3.0 M3 has convinced me to use it for a Web App that will shortly be going live via our web site.
Good work, keep it up!
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
Well, indeed, I just checked my web.xml to find I have commented out the primefaces-filter.. do not rember why, think it was some issue in 3.0.M1.This might be restating the obvious but have you setup the File Upload Filter for the application?
Well, now i have a "happily uploaded" file in Primefaces 3.0.M3.
This thread can now be marked as solved. Thanks a lot to Andyba and Optimus Prime. Please rembember to close or delete the google-code ticket: http://code.google.com/p/primefaces/iss ... il?id=2474
Greets,
Adam
Busy applying primefaces patches to my local repo at /dev/null
OK, maybe wait before closing this thread:
I actually could replicate this error on Primefaces 3.0.M3. Here is how:
In web.xml I put first tomahawk filter then I put primefaces filter.. In this order primefaces fileupload will not work.
Then I change their relative order, primefaces filter being first, tomahawk filter second [1] .. and it works.
OK, so here is my thought: Primefaces fileupload listens to the first filter it finds in web.xml.
So, when tomahawk filter comes first it is mapped to tomahawk, and not its own primefaces filter.
Since, many people use more than one filter, (I actually use in some projects tomahawk and primefaces libraries side by side),
I think the primefaces filter needs some fixes.
Greets,
Adam
[1] in web.xml Primefaces filter first, tomahawk filter second:
Edit: since I am unsure, whether it is a tomahawk or primefaces bug, I provide my tomahawk version: 1.1.10.
I actually could replicate this error on Primefaces 3.0.M3. Here is how:
In web.xml I put first tomahawk filter then I put primefaces filter.. In this order primefaces fileupload will not work.
Then I change their relative order, primefaces filter being first, tomahawk filter second [1] .. and it works.
OK, so here is my thought: Primefaces fileupload listens to the first filter it finds in web.xml.
So, when tomahawk filter comes first it is mapped to tomahawk, and not its own primefaces filter.
Since, many people use more than one filter, (I actually use in some projects tomahawk and primefaces libraries side by side),
I think the primefaces filter needs some fixes.
Greets,
Adam
[1] in web.xml Primefaces filter first, tomahawk filter second:
Code: Select all
<!-- using primefaces filter -->
<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>2097152</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<!-- tomahawk filters -->
<filter>
<filter-name>MyFacesExtensionsFilter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
<init-param>
<param-name>uploadMaxFileSize</param-name>
<param-value>20m</param-value>
</init-param>
</filter>
<!-- extension mapping for adding <script/>, <link/>, and other resource
tags to JSF-pages -->
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet
entry -->
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<!-- extension mapping for serving page-independent resources (javascript,
stylesheets, images, etc.) -->
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
</filter-mapping>
Busy applying primefaces patches to my local repo at /dev/null
-
- Information
-
Who is online
Users browsing this forum: No registered users and 29 guests