13 Replies Latest reply on Oct 14, 2013 3:40 AM by zpxocivuby

    FileUpload doDecode Exception

    firestorm696

      hi there!

       

      i got the following problem everytime i try to upload a file using the rich:fileupload:

       

      Caused by: java.lang.NullPointerException
              at org.richfaces.renderkit.FileUploadRendererBase.doDecode(FileUploadRen
      dererBase.java:139)
              at org.ajax4jsf.renderkit.RendererBase.decode(RendererBase.java:75)
              at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:579
      )
              ... 68 more
      

       

      i found a few things on google about it, but none of the solutions worked. filters are in correct order, web.xml includes the maxrequestsize and createtempfile-definitions but nothing helped.

       

      i'm using richfaces 3.3.3 final and myfaces on jboss

       

      thanks in advance

        • 1. Re: FileUpload doDecode Exception
          yyq2009

          Hi,

            Maybe you should show more, page code or config lines.

          • 2. Re: FileUpload doDecode Exception
            firestorm696

            the code i used is completely identical with the one on http://livedemo.exadel.com/richfaces-demo/richfaces/fileUpload.jsf, i didn't change anything

             

            my web.xml is about 600 lines long now, don't know if it's worth posting

            at least i could post filters and -mapping:

             

            <filter> 
                    <display-name>RichFaces Filter</display-name> 
                    <filter-name>richfaces</filter-name> 
                    <filter-class>org.ajax4jsf.Filter</filter-class> 
                    
                 <init-param>  
                    <param-name>createTempFiles</param-name>  
                    <param-value>false</param-value>  
                 </init-param>  
                 <init-param>  
                    <param-name>maxRequestSize</param-name>  
                    <param-value>10485760</param-value>  
                 </init-param>
                </filter> 
             
            #if ($securityEnabled)
                <filter>
                    <filter-name>User Role Filter</filter-name>
                    <filter-class>${managedBeansPackage}.UserRoleFilter</filter-class>
                </filter>
            #end
            
                <!-- Filter to detect new logins and forward to Initialization -->
                <!-- LOGIN_FILTER_REMOVED -->
               <filter>
                    <filter-name>NewLoginFilter</filter-name>
                    <filter-class>at.jr.iis.imdas.filter.NewLoginFilter</filter-class>
                    <init-param>
                      <param-name>pathSpec</param-name>
                      <param-value>exclude</param-value>
                    </init-param>
                    <init-param>
                      <param-name>pathList</param-name>
                      <param-value>*/formValidation*,*.jpg,*.gif,*.css,*.js</param-value>
                    </init-param>
                    <init-param>
                        <param-name>redirectOnJSecurityCheck</param-name>
                        <param-value>/index.jsp</param-value>
                    </init-param>
                    <init-param>
                        <param-name>redirectOnLogin</param-name>
                        <param-value>/at/jr/iis/imdas/web/system/userwelcome/user-welcomeuc.jsf</param-value>
                    </init-param>
                    <init-param>
                        <param-name>loginActionUrl</param-name>
                        <param-value>/at/jr/iis/imdas/web/system/login/login.jsf</param-value>
                    </init-param>
                </filter>
            <!-- -->
            
                <!-- ADF Faces Filter -->
                <filter>
                    <filter-name>ADF Faces Filter</filter-name>
                    <filter-class>oracle.adf.view.faces.webapp.AdfFacesFilter</filter-class>
                </filter>
            
            
                <!-- Extensions Filter -->
                <filter>
                    <filter-name>MyFaces Extensions Filter</filter-name>
            #if ($outputLibraries)
                    <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
            #else
                    <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
            #end
                    <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>
                    <!--
                    <init-param>
                        <param-name>uploadRepositoryPath</param-name>
                        <param-value>c:\temp</param-value>
                        <description>Set the path where the intermediary files will be stored.</description>
                    </init-param>
                    -->
                </filter>
            #foreach ($useCase in $useCases)
            #foreach ($view in $useCase.views)
            #if ($view.populatorRequired)
                <filter>
                    <filter-name>$view.fullyQualifiedPopulator</filter-name>
                    <filter-class>$view.fullyQualifiedPopulator</filter-class>
                </filter>
            #end
            #end
            #end
            
                <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-mapping merge-point -->
                <filter-mapping>
                    <filter-name>ADF Faces Filter</filter-name>
                    <url-pattern>*.${facesServletExtension}</url-pattern>
                </filter-mapping>
                <filter-mapping>
                    <filter-name>MyFaces Extensions Filter</filter-name>
                    <url-pattern>*.${facesServletExtension}</url-pattern>
                </filter-mapping>
                <filter-mapping>
                    <filter-name>MyFaces Extensions Filter</filter-name>
                    <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
                </filter-mapping>
            
            • 3. Re: FileUpload doDecode Exception
              yyq2009

              Hi,

                Remove ADF Faces Filter and have a try.

              • 4. Re: FileUpload doDecode Exception
                firestorm696

                nope, didn't make a difference.

                • 5. Re: FileUpload doDecode Exception
                  ilya_shaikovsky

                  RF filter should be first in chain. And according to spec - filters which mappings uses url mapping - registered first even if defined below the filter which mapping uses servlet name. So all the filters which you defined - came before RF one.

                  • 6. Re: FileUpload doDecode Exception
                    firestorm696

                    okay understood. but what could i possibly do? i think those urlmappings have to be there (not all of the code is written by me), so i need some workaround or something... is there a way to make this work?

                    • 7. Re: FileUpload doDecode Exception
                      ilya_shaikovsky
                      • 8. Re: FileUpload doDecode Exception
                        firestorm696

                        thanks for trying to help me, but i really can't see many differences. i tried to handle the request like the example's javafile, changed the order of my web.xml-content and such things, i don't get it.

                         

                        the error starts with

                         

                        ERROR [BaseXMLFilter] Exception in the filter chain
                        javax.servlet.ServletException: javax.faces.FacesException: Exception while decoding 
                        component : {Component-Path : [Class: org.ajax4jsf.component.AjaxViewRoot
                        
                        • 9. Re: FileUpload doDecode Exception
                          lukasz.wiktor

                          I have the same problem and it's not the matter of wrong myfaces filter order - I even don't use myfaces. The stack trace looks like this:

                          java.lang.NullPointerException
                                  at org.richfaces.renderkit.FileUploadRendererBase.doDecode(FileUploadRendererBase.java:139)
                                  at org.ajax4jsf.renderkit.RendererBase.decode(RendererBase.java:75)
                                  at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:789)
                                  ...
                          

                          It occurs only in IE9. It works when I switch to IE8 mode in developer tools (F12), but adding:

                          <meta content="IE=8" http-equiv="X-UA-Compatible" />

                          like suggested on a french developers forum doesn't help.

                           

                          I use RichFaces 3.3.3.Final.

                           

                          I will appreciate any reply

                          • 10. Re: FileUpload doDecode Exception
                            benjamin.maisano

                            This is also causing me problem

                            Jboss 5.0.1

                            RichFaces 3.3.3.Final

                            Only seems to be on IE 9

                             

                            Adding the IE header did fix it, but looking for a better solution.  THis previously worked, so something else we did started causing this, and we did not adjust anything in web.xml.


                            if($ofjq.browser.msie){
                              
                            if(parseInt($ofjq.browser.version,10) > 8) {
                              

                            if(window.location.href.indexOf('docupload.seam') > -1 ){
                              


                            $ofjq('head').append('<meta content="IE=8" http-equiv="X-UA-Compatible" />');
                              

                            }
                              
                            }

                                }

                            • 11. Re: FileUpload doDecode Exception

                              Hi,

                               

                              We seam to have the same problem in our applications. Is there a solution already without putting all IE browsers in IE8 mode? Maybe a quick(and dirty) fix? You don't want that in terms of performance of javascript...

                              • 12. Re: FileUpload doDecode Exception
                                ruben0626

                                Try adding the encType to the form:

                                 

                                <a4j:form ignoreDupResponses="true" enctype="multipart/form-data" >

                                • 13. Re: FileUpload doDecode Exception
                                  zpxocivuby

                                  The problem is in MyFaces Extensions Filter can't be used simultaneously with RichFace Filter

                                  Myfaces filter will overwrite the Richface  multiDataForm data