3 Replies Latest reply on Apr 7, 2008 9:08 AM by andrei_exadel

    seam 2.1, richfaces 3.2.0 and fileUpload


      i'm using richfaces 3.2.0 and seam 2.1 and im facing problems on getting rich:fileUpload work. It seems the component can't find the listener method.

      this is what i get :

      |Caused by: javax.faces.el.MethodNotFoundException: /test.xhtml @17,112 fileUploadListener="#{uploadHandler.fil
      eUploadListener}": Method not found: mk.common.UploadHandler@1af0d15.fileUploadListener(org.richfaces.event.Up
       at ||com.sun.facelets.el.LegacyMeth||odBinding.invoke(LegacyMethodBinding.java:71)
       at org.richfaces.component.UIFileUpload.broadcast(UIFileUpload.java:160)
       at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:316)
       at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:289)
       at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:248)
       at org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:404)
       at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.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)
       ... 41 more|

      this is my component's code :

      import java.io.File;
      import java.io.IOException;
      import org.jboss.seam.annotations.Logger;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.log.Log;
      import org.richfaces.model.UploadItem;
      public class UploadHandler {
       Log log;
       public void fileUploadListener(org.richfaces.event.UploadEvent event) {
       log.debug("null upload event");
       UploadItem item = event.getUploadItem();
       String name = "unnamed_attachment";
       byte[] data = item.getData();
       if (item.isFile()) {
       name = item.getFileName();
       data = item.getData();
       File file = item.getFile();
       "uploaded "+name+
       " - length= "+( (data==null)?0:data.length) +
       " tmpFile="+file.getAbsoluteFile()

      and that's my page

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:rich="http://richfaces.org/rich" >
       <title>test fileupload</title>
       <rich:fileUpload id="upload" fileUploadListener="#{uploadHandler.fileUploadListener}" maxFilesQuantity="2">
       <f:facet name="label">
       <h:outputText value="{_KB}KB from {KB}KB uploaded --- {mm}:{ss}" />

      If i remove the event parameter from the listener methd it gets recognized and the page works, but i obviously have no access to anything.
      I think the seam's el handler is producing some bad effect.


        • 1. Re: seam 2.1, richfaces 3.2.0 and fileUpload


          It likes strangely.

          I think the problem is not in File Upload component.

          I can suggest that system has two UploadEvent in class loaders. May be you have twice added RF jars in your application or something else.

          Currently i see that file upload fires under seam 2.1 without problems.

          • 2. Re: seam 2.1, richfaces 3.2.0 and fileUpload

            rf jar were linked by application.xml and placed into war\web-inf\lib.
            i left just the ones in the root ear folder end everything worked fine.
            Thanks a lot.

            Why having more than one copy of the class in the classpath was breaking up


            • 3. Re: seam 2.1, richfaces 3.2.0 and fileUpload

              Because all classes inside class loader are unique in spite of they have the same names and they are in the same jars.

              I think in our case the problem is somewhere in event/listener way...

              For example listener was started using class from the first jar. But method was invoked with parameter of class from another jar.

              I'm not sure that I'm right in details :)

              But anyway there is a wrong thing to link the jar twice.