9 Replies Latest reply on Jul 22, 2010 6:01 AM by ilya_shaikovsky

    File upload issue

    mpickell

      I am using the file upload component through java.  The component renders fine, and it lets me select a file... but when i select the upload button, I get this exception:

       

      javax.servlet.ServletException: FacesEvent of class org.richfaces.event.UploadAjaxActionEvent not supported by UIInput

       

      I am using myfaces 1.2.2, and richfaces 3.3.1.

       

      I saw another post similar to this that suggested upgrade myfaces..  is that the only solution? or is there something else I can do to avoid the testing associated with swapping in a new version of that library?

        • 1. Re: File upload issue
          mpickell

          additional information:

           

          If I change "allowFlash" to "true", i get a different error:

           

          SEVERE: Servlet.service() for servlet Faces Servlet threw exception
          java.lang.NullPointerException
              at org.richfaces.renderkit.FileUploadRendererBase.doDecode(FileUploadRendererBase.java:140)

           

           

           

          -- If I am setting this component up in java, using the HtmlFileUpload class, is there a minimum set of attributes that I MUST set?  for example, do I need to set a value, even though the FileUploadListener is handling every upload?

          • 2. Re: File upload issue
            nbelaevski

            Hi Matthew,

             

            Please check that MyFaces filter is configured correctly - it should be called after RF filter, not before. Also you should see warning message if configuration is not correct.

            • 3. Re: File upload issue
              mpickell

              Here is that section of my web.xml:

               

              <filter>
                      <display-name>RichFaces Filter</display-name>
                      <filter-name>richfaces</filter-name>
                      <filter-class>org.ajax4jsf.Filter</filter-class>
                  </filter>

               

                  <filter-mapping>
                      <filter-name>richfaces</filter-name>
                      <servlet-name>Faces Servlet</servlet-name>
                      <dispatcher>REQUEST</dispatcher>
                      <dispatcher>FORWARD</dispatcher>
                      <dispatcher>INCLUDE</dispatcher>
                  </filter-mapping>

               

                  <filter>
                      <filter-name>extensionsFilter</filter-name>
                      <filter-class>
                          org.apache.myfaces.webapp.filter.ExtensionsFilter
                      </filter-class>
                      <init-param>
                          <description>
                              Set the size limit for uploaded files. Format: 10 - 10
                              bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
                          </description>
                          <param-name>uploadMaxFileSize</param-name>
                          <param-value>100m</param-value>
                      </init-param>
                      <init-param>
                          <description>
                              Set the threshold size - files below this limit are
                              stored in memory, files above this limit are stored on
                              disk. Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g -
                              1 GB
                          </description>
                          <param-name>uploadThresholdSize</param-name>
                          <param-value>100k</param-value>
                      </init-param>
                  </filter>
                  <filter-mapping>
                      <filter-name>extensionsFilter</filter-name>
                      <url-pattern>*.faces</url-pattern>
                  </filter-mapping>
                  <filter-mapping>
                      <filter-name>extensionsFilter</filter-name>
                      <url-pattern>/faces/*</url-pattern>
                  </filter-mapping>

              • 4. Re: File upload issue
                ilya_shaikovsky

                filters which are uses url-mapping - called before filters which are uses servlet-mapping by name and no matter in which sequence them defined in web.xml

                • 5. Re: File upload issue
                  mpickell

                  Ilya,

                   

                  So what you are saying is that these filters are being called in the wrong order?  Can I define richfaces to be called after myfaces?

                  • 6. Re: File upload issue
                    ilya_shaikovsky

                    As Nick said:

                    Please check that MyFaces filter is configured correctly - it should be called after RF filter, not before.

                    RF should be first.

                    And in your case - according to my explanation - MyFaces ones are.

                    • 7. Re: File upload issue
                      mpickell

                      ok, so i need the myfaces filter to run after the RF filter, but the myfaces use URL-mapping so it is running before the RF filter.

                       

                      Can you suggest a change or is this something that requires a more major reconfiguration?

                      • 8. Re: File upload issue
                        mpickell

                        Would this issue affect all of RichFaces, or only this specific issue?  Because everything else is working fine except for this file upload.

                         

                        Thanks.

                        • 9. Re: File upload issue
                          ilya_shaikovsky

                          this could affect the other part of app  only inone way - another issues will not be appear.. Because fileUpload not the only component which potentially(in specific cases) could be broken in such cnfiguration.

                           

                          Here is issue which was risen to create sample: https://jira.jboss.org/browse/RF-3096