4 Replies Latest reply on Aug 14, 2007 5:15 PM by James Hays

    s:fileUpload when used along with h:selectOneMenu

    James Hays Novice

      I'm hoping somebody can shed some light on this issue. I've had a frustrating battle with this off and on for a few days now. The issue, it appears, is intermittent. It works sometimes, and others it blows up.

      I have a form that has an <h:selectOneMenu and an <s:fileUpload. If I only makes changes to one or the other element, the submit works fine. If I choose an item from the menu AND choose a file, I will sometimes get this stack dump.


      14:23:47,922 ERROR [STDERR] Jun 1, 2007 2:23:47 PM com.sun.facelets.FaceletViewHandler handleRenderException
      SEVERE: Error Rendering View[/productManagement.xhtml]
      javax.faces.el.EvaluationException: /productManagement.xhtml @140,100 value="#{productManagement.productStatuses}": Exception getting value of property productStatuses of base of type : org.javassist.tmp.java.lang.Object_$$_javassist_1305
      at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:60)
      at javax.faces.component.UISelectItems.getValue(UISelectItems.java:55)
      at org.jboss.seam.ui.UISelectItems.getValue(UISelectItems.java:166)
      at org.apache.myfaces.shared_impl.util.SelectItemsIterator.hasNext(SelectItemsIterator.java:102)
      at org.apache.myfaces.shared_impl.renderkit.RendererUtils.internalGetSelectItemList(RendererUtils.java:477)
      at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getSelectItemList(RendererUtils.java:453)
      at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.internalRenderSelect(HtmlRendererUtils.java:278)
      at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.renderMenu(HtmlRendererUtils.java:252)
      at org.apache.myfaces.shared_impl.renderkit.html.HtmlMenuRendererBase.encodeEnd(HtmlMenuRendererBase.java:54)
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
      at org.ajax4jsf.framework.renderer.RendererBase.renderChild(RendererBase.java:286)
      at org.ajax4jsf.framework.renderer.RendererBase.renderChildren(RendererBase.java:262)
      at org.ajax4jsf.framework.renderer.RendererBase.renderChild(RendererBase.java:284)
      at org.ajax4jsf.framework.renderer.RendererBase.renderChildren(RendererBase.java:262)
      at org.richfaces.renderkit.TabRendererBase.encodeChildren(TabRendererBase.java:113)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:524)
      at org.ajax4jsf.framework.renderer.RendererBase.renderChild(RendererBase.java:282)
      at org.ajax4jsf.framework.renderer.RendererBase.renderChildren(RendererBase.java:262)
      at org.richfaces.renderkit.html.TabPanelRenderer.doEncodeChildren(TabPanelRenderer.java:272)
      at org.richfaces.renderkit.html.TabPanelRenderer.doEncodeChildren(TabPanelRenderer.java:267)
      at org.ajax4jsf.framework.renderer.RendererBase.encodeChildren(RendererBase.java:121)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:524)
      at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:244)
      at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
      at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
      at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
      at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:233)
      at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
      at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
      at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
      at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
      at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:74)
      at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.faces.el.EvaluationException: Bean: org.javassist.tmp.java.lang.Object_$$_javassist_1305, property: productStatuses
      at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:442)
      at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:82)
      at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:141)
      at com.sun.el.parser.AstValue.getValue(AstValue.java:117)
      at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
      at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
      at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
      ... 66 more
      Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:438)
      ... 72 more
      Caused by: javax.ejb.EJBException: org.jboss.seam.RequiredException: @Out attribute requires non-null value: productManagement.productRecord
      at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
      at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
      at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
      at org.jboss.aop.j
      14:23:47,938 ERROR [STDERR] oinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
      at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)
      at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
      at $Proxy842.getProductStatuses(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
      at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
      at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:72)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
      at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
      at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
      at org.javassist.tmp.java.lang.Object_$$_javassist_1305.getProductStatuses(Object_$$_javassist_1305.java)
      ... 77 more
      Caused by: org.jboss.seam.RequiredException: @Out attribute requires non-null value: productManagement.productRecord
      at org.jboss.seam.Component.outjectAttribute(Component.java:1396)
      at org.jboss.seam.Component.outjectAttributes(Component.java:1387)
      at org.jboss.seam.Component.outject(Component.java:1246)
      at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:48)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
      at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:37)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
      at org.jboss.seam.interceptors.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:63)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
      at org.jboss.seam.interceptors.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:51)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
      at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
      at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
      at sun.reflect.GeneratedMethodAccessor2732.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
      at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:71)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:46)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
      ... 106 more


      Sometimes it works though... Same process to getting to the form. The stack tells me that productRecord is null and can't be outjected. The question is why is it null? It shouldn't be.

      Here is the relevant html:
      <h:form enctype="multipart/form-data">
       <table cellpadding="0" cellspacing="2" border="0" style="font-size: 13px">
       <tr>
       <td colspan="2">
       <label>Product Status:</label>
       <h:selectOneMenu id="productStatus" value="#{productRecord.productStatus}">
       <s:selectItems value="#{productManagement.productStatuses}"
       var="productStatus"
       label="#{productStatus.name}" noSelectionLabel="-- None --"/>
       <ec:convertEntity/>
       </h:selectOneMenu>
       </td>
       </tr>
       <tr>
       <td colspan="2"> </td>
       </tr>
       <tr>
       <td colspan="4">
       <rich:togglePanel value="#{productManagement.editMode}" switchType="client"
       id="editToggle" stateOrder="fileMode,locationMode">
       <f:facet name="fileMode">
       <h:panelGroup>
       <table>
       <tr>
       <td style="font-size: 12px" colspan="4">
       <span style="padding-right: 4px"><label>Switch Edit
       Mode:</label></span>
       <rich:toggleControl for="editToggle"
       value="Enter File Location"/>
       <br/><br/>
       </td>
       </tr>
       <tr>
       <td>
       <label for="fileChooser">Choose Your File:</label>
       </td>
       <td colspan="3">
       <s:fileUpload id="file"
       data="#{productManagement.fileData}"
       contentType="#{productManagement.fileContentType}"
       fileName="#{productManagement.fileName}"/>
       </td>
       </tr>
       <tr>
       <td colspan="4">
       <h5>Use the Browse button to upload your document to
       LCGM.</h5>
       </td>
       </tr>
       </table>
       </h:panelGroup>
       </f:facet>
       <f:facet name="locationMode">
       <h:panelGroup>
       <table>
       <tr>
       <td colspan="4" style="font-size: 12px">
       <span style="padding-right: 4px"><label>Switch Edit
       Mode:</label></span>
       <rich:toggleControl for="editToggle"
       value="Upload File to LCGM"/>
       <br/><br/>
       </td>
       </tr>
       <tr>
       <td>
       <label for="fileLocation">Enter File Location:</label>
       </td>
       <td align="left" colspan="3">
       <h:inputText id="fileLocation"
       value="#{productRecord.documentLocation}"
       size="50"/>
       </td>
       </tr>
       <tr>
       <td colspan="4">
       <h5>
       Copy & paste URL or type in the location of the
       document.<br/>
       Note - other users may or may not have access to
       documents on other servers.
       </h5>
       </td>
       </tr>
       </table>
       </h:panelGroup>
       </f:facet>
       </rich:togglePanel>
       </td>
       </tr>
      
       <tr>
       <td colspan="2"> </td>
       </tr>
       <tr>
       <td colspan="2">
       <h:commandButton styleClass="controller"
       action="#{productManagement.saveProductRecord}"
       value="Save Changes"/>
       </td>
       </tr>
       </table>
      </h:form>
      


      The page starts with the call of this action:
      (this is in a SFSB running inside a conversation)
       @Out @In(required = false)
       private ProductRecord productRecord;
      
       @Begin(join = true)
       public void manageProductRecord(ProductRecord productRecord)
       {
       this.productRecord = productRecord;
       }
      


      So, to recap. My page will open fine with the appropriate object. When I click on the "Save Changes" button, is when I get this error. Sometimes...

      Any thoughts or suggestions would be greatly appreciated.

      Thanks,

      James