rich:fileUpload of Richfaces 3.3.3.Final fails with files bigger than 1KB
cprietom May 23, 2013 6:57 AMHello,
I'm not sure it this error might be related to my previous error https://community.jboss.org/message/816966#816966
My environment is as follows: Seam 2.0.2.SP1 + JSF 1.2 + Richfaces 3.3.3.Final on JBoss 7.1.1.Final, and I'm not able to upload files bigger than 1KB neither over HTTP not over HTTPS.
Here is the basic test.xhtml file with the rich:fileUpload component:
<!DOCTYPE html>
<html xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j">
<head>
<title>Test FileUpload</title>
</head>
<body>
<!-- AJAX logs popup -->
<a4j:log level="ALL" style="width: 800px; height: 300px;" hotkey="U"></a4j:log>
TEST UPLOAD
<br />
<h:form>
<rich:fileUpload fileUploadListener="#{testFileUpload.test}"
maxFilesQuantity="1"
listHeight="100"
listWidth="300"
addControlLabel="Attach">
</rich:fileUpload>
</h:form>
</body>
</html>
My TestFileUpload class is as dumb as follows:
@Name("testFileUpload")
public class TestFileUpload implements Serializable {
private static final long serialVersionUID = -8524230445311969496L;
@Logger Log log;
public void test(UploadEvent event) throws Exception {
log.info("test...");
UploadItem item = event.getUploadItem();
log.info("uploading file " + item.getFileName() + " of size " + item.getFileSize());
}
}
And here is 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>netpro-app</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<listener>
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
</listener>
<filter>
<filter-name>Seam Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Seam Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>Seam Resource Servlet</servlet-name>
<servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Seam Resource Servlet</servlet-name>
<url-pattern>/seam/resource/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<security-constraint>
<display-name>Restrict raw XHTML Documents</display-name>
<web-resource-collection>
<web-resource-name>XHTML</web-resource-name>
<url-pattern>*.xhtml</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
<context-param>
<param-name>facelets.RECREATE_VALUE_EXPRESSION_ON_BUILD_BEFORE_RESTORE</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.BUILD_BEFORE_RESTORE</param-name>
<param-value>true</param-value>
</context-param>
<filter>
<display-name>Richfaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
<init-param>
<param-name>maxRequestSize</param-name>
<param-value>10000000</param-value>
</init-param>
<init-param>
<param-name>createTempFiles</param-name>
<param-value>false</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>FacesServletWrapper</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<session-config>
<session-timeout>10</session-timeout>
</session-config>
</web-app>
When I upload a 1KB file, everything goes fine and I see the logs on the server. However, when the size is bigger, the "uploading" message that the component writes below the progress bar remains there forever, and these are the only logs that appear on the server:
12:18:46,138 WARN [org.ajax4jsf.component.AjaxViewRoot] (ajp--0.0.0.0-8009-4) No component found to process as 'ajaxSingle' for clientId j_id4:j_id5_rich_progress
12:18:46,139 WARN [org.ajax4jsf.component.AjaxViewRoot] (ajp--0.0.0.0-8009-4) No component found to process as 'ajaxSingle' for clientId j_id4:j_id5_rich_progress
12:18:46,140 WARN [org.ajax4jsf.component.AjaxViewRoot] (ajp--0.0.0.0-8009-4) No component found to process as 'ajaxSingle' for clientId j_id4:j_id5_rich_progress
And the AJAX logs are these:
debug[12:18:44,696]: Query preparation for form 'j_id4' requested
debug[12:18:44,729]: Append hidden control j_id4 with value [j_id4] and value attribute [j_id4]
debug[12:18:44,741]: Append file control j_id4:j_id5:file with value [C:\Users\carlos.prieto\b.txt] and value attribute [C:\Users\carlos.prieto\b.txt]
debug[12:18:44,749]: Append file control j_id4:j_id5:file with value [] and value attribute []
debug[12:18:44,759]: Append hidden control javax.faces.ViewState with value [j_id7] and value attribute [j_id7]
debug[12:18:44,772]: parameter j_id4:j_id5 with value j_id4:j_id5
debug[12:18:44,781]: parameter ajaxSingle with value j_id4:j_id5
debug[12:18:44,787]: parameter _richfaces_upload_uid with value 0.16554835066877704
debug[12:18:44,795]: parameter _richfaces_file_upload_action with value progress
debug[12:18:44,802]: Look up queue with default name
debug[12:18:44,808]: NEW AJAX REQUEST !!! with form: j_id4
debug[12:18:44,817]: Start XmlHttpRequest
debug[12:18:44,823]: Request state : 1
debug[12:18:44,831]: QueryString: AJAXREQUEST=_viewRoot&j_id4=j_id4&j_id4%3Aj_id5%3Afile=C%3A%5CUsers%5Ccarlos.prieto%5Cb.txt&j_id4%3Aj_id5%3Afile=&javax.faces.ViewState=j_id7&j_id4%3Aj_id5=j_id4%3Aj_id5&ajaxSingle=j_id4%3Aj_id5&_richfaces_upload_uid=0.16554835066877704&_richfaces_file_upload_action=progress&
debug[12:18:44,891]: Request state : 2
debug[12:18:44,898]: Request state : 3
debug[12:18:44,905]: Request state : 4
debug[12:18:44,913]: Request end with state 4
debug[12:18:44,919]: Response with content-type: text/xml;charset=UTF-8
debug[12:18:44,925]: Full response content: <?xml version="1.0"?><html lang="es" xmlns="http://www.w3.org/1999/xhtml"><head><title></title><link class="component" href="/netpro/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAGTiFGMCF0-QxoACl4CnQ__.seam" rel="stylesheet" type="text/css" /><link class="component" href="/netpro/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAGTiFGMCF0-QxoACl4CnQ__.seam" media="rich-extended-skinning" rel="stylesheet" type="text/css" /><script src="/netpro/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript.seam" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.PrototypeScript.seam" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/utils.js.seam" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/json/json-dom.js.seam" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/js/FileUpload.js.seam" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/js/swfobject.js.seam" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/js/progressBar.js.seam" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_3.Finalorg/ajax4jsf/javascript/scripts/form.js.seam" type="text/javascript"></script><link class="component" href="/netpro/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/fileUpload.xcss/DATB/eAGTiFGMCF0-QxoACl4CnQ__.seam" rel="stylesheet" type="text/css" /><link class="component" href="/netpro/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/progressBar.xcss/DATB/eAGTiFGMCF0-QxoACl4CnQ__.seam" rel="stylesheet" type="text/css" /><script src="/netpro/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/skinning.js.seam" type="text/javascript"></script></head><body><meta name="Ajax-Update-Ids" content="" /><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id8" autocomplete="off" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /><span id="_ajax:data"><![CDATA[ 8634 ]]></span><meta name="Ajax-Update-Ids" content="" /><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id8" autocomplete="off" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /><span id="_ajax:data"><![CDATA[ 8634 ]]></span></body></html>
debug[12:18:44,974]: Header Ajax-Expired not found, search in <meta>
debug[12:18:44,981]: search for elements by name 'meta' in element #document
debug[12:18:44,988]: Find <meta name='Ajax-Update-Ids' content=''>
debug[12:18:44,999]: Find <meta name='Ajax-Response' content='true'>
debug[12:18:45,007]: Find <meta name='Ajax-Update-Ids' content=''>
debug[12:18:45,015]: Find <meta name='Ajax-Response' content='true'>
debug[12:18:45,023]: call selectSingleNode for id= _ajax:data
debug[12:18:45,033]: Call local onbeforedomupdate function before replacing elemements
debug[12:18:45,041]: Header Ajax-Update-Ids not found, search in <meta>
debug[12:18:45,050]: search for elements by name 'meta' in element #document
debug[12:18:45,057]: Find <meta name='Ajax-Update-Ids' content=''>
warn[12:18:45,064]: No information in response about elements to replace
debug[12:18:45,071]: call selectSingleNode for id= org.ajax4jsf.oncomplete
debug[12:18:45,078]: Processing updates finished, no oncomplete function to call
debug[12:18:45,085]: call selectSingleNode for id= ajax-view-state
debug[12:18:45,091]: Hidden JSF state fields:
debug[12:18:45,101]: Namespace for hidden view-state input fields is undefined
debug[12:18:45,111]: search for elements by name 'input' in element span
debug[12:18:45,122]: Replace value for inputs: 4 by new values: 1
debug[12:18:45,130]: Input in response: javax.faces.ViewState
debug[12:18:45,147]: Found same input on page with type: hidden
debug[12:18:45,159]: search for elements by name 'INPUT' in element span
debug[12:18:45,167]: Replace value for inputs: 4 by new values: 0
debug[12:18:45,173]: call selectSingleNode for id= _A4J.AJAX.focus
debug[12:18:45,182]: No focus information in response
debug[12:18:46,048]: Query preparation for form 'j_id4' requested
debug[12:18:46,054]: Append hidden control j_id4 with value [j_id4] and value attribute [j_id4]
debug[12:18:46,060]: Append file control j_id4:j_id5:file with value [C:\Users\carlos.prieto\b.txt] and value attribute [C:\Users\carlos.prieto\b.txt]
debug[12:18:46,066]: Append file control j_id4:j_id5:file with value [] and value attribute []
debug[12:18:46,072]: Append hidden control javax.faces.ViewState with value [j_id8] and value attribute [j_id8]
debug[12:18:46,079]: parameter percent with value percent
debug[12:18:46,085]: parameter ajaxSingle with value j_id4:j_id5_rich_progress
debug[12:18:46,090]: parameter j_id4:j_id5_rich_progress with value j_id4:j_id5_rich_progress
debug[12:18:46,097]: Look up queue with default name
debug[12:18:46,105]: NEW AJAX REQUEST !!! with form: j_id4
debug[12:18:46,116]: Start XmlHttpRequest
debug[12:18:46,124]: Request state : 1
debug[12:18:46,132]: QueryString: AJAXREQUEST=_viewRoot&j_id4=j_id4&j_id4%3Aj_id5%3Afile=C%3A%5CUsers%5Ccarlos.prieto%5Cb.txt&j_id4%3Aj_id5%3Afile=&javax.faces.ViewState=j_id8&percent=percent&ajaxSingle=j_id4%3Aj_id5_rich_progress&j_id4%3Aj_id5_rich_progress=j_id4%3Aj_id5_rich_progress&
debug[12:18:46,158]: Request state : 2
debug[12:18:46,169]: Request state : 3
debug[12:18:46,180]: Request state : 4
debug[12:18:46,187]: Request end with state 4
debug[12:18:46,194]: Response with content-type: text/xml;charset=UTF-8
debug[12:18:46,201]: Full response content: <?xml version="1.0"?><html lang="es" xmlns="http://www.w3.org/1999/xhtml"><head><title></title><link class="component" href="/netpro/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAGTiFGMCF0-QxoACl4CnQ__.seam" rel="stylesheet" type="text/css" /><link class="component" href="/netpro/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAGTiFGMCF0-QxoACl4CnQ__.seam" media="rich-extended-skinning" rel="stylesheet" type="text/css" /><script src="/netpro/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript.seam" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.PrototypeScript.seam" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/utils.js.seam" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/json/json-dom.js.seam" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/js/FileUpload.js.seam" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/js/swfobject.js.seam" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/js/progressBar.js.seam" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_3.Finalorg/ajax4jsf/javascript/scripts/form.js.seam" type="text/javascript"></script><link class="component" href="/netpro/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/fileUpload.xcss/DATB/eAGTiFGMCF0-QxoACl4CnQ__.seam" rel="stylesheet" type="text/css" /><link class="component" href="/netpro/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/progressBar.xcss/DATB/eAGTiFGMCF0-QxoACl4CnQ__.seam" rel="stylesheet" type="text/css" /><script src="/netpro/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/skinning.js.seam" type="text/javascript"></script></head><body><meta name="Ajax-Update-Ids" content="" /><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id9" autocomplete="off" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /><meta name="Ajax-Update-Ids" content="" /><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id9" autocomplete="off" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /></body></html>
debug[12:18:46,210]: Header Ajax-Expired not found, search in <meta>
debug[12:18:46,217]: search for elements by name 'meta' in element #document
debug[12:18:46,223]: Find <meta name='Ajax-Update-Ids' content=''>
debug[12:18:46,233]: Find <meta name='Ajax-Response' content='true'>
debug[12:18:46,245]: Find <meta name='Ajax-Update-Ids' content=''>
debug[12:18:46,252]: Find <meta name='Ajax-Response' content='true'>
debug[12:18:46,258]: call selectSingleNode for id= _ajax:data
debug[12:18:46,267]: Call local onbeforedomupdate function before replacing elemements
debug[12:18:46,273]: Header Ajax-Update-Ids not found, search in <meta>
debug[12:18:46,280]: search for elements by name 'meta' in element #document
debug[12:18:46,287]: Find <meta name='Ajax-Update-Ids' content=''>
warn[12:18:46,293]: No information in response about elements to replace
debug[12:18:46,300]: call selectSingleNode for id= org.ajax4jsf.oncomplete
debug[12:18:46,306]: Processing updates finished, no oncomplete function to call
debug[12:18:46,313]: call selectSingleNode for id= ajax-view-state
debug[12:18:46,320]: Hidden JSF state fields:
debug[12:18:46,326]: Namespace for hidden view-state input fields is undefined
debug[12:18:46,334]: search for elements by name 'input' in element span
debug[12:18:46,346]: Replace value for inputs: 4 by new values: 1
debug[12:18:46,356]: Input in response: javax.faces.ViewState
debug[12:18:46,369]: Found same input on page with type: hidden
debug[12:18:46,375]: search for elements by name 'INPUT' in element span
debug[12:18:46,382]: Replace value for inputs: 4 by new values: 0
debug[12:18:46,389]: call selectSingleNode for id= _A4J.AJAX.focus
debug[12:18:46,398]: No focus information in response
Has anyone experienced this issue? Any clues about how to solve it?
Thanks in advance.