[ http://issues.apache.org/jira/browse/MYFACES-855?page=all ]

Martin Marinschek updated MYFACES-855:
--------------------------------------

    Status: Open  (was: Patch Available)

> FacesException: Cannot get value for expression '...' when expression is valid
> ------------------------------------------------------------------------------
>
>                 Key: MYFACES-855
>                 URL: http://issues.apache.org/jira/browse/MYFACES-855
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 1.1.0
>         Environment: IBM WebSphere 5.1.1.3, Windows Server 2003, JDK 1.4.2, 
> Hibernate 3.0
>            Reporter: Brett Sabell
>
> I have a dataTable whose value is a List property ( ruleInstanceList ) in a 
> backing bean ( listRuleInstancesBean ). The List is populated by Hibernate 
> 3.0, and is accessible via its own public getter/setter methods in the bean ( 
> getRuleInstanceList() and setRuleInstanceList() ). However, when I attempt to 
> display the page I receive the following message ( instead of the dataTable ):
> Error 500: Cannot get value for expression '#{ruleInstanceRow.ruleInstanceId}'
> "ruleInstanceRow" is the var set up for the dataTable, and is of type 
> RuleInstance ( a class I wrote ). This class contains a property called 
> "ruleInstanceId", which has public getter/setter methods. Other columns are 
> included in the dataTable and are mapped to other properties in 
> ruleInstanceRow, but ruleInstanceId is the first; I removed it, tried again, 
> and received the same error for the next column.
> In the systemOut.log file for WebSphere, the following exception stack trace 
> was dumped:
> [22/11/05 10:51:49:844 EST] 3a5327e8 WebGroup      E SRVE0026E: [Servlet 
> Error]-[Cannot get value for expression 
> '#{ruleInstanceRow.ruleInstanceId}']: javax.faces.FacesException: 
> Cannot get value for expression '#{ruleInstanceRow.ruleInstanceId}'
>       at 
> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
>       at 
> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
>       at 
> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300)
>       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
>       at 
> com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
>       at 
> com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
>       at 
> com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
>       at 
> com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
>       at 
> com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
>       at 
> com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
>       at 
> com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
>       at 
> com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:76)
>       at com.thenational.filter.RoleFilter.doFilter(RoleFilter.java:107)
>       at 
> com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
>       at 
> com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
>       at jcifs.http.NtlmHttpFilter.doFilter(NtlmHttpFilter.java:118)
>       at 
> com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
>       at 
> com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
>       at 
> com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1040)
>       at 
> com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:600)
>       at 
> com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:201)
>       at 
> com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
>       at 
> com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:286)
>       at 
> com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
>       at 
> com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
>       at 
> com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
>       at 
> com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
>       at 
> com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:624)
>       at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:458)
>       at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:912)
> Caused by: javax.servlet.ServletException: Cannot get value for expression 
> '#{ruleInstanceRow.ruleInstanceId}'
>       at 
> com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:416)
>       at 
> com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:683)
>       at 
> com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:781)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>       at 
> com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
>       at 
> com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
>       at 
> com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
>       at 
> com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
>       at 
> com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
>       at 
> com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
>       at 
> com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
>       at 
> com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1044)
>       at 
> com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:600)
>       at 
> com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:201)
>       at 
> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
>       ... 29 more
> The backing bean is configured in my faces-config.xml file, with the correct 
> package/class. I put in some debugging statements in my getRuleInstanceList() 
> method, and determined that a valid non-null List is correctly being returned 
> by Hibernate, and it contains one element of type RuleInstance, which has all 
> of the properties that are referenced in the dataTable columns. Therefore, I 
> cannot see why MyFaces can't get the values!
> Here are the relevant snippets of code:
> faces-config.xml
> =============
> <managed-bean>
>       <managed-bean-name>listRuleInstancesBean</managed-bean-name>
>       
> <managed-bean-class>com.thenational.otkr.dmi.beans.ListRuleInstancesBean</managed-bean-class>
>       <managed-bean-scope>request</managed-bean-scope>
> </managed-bean>
> ListRuleInstancesBean.java
> ======================
> public class ListRuleInstancesBean extends BaseBean
> {
>       protected UIData ruleInstanceTable;
>       private List ruleInstanceList;
>       private static final Logger logger = 
> Logger.getLogger(ListRuleInstancesBean.class);
>       
>       public List getRuleInstanceList()
>       {
>               if (ruleInstanceList == null)
>               {
>                       ruleInstanceList = new ArrayList(0);
>                       
>                       try
>                       {
>                               ruleInstanceList = 
> getDao().getAllRuleInstances(); // getDao() returns a Hibernate3 DAO object
>                       }
>                       catch (Exception e)
>                       {
>                               // Log error
>                               logger.error("Exception in 
> getRuleInstanceList(): " + e.toString());
>                       }
>               }
>               
>               return ruleInstanceList;
>       }
>       
>       public void setRuleInstanceList(List ruleInstanceList)
>       {
>               this.ruleInstanceList = ruleInstanceList;
>       }
>       public UIData getRuleInstanceTable()
>       {
>               return ruleInstanceTable;
>       }
>       public void setRuleInstanceTable(UIData ruleInstanceTable)
>       {
>               this.ruleInstanceTable = ruleInstanceTable;
>       }
> }
> RuleInstance.java
> ==============
> public class RuleInstance extends ModelBase implements Comparable
> {
>     private Long ruleInstanceId;
>     private Long ruleId;
>     private String ruleInstanceGroup;
>     private Long schemaInstanceId;
>     private Long deskId;
>     private Long sourceSystemId;
>     private Integer severity;
>     private boolean activeFlag = false;
>     public Long getRuleInstanceId() {
>         return ruleInstanceId;
>     }
>     public void setRuleInstanceId(Long ruleInstanceId) {
>         this.ruleInstanceId = ruleInstanceId;
>     }
>     public Long getRuleId() {
>         return ruleId;
>     }
>     public void setRuleId(Long ruleId) {
>         this.ruleId = ruleId;
>     }
>     public String getRuleInstanceGroup() {
>         return ruleInstanceGroup;
>     }
>     public void setRuleInstanceGroup(String ruleInstanceGroup) {
>         this.ruleInstanceGroup = ruleInstanceGroup;
>     }
>     public Long getSchemaInstanceId() {
>         return schemaInstanceId;
>     }
>     public void setSchemaInstanceId(Long schemaInstanceId) {
>         this.schemaInstanceId = schemaInstanceId;
>     }
>     public Long getDeskId() {
>         return deskId;
>     }
>     public void setDeskId(Long deskId) {
>         this.deskId = deskId;
>     }
>     public Long getSourceSystemId() {
>         return sourceSystemId;
>     }
>     public void setSourceSystemId(Long sourceSystemId) {
>         this.sourceSystemId = sourceSystemId;
>     }
>     public Integer getSeverity() {
>         return severity;
>     }
>     public void setSeverity(Integer severity) {
>         this.severity = severity;
>     }
>     public boolean isActiveFlag() {
>         return activeFlag;
>     }
>     
>     public boolean getActiveFlag() {
>         return activeFlag;
>     }
>     public void setActiveFlag(boolean activeFlag) {
>         this.activeFlag = activeFlag;
>     }
> }
> listRuleInstances.jsp
> =================
> <h:dataTable id="listRuleInstancesTable"
>       value="#{listRuleInstancesBean.ruleInstanceList}"
>       binding="#{listRuleInstancesBean.ruleInstanceTable}"
>       var="ruleInstanceRow"
>       headerClass="DashPartTitle"
>       rowClasses="DashPartBody"
>       cellspacing="0"
>       cellpadding="2"
>       frame="border"
>       rules="all">
>       <h:column>
>               <f:facet name="header">
>                       <h:outputText value="Rule Instance Id"/>
>               </f:facet>
>               <h:outputText value="#{ruleInstanceRow.ruleInstanceId}"/>
>       </h:column>
>       <h:column>
>               <f:facet name="header">
>                       <h:outputText value="Rule Instance Group"/>
>               </f:facet>
>               <h:outputText value="#{ruleInstanceRow.ruleInstanceGroup}"/>
>       </h:column>
>       <h:column>
>               <f:facet name="header">
>                       <h:outputText value="Severity"/>
>               </f:facet>
>               <h:outputText
>                       value="ERROR"
>                       rendered="#{ruleInstanceRow.severity == '0'}"/>
>               <h:outputText
>                       value="WARN"
>                       rendered="#{ruleInstanceRow.severity == '1'}"/>
>               <h:outputText
>                       value="INFO"
>                       rendered="#{ruleInstanceRow.severity == '2'}"/>
>       </h:column>
>       <h:column>
>               <f:facet name="header">
>                       <h:outputText value="Active"/>
>               </f:facet>
>               <h:outputText
>                       value="Yes"
>                       rendered="#{ruleInstanceRow.activeFlag == 'true'}"/>
>               <h:outputText
>                       value="No"
>                       rendered="#{ruleInstanceRow.activeFlag == 'false'}"/>
>       </h:column>
> </h:dataTable>
> I have other dataTable's in my application, all of which follow the exact 
> same pattern as this, and all of which work correctly. Thinking that there 
> might have been a problem connecting the JSP page to the backing bean, I 
> changed the getAllRuleInstances() method above to return a List of different 
> classes, and changed the column references in the dataTable to the different 
> class, and the dataTable worked correctly. This tells me that MyFaces may 
> have a problem with the RuleInstance class, but without more detailed 
> exception information I can't see what that might be.
> Just to clarify, I am using JDK 1.4.2. I have seen a dataTable example that 
> used a paramaterized List ( List<...> ) to tell Java what class each element 
> would be an instance of, which might aid MyFaces in displaying the dataTable. 
> I understand that paramaterized types are only supported in JDK 1.5+, so I 
> cannot go down this path.
> This problem seems to defy logic, and I have been beating my head against the 
> wall trying to solve it. Is there something hidden away that can cause a 
> dataTable to throw this exception for no apparent reason?
> Any ideas? I appreciate any time you can spend looking at this, so thanks in 
> advance.

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

        

Reply via email to