4 Replies Latest reply on Jun 4, 2015 7:42 PM by Annie Zheng

    Rich:upload is not working in seam project

    Annie Zheng Newbie

      Hi, We are using Richface 4.5.4 final with Seam framework,  The <rich:upload> is not working. I've tried everything.  After I click upload button, the seam debug page shows up and throws exception, please help !

       

      -  Exception

       

       

      Exception during request processing:

      Caused by javax.servlet.ServletException with message: ""

      javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)

      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)

      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

      org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:832)

      org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:620)

      org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:553)

      org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:482)

      org.jboss.seam.web.RewriteFilter.process(RewriteFilter.java:98)

      org.jboss.seam.web.RewriteFilter.doFilter(RewriteFilter.java:57)

      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)

      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)

      org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)

      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)

      org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:86)

      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.servlet.SeamFilter.doFilter(SeamFilter.java:158)

      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)

      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)

      org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:149)

      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)

      org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)

      org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)

      org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)

      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150)

      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)

      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)

      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)

      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854)

      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)

      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926)

      java.lang.Thread.run(Thread.java:745)


      Caused by java.lang.NullPointerException with message: ""

      org.richfaces.renderkit.FileUploadRendererBase.doDecode(FileUploadRendererBase.java:142)

      org.richfaces.renderkit.RendererBase.decode(RendererBase.java:81)

      javax.faces.component.UIComponentBase.decode(UIComponentBase.java:789)

      javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1183)

      com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:534)

      org.richfaces.context.MetaComponentProcessingVisitCallback.visit(MetaComponentProcessingVisitCallback.java:73)

      org.richfaces.context.BaseExtendedVisitContext.invokeVisitCallback(BaseExtendedVisitContext.java:103)

      org.richfaces.context.ExtendedExecuteVisitContext.invokeVisitCallback(ExtendedExecuteVisitContext.java:55)

      javax.faces.component.UIComponent.visitTree(UIComponent.java:1652)

      javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)

      javax.faces.component.UIForm.visitTree(UIForm.java:371)

      javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)

      javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)

      javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)

      javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)

      com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:383)

      com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:257)

      org.richfaces.context.ExtendedPartialViewContext.processPartial(ExtendedPartialViewContext.java:263)

      javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:923)

      com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)

      com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

      com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)

      javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)

      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)

      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

      org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:832)

      org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:620)

      org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:553)

      org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:482)

      org.jboss.seam.web.RewriteFilter.process(RewriteFilter.java:98)

      org.jboss.seam.web.RewriteFilter.doFilter(RewriteFilter.java:57)

      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)

      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)

      org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)

      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)

      org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:86)

      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.servlet.SeamFilter.doFilter(SeamFilter.java:158)

      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)

      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)

      org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:149)

      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)

      org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)

      org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)

      org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)

      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150)

      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)

      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)

      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)

      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854)

      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)

      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926)

      java.lang.Thread.run(Thread.java:745)

       

      Here is my xhtml code:

       

      <a4j:outputPanel id="importModalPanel">

        <h:form id="importModalForm" styleClass="body">

       

        <rich:fileUpload id="fileNm" fileUploadListener="#{importAction.initializeUploadItem}" execute="@this"

      acceptedTypes="xls" addControlLabel="Choose File(.xls only)" noDuplicate="true"

      ontyperejected="displayAlertMessage('We were unable to process the selected file.  Please ensure the file type is .xls (we cannot currently handle .xlsx) and that there are no spaces before the file extension.');"

      uploadControlLabel="Import File"  listHeight="100px"

      onuploadcanceled="#{rich:component('importModal')}.hide();" >

      <a4j:ajax event="uploadcomplete"

      action="#{importAction.initializeImport}" oncomplete="onFileUploadComplete('#{dealHeaderRequest.dealId}');" execute="@none" limitRender="true" />

      </rich:fileUpload>

        </h:form>

      </a4j:outputPanel>

       

       

      </a4j:outputPanel>

       

       

       

       

      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" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">

       

        <display-name>Revenue Pipeline Management</display-name>

        <!-- JSF -->

        

          <context-param>

              <param-name>javax.faces.DEFAULT_SUFFIX</param-name>

              <param-value>.xhtml</param-value>

          </context-param>

       

       

          <context-param>

            <param-name>org.richfaces.enableControlSkinning</param-name>

            <param-value>false</param-value>

          </context-param>

          

          <servlet>

              <servlet-name>Faces Servlet</servlet-name>

              <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

              <load-on-startup>1</load-on-startup>

          </servlet>

            

          <servlet-mapping>

              <servlet-name>Faces Servlet</servlet-name>

              <url-pattern>*.seam</url-pattern>

          </servlet-mapping>

       

        <context-param>

        <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>

        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>

        <param-value>server</param-value>

        </context-param>

        

          <!-- Load all richfaces js library -->

        

          <context-param>

              <param-name>org.richfaces.LoadScriptStrategy</param-name>

              <param-value>ALL</param-value>

          </context-param>

          <context-param>

              <param-name>org.richfaces.LoadStyleStrategy</param-name>

              <param-value>ALL</param-value>

          </context-param>

          <context-param>

              <param-name>org.richfaces.resourceOptimization.enabled</param-name>

              <param-value>true</param-value>

          </context-param>

       

       

          <servlet>

              <servlet-name>Resource Servlet</servlet-name>

              <servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>

              <load-on-startup>1</load-on-startup>

          </servlet>

          <servlet-mapping>

              <servlet-name>Resource Servlet</servlet-name>

              <url-pattern>/org.richfaces.resources/*</url-pattern>

          </servlet-mapping>

       

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

        

        

        

       

          <session-config>

              <session-timeout>10</session-timeout>

          </session-config>

        <welcome-file-list>

        <welcome-file>index.html</welcome-file>

        </welcome-file-list>

       

       

      </web-app>