6 Replies Latest reply on May 9, 2013 6:55 AM by Carlos Prieto

    rich:fileUpload works over HTTP, but not over HTTPS

    Carlos Prieto Newbie

      Hello,

       

      The following simple piece of XHTML code throws the pasted exception when I point my browser (IE9 or Chrome25 on Windows7) to my application running with Seam 2.0.2 + JSF1.2 + Richfaces 3.3.1 on JBoss 4.2.2 OVER HTTPS

      If I point to the application OVER HTTP, it works like a charm.

       

      XHTML code:

      <!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>

                          <a4j:log level="ALL" style="width: 800px; height: 300px;" hotkey="U"></a4j:log>

                             UPLOAD

                             <br />

                             <h:form>

                                    <rich:fileUpload fileUploadListener="#{uploadBean.listener}"

                                                                            id="upload"

                                                                            maxFilesQuantity="1"

                                                                listHeight="100"

                                                                listWidth="300"

                                                                addControlLabel="Attach">

                              </rich:fileUpload>

                          </h:form>

         </body>

      </html>

       

       

      JBoss 4.2.2. exception:

      16:26:15,214 WARN  [lifecycle] phase(RESTORE_VIEW 1,com.sun.faces.context.FacesContextImpl@53a8d76c) threw exception: java.lang.ArrayIndexOutOfBoundsException null
      java.lang.System.arraycopy(Native Method)
      org.ajax4jsf.request.MultipartRequest.fillBuffer(MultipartRequest.java:396)
      org.ajax4jsf.request.MultipartRequest.initialize(MultipartRequest.java:600)
      org.ajax4jsf.request.MultipartRequest.parseRequest(MultipartRequest.java:616)
      org.richfaces.component.FileUploadPhaselistener.beforePhase(FileUploadPhaselistener.java:63)
      com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:218)
      com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
      com.corpme.mercantil.utils.FacesServletWrapper.service(FacesServletWrapper.java:40)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:510)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      com.corpme.mercantil.utils.SessionTimeoutFilter.doFilter(SessionTimeoutFilter.java:71)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
      org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
      org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:347)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
      org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
      org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      java.lang.Thread.run(Thread.java:662)
      
      

       

       

      I paste here the AJAX code that is logged on the client when I navigate to the application through HTTP. When I navigate through HTTPS, this same log appears, but it repeats indefinitely, and nothing but the exception appears on the server logs.

      Clear
      
      debug[16:42:58,199]: Query preparation for form 'j_id4' requested
      debug[16:42:58,207]: Append hidden control j_id4 with value [j_id4] and value attribute [j_id4]
      debug[16:42:58,217]: Append hidden control javax.faces.ViewState with value [j_id1] and value attribute [j_id1]
      debug[16:42:58,223]: Append file control j_id4:upload:file with value [C:\a.txt] and value attribute [C:\a.txt]
      debug[16:42:58,230]: Append file control j_id4:upload:file with value [] and value attribute []
      debug[16:42:58,238]: parameter ajaxSingle with value j_id4:upload
      debug[16:42:58,247]: parameter _richfaces_upload_uid with value 0.6539950139299615
      debug[16:42:58,254]: parameter _richfaces_file_upload_action with value progress
      debug[16:42:58,261]: parameter j_id4:upload with value j_id4:upload
      debug[16:42:58,266]: Look up queue with default name
      debug[16:42:58,272]: NEW AJAX REQUEST !!! with form: j_id4
      debug[16:42:58,280]: Start XmlHttpRequest
      debug[16:42:58,286]: Reqest state : 1
      debug[16:42:58,291]: QueryString:  AJAXREQUEST=_viewRoot&j_id4=j_id4&javax.faces.ViewState=j_id1&j_id4%3Aupload%3Afile=C%3A%5Ca.txt&j_id4%3Aupload%3Afile=&ajaxSingle=j_id4%3Aupload&_richfaces_upload_uid=0.6539950139299615&_richfaces_file_upload_action=progress&j_id4%3Aupload=j_id4%3Aupload&
      debug[16:42:58,427]: Reqest state : 2
      debug[16:42:58,436]: Reqest state : 3
      debug[16:42:58,443]: Reqest state : 4
      debug[16:42:58,450]: Reqest end with state 4
      debug[16:42:58,457]: Response  with content-type: text/xml;charset=UTF-8
      debug[16:42:58,465]: Full response content: <?xml version="1.0"?><html xmlns="http://www.w3.org/1999/xhtml"><head><link class="component" href="/netpro/a4j/s/3_3_1.GAorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAGTiFGMCF0-QxoACl4CnQ__" rel="stylesheet" type="text/css" /><link class="component" href="/netpro/a4j/s/3_3_1.GAorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAGTiFGMCF0-QxoACl4CnQ__" media="rich-extended-skinning" rel="stylesheet" type="text/css" /><script src="/netpro/a4j/g/3_3_1.GAorg.ajax4jsf.javascript.AjaxScript" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_1.GAorg.ajax4jsf.javascript.PrototypeScript" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/scripts/utils.js" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/scripts/json/json-dom.js" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/js/FileUpload.js" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/js/swfobject.js" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/js/progressBar.js" type="text/javascript"></script><script src="/netpro/a4j/g/3_3_1.GAorg/ajax4jsf/javascript/scripts/form.js" type="text/javascript"></script><link class="component" href="/netpro/a4j/s/3_3_1.GAorg/richfaces/renderkit/html/css/fileUpload.xcss/DATB/eAGTiFGMCF0-QxoACl4CnQ__" rel="stylesheet" type="text/css" /><link class="component" href="/netpro/a4j/s/3_3_1.GAorg/richfaces/renderkit/html/css/progressBar.xcss/DATB/eAGTiFGMCF0-QxoACl4CnQ__" rel="stylesheet" type="text/css" /><script src="/netpro/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/scripts/skinning.js" type="text/javascript"></script><meta name="Ajax-Update-Ids" content="" /><title></title></head><body><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id1" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /><span id="_ajax:data"><![CDATA[ 429 ]]></span></body></html>
      debug[16:42:58,473]: Header Ajax-Expired not found, search in <meta>
      debug[16:42:58,481]: search for elements by name 'meta'  in element #document
      debug[16:42:58,487]: Find <meta name='Ajax-Update-Ids' content=''>
      debug[16:42:58,494]: Find <meta name='Ajax-Response' content='true'>
      debug[16:42:58,501]: call selectSingleNode for id= _ajax:data
      debug[16:42:58,532]: Call local onbeforedomupdate function before replacing elemements
      debug[16:42:58,540]: Header Ajax-Update-Ids not found, search in <meta>
      debug[16:42:58,549]: search for elements by name 'meta'  in element #document
      debug[16:42:58,556]: Find <meta name='Ajax-Update-Ids' content=''>
      warn[16:42:58,565]: No information in response about elements to replace
      debug[16:42:58,579]: call selectSingleNode for id= org.ajax4jsf.oncomplete
      debug[16:42:58,591]: Processing updates finished, no oncomplete function to call
      debug[16:42:58,600]: call selectSingleNode for id= ajax-view-state
      debug[16:42:58,606]: Hidden JSF state fields: 
      debug[16:42:58,614]: Namespace for hidden view-state input fields is undefined
      debug[16:42:58,621]: search for elements by name 'input'  in element span
      debug[16:42:58,629]: Replace value for inputs: 4 by new values: 1
      debug[16:42:58,635]: Input in response: javax.faces.ViewState
      debug[16:42:58,641]: Found same input on page with type: hidden
      debug[16:42:58,649]: search for elements by name 'INPUT'  in element span
      debug[16:42:58,655]: Replace value for inputs: 4 by new values: 0
      debug[16:42:58,663]: call selectSingleNode for id= _A4J.AJAX.focus
      debug[16:42:58,669]: No focus information in response
      
      

       

      The "uploadBean" listener is as simple as this:

       

      @Name("uploadBean")
      public class UploadBean implements Serializable {
                private static final long serialVersionUID = -8524230445311969496L;
      
      
                @Logger Log log;
      
          public void listener(UploadEvent event) throws Exception {
                    log.info("Uploading file...");
                    UploadItem item = event.getUploadItem();
                    log.info("File name: " + item.getFileName());
          } 
      }
      

       

      Any ideas?

      Thanks.