3 Replies Latest reply on Apr 26, 2008 11:20 PM by amayen

    rich:fileUpload problem

    amayen

      Hi!


      I have the following problem, I'm trying to use the rich:fileUpload component to upload files.


      When I try to upload a file I get the following message:



      15:06:30,218 WARN  [lifecycle] /upload/uploadAttachment.xhtml @18,82 fileUploadL
      istener="#{uploadManager.listener}": Method not found: UploadManagerAction:2c1n7
      1n-7zmqne-fey50gkn-1-fey7c0s8-1p.listener(org.richfaces.event.UploadEvent)
      javax.faces.el.MethodNotFoundException: /upload/uploadAttachment.xhtml @18,82 fi
      leUploadListener="#{uploadManager.listener}": Method not found: UploadManagerAct
      ion:2c1n71n-7zmqne-fey50gkn-1-fey7c0s8-1p.listener(org.richfaces.event.UploadEve
      nt)
              at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.ja
      va:71)
              at org.richfaces.component.UIFileUpload.broadcast(UIFileUpload.java:160)
      
              at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:3
      16)
              at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java
      :289)
              at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:24
      8)
              at org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:
      404)
              at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestV
      aluesPhase.java:101)
              at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
              at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
      
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
      icationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
      ilterChain.java:206)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter
      .java:83)
              at org.jboss.seam.web.CharacterEncodingFilter.doFilter(CharacterEncoding
      Filter.java:42)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter




      It is complaining about the method UploadManagerAction.listener method which it apparently doesn't find.


      UploadManagerAction implements UploadManager which looks like this:



      public interface UploadManager {
      
           
           public int getMaxFilesQuantity();
           
           public void listener(org.richfaces.event.UploadEvent event);
           public List<Attachment> getAllAttachments();
      
           public void remove();
      }



      And in the view part I have:



      <ui:composition template="/modalTemplate.xhtml">
      
      
        <ui:define name="modalBody">
           <h:form>
                <s:validateAll>
                     <rich:fileUpload fileUploadListener="#{uploadManager.listener}"
                          maxFilesQuantity="#{uploadManager.maxFilesQuantity}" immediateUpload="true"/>
      
                     <ui:insert name="buttons">Insert Buttons here</ui:insert>
                </s:validateAll>
           </h:form>
        </ui:define>
      </ui:composition>




      I'm not sure whether this is actually an richfaces, jboss or something other error.


      Any comments appreciated.


      Thanks in advance


      P.S.: I'm using SEAM 2.0.1.GA and richfaces 3.2.0.GA


        • 1. Re: rich:fileUpload problem
          amayen

          So, it looks like the error was because some of the libraries where not in the correct places in the ear. Additionally I upgraded to the newest JSF (1.2_08) and Facelets (1.1.14) versions. Now the described problem is resolved. Anyway there are still other problems occuring. So this seems to be only a part of the solution.


          Greetings

          • 2. Re: rich:fileUpload problem
            piotrp

            Hi,


            Could give some advice on the incorrect places of the libraries in the ear? I've encountered the same problem...


            Regards

            • 3. Re: rich:fileUpload problem
              amayen

              Hi Piotr!


              I placed the richfaces-api in the toplevel lib folder of the ear.
              Richfaces-impl and richfaces-ui were placed in the Web-Inf/lib directory of the .war file along with the facelets library.


              In application.xml I added a
              <module>richfaces-api...</module>
              reference.



              The

              uploadData

              property must point to a property like the following:


              private List<org.richfaces.model.UploadItem> files = new LinkedList<org.richfaces.model.UploadItem>();