[richfaces-issues] [JBoss JIRA] Commented: (RF-6947) NullPointerException when uploading with rich:fileUpload

Jan Ziegler (JIRA) jira-events at lists.jboss.org
Tue Apr 28 05:49:57 EDT 2009


    [ https://jira.jboss.org/jira/browse/RF-6947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12464765#action_12464765 ] 

Jan Ziegler commented on RF-6947:
---------------------------------

Sorry I forgot to mention - yes I´m using tomahawk (tomahawk12-1.1.8). I also tried to remove the tomahawk filter from the web.xml but without success for rich:fileUpload. 
As an additional information: I´m having no problems with an older 3.3.1 Snapshot e.g. 20090219.


Here´s the web.xml content:

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">
  
    <!-- START: myfaces context parameter -->
    <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>

    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.xhtml</param-value>
    </context-param>

    <context-param>
        <description> enter all faces configurations for current framework
            applications
        </description>
        <param-name>javax.faces.CONFIG_FILES</param-name>
        <param-value> /WEB-INF/our-faces-config.xml </param-value>
    </context-param>

    <context-param>
        <description>feature that update the configuration when the refresh period has been reached since las update. </description>
        <param-name>org.apache.myfaces.CONFIG_REFRESH_PERIOD</param-name>
        <param-value>-1</param-value>
    </context-param>

    <context-param>
        <description> Validate managed beans, navigation rules and ensure that
            forms are not nested. </description>
        <param-name>org.apache.myfaces.VALIDATE</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <description> A very common problem in configuring
            MyFaces-web-applications is that the Extensions-Filter is not
            configured at all or improperly configured. This parameter will
            check for a properly configured Extensions-Filter if it is needed by
            the web-app. In most cases this check will work just fine, there
            might be cases where an internal forward will bypass the
            Extensions-Filter and the check will not work. If this is the case,
            you can disable the check by setting this parameter to false. 
        </description>
        <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>
        <description>Change the url-pattern from the ExtensionsFilter Default is "/faces/myFacesExtensionResource"
             Note: The filter-mapping for ExtensionsFilter, the url-pattern is this value + "/*", else there comes a exception</description>
        <param-name>org.apache.myfaces.RESOURCE_VIRTUAL_PATH</param-name>
        <param-value>/faces/myFacesExtensionResource</param-value>
    </context-param>

    <context-param>
        <param-name>org.apache.myfaces.ADD_RESOURCE_CLASS</param-name>
        <param-value>
            org.apache.myfaces.component.html.util.StreamingAddResource 
        </param-value>
    </context-param>

    <context-param>
        <description>show facelets like error pages - overwrites "facelets.DEVELOPMENT" </description>
        <param-name>org.apache.myfaces.ERROR_HANDLING</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <description> In some versions of MyFaces there is a context param
            "org.apache.myfaces.PRETTY_HTML" that can be specified in the
            web.xml to enable pretty output. However this option was never well
            supported as it requires support from every renderer in order to
            work. This feature may be removed from future versions of MyFaces. 
        </description>
        <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>
        <description> This parameter tells MyFaces if javascript code should be
            allowed in the rendered HTML output. If javascript is allowed,
            command_link anchors will have javascript code that submits the
            corresponding form. If javascript is not allowed, the state saving
            info and nested parameters will be added as url parameters. Default:
            "true" </description>
        <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>
        <description> The view state can now be rendered with javascript. If
            this feature is enabled (via context parameter
            "org.apache.myfaces.VIEWSTATE_JAVASCRIPT") the view state hidden
            inputs in the forms are rendered with empty value attributes. The
            actual viewstate is then filled in on the client with a rendered
            javascript function that simply iterates over all forms. 
        </description>
        <param-name>org.apache.myfaces.VIEWSTATE_JAVASCRIPT</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>
        <description>Do not render the "javax.jsf.ViewState" id attribute for view state hidden inputs. 
            Necessary for valid XHTML on multiple forms on onepage.</description>
        <param-name>org.apache.myfaces.RENDER_VIEWSTATE_ID</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <description>javascript on button is configurable </description>
        <param-name>org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>
        <description>IE7 - AutoComplete Does Not Work When You Use Script to Submit a Form</description>
        <param-name>org.apache.myfaces.SAVE_FORM_SUBMIT_LINK_IE</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>
        <description> If true, a javascript function will be rendered that is
            able to restore the former vertical scroll on every request.
            Convenient feature if you have pages with long lists and you do not
            want the browser page to always jump to the top if you trigger a
            link or button action that stays on the same page. Default: "false" 
        </description>
        <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <param-name>org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <param-name>org.apache.myfaces.STRICT_XHTML_LINKS</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <description>see bug https://issues.apache.org/jira/browse/MYFACES-1786
            ...if the web container is restarted, a new secret is generated..causing javax.crypto.BadPaddingException
            when JSF tries to restore state
        </description>
        <param-name>org.apache.myfaces.USE_ENCRYPTION</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>
        <description> Only applicable if state saving method is "server" (=
            default). If true (default) the state will be serialized to a byte
            stream before it is written to the session. If false the state will
            not be serialized to a byte stream.  </description>
        <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <description> Only applicable if state saving method is "server" (=
            default) and if org.apache.myfaces.SERIALIZE_STATE_IN_SESSION is
            true (= default). If true (default) the serialized state will be
            compressed before it is written to the session. If false the state
            will not be compressed.  </description>
        <param-name>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <description> Only applicable if state saving method is "server" (=
            default). Defines the amount (default = 20) of the latest views are
            stored in session. (NOT WORKING IN RICHFACES -> SUN RI PARAMETER)</description>
        <param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
        <param-value>2</param-value>
    </context-param>

    <context-param>
        <description> org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION 
            (NOT WORKING IN RICHFACES -> SUN RI PARAMETER)</description>
        <param-name>com.sun.faces.numberOfViewsInSession</param-name>
        <param-value>2</param-value>
    </context-param>

    <context-param>
        <description> org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION 
            (NOT WORKING IN RICHFACES -> SUN RI PARAMETER)</description>
        <param-name>com.sun.faces.numberOfLogicalViews</param-name>
        <param-value>2</param-value>
    </context-param>

    <context-param>
        <description> Use this context parameter to enable compression in
            MyFaces version 1.1.4 and later.  </description>
        <param-name>org.apache.myfaces.COMPRESS_STATE_IN_CLIENT</param-name>
        <param-value>true</param-value>
    </context-param>
    <!-- END: myfaces context parameter -->

    <!-- START: facelets context parameter -->
    <context-param>
        <description> Use Documents Saved as *.xhtml for view pages </description>
        <param-name>facelets.VIEW_MAPPINGS</param-name>
        <param-value>*.xhtml</param-value>
    </context-param>

    <context-param>
        <description>Template Cache</description>
        <param-name>facelets.REFRESH_PERIOD</param-name>
        <param-value>0</param-value>
    </context-param>

    <context-param>
        <param-name>facelets.SKIP_COMMENTS</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <param-name>facelets.BUILD_BEFORE_RESTORE</param-name>
        <param-value>false</param-value>
    </context-param>
    <!-- END: facelets context parameter -->

    <!-- START: richfaces context parameter -->
    <context-param>
        <description> the richfaces skin (blueSky), instead of "plain" use
            LoadStyleStrategy=NONE to disable loading of skin css </description>
        <param-name>org.richfaces.SKIN</param-name>
        <param-value>blueSky</param-value>
    </context-param>

    <context-param>
        <description> ALL = load all richfaces js as one resource (many
            components on site), DEFAULT = load single resources on demand (less
            components on site) </description>
        <param-name>org.richfaces.LoadScriptStrategy</param-name>
        <param-value>DEFAULT</param-value>
    </context-param>

    <context-param>
        <description> use js compression algorithm (must not be used when
            LoadScriptStrategy is ALL)  </description>
        <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <description> ALL = load all richfaces css as one resource (many
            components on site), DEFAULT = load single resources on demand (less
            components on site), NONE = load no styles </description>
        <param-name>org.richfaces.LoadStyleStrategy</param-name>
        <param-value>DEFAULT</param-value>
    </context-param>

    <context-param>
        <description> use css compression algorithm (must not be used when
            LoadStyleStrategy is ALL) </description>
        <param-name>org.ajax4jsf.COMPRESS_STYLE</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
        <param-value> jsf.application.OurViewHandler 
        </param-value>
    </context-param>
    <!-- END: richfaces context parameter -->

    <!--
		**************
		SERVLET-FILTER
		**************
	-->

    <!-- richfaces filter (must be first) -->
    <filter>
        <display-name>RichFaces Filter</display-name>
        <filter-name>richfaces</filter-name>
        <filter-class>org.ajax4jsf.Filter</filter-class>
        <init-param>
            <description> Enable caching of frameworkgenerated resources
                (JavaScript, CSS, images, etc.).  </description>
            <param-name>enable-cache</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <description> Force parsing by a filter HTML syntax checker on any
                JSF page.  </description>
            <param-name>forceparser</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <description>max bytes for fileupload</description>
            <param-name>maxRequestSize</param-name>
            <param-value>10000000</param-value>
        </init-param>
    </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>

    <!-- tomahawk extension filter -->
    <filter>
        <filter-name>MyFacesExtensionsFilter</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>maxFileSize</param-name>
            <param-value>10m</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
    </filter-mapping>
		
	...own stuff (own servlet filter which does some framework initialization that should not be a problem here)...
	
    <!--
		********
		SERVLETS
		********
	-->

    <!-- JSF servlet -->
    <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>*.xhtml</url-pattern>
    </servlet-mapping>
	...

</web-app>


> NullPointerException when uploading with rich:fileUpload
> --------------------------------------------------------
>
>                 Key: RF-6947
>                 URL: https://jira.jboss.org/jira/browse/RF-6947
>             Project: RichFaces
>          Issue Type: Bug
>    Affects Versions: 3.3.1
>         Environment: tomcat 6.0.18
> facelets 1.1.14
> myfaces 1.2.6
>            Reporter: Jan Ziegler
>
> When using rich:fileUpload in the current 3.3.1 Snapshot (20090427) a nullpinter occurs when performing the upload:
> javax.faces.FacesException: Exception while decoding component : {Component-Path : [Class: org.ajax4jsf.component.AjaxViewRoot,ViewId: /examples/fileUpload/index.xhtml][Class: org.richfaces.component.html.HtmlTabPanel,Id: j_id71][Class: org.richfaces.component.html.HtmlTab,Id: j_id72][Class: javax.faces.component.html.HtmlForm,Id: j_id74][Class: org.richfaces.component.html.HtmlFileUpload,Id: j_id75]}
> 	at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:583)
> 	at javax.faces.component.UIInput.decode(UIInput.java:231)
> 	at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:709)
> 	at javax.faces.component.UIInput.processDecodes(UIInput.java:149)
> 	at javax.faces.component.UIForm.processDecodes(UIForm.java:65)
> 	at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:705)
> 	at org.richfaces.component.UISwitchablePanel.processDecodes(UISwitchablePanel.java:170)
> 	at org.richfaces.component.UITabPanel.processDecodes(UITabPanel.java:155)
> 	at org.ajax4jsf.component.AjaxViewRoot$1.invokeContextCallback(AjaxViewRoot.java:392)
> 	at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:238)
> 	at org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:409)
> 	at org.apache.myfaces.lifecycle.ApplyRequestValuesExecutor.execute(ApplyRequestValuesExecutor.java:32)
> 	at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
> 	at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
> 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:151)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at de.solseit.framework.base.lifecyle.FrameworkFilter.doFilter(FrameworkFilter.java:265)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:344)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
> 	at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
> 	at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:347)
> 	at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
> 	at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
> 	at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
> 	at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
> 	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
> 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
> 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
> 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
> 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> 	at java.lang.Thread.run(Thread.java:619)
> Caused by: java.lang.NullPointerException
> 	at org.richfaces.renderkit.FileUploadRendererBase.doDecode(FileUploadRendererBase.java:140)
> 	at org.ajax4jsf.renderkit.RendererBase.decode(RendererBase.java:75)
> 	at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:579)
> 	... 45 more
> the component is used in this very simple way (no listener-binding, for simplicity):
> 		<rich:fileUpload
> 				maxFilesQuantity="3"
> 				immediateUpload="false"
> 				acceptedTypes="jpg" />

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       




More information about the richfaces-issues mailing list