---
title: "Summing of JSF(myfaces implement)"
author: "lichangwei"
date: "2009-01-08T22:59:24Z"
tags: []
slug: "summing-of-jsf-myfaces-implement"
draft: false
lastmod: "2009-01-09T09:05:55Z"
id: 313074
url: "https://lichangwei.iteye.com/blog/313074"
---

1\. \[ERROR 2009-01-08 22:19:06,993] Bean: com.\*\*\*.\*\*\*\*\*\*.jsf.menu.ProfileBackBean, property: currentProfileKey  
javax.faces.el.PropertyNotFoundException: Bean: com.\*\*\*.\*\*\*\*\*\*.jsf.menu.ProfileBackBean, property: currentProfileKey  
 at org.apache.myfaces.el.PropertyResolverImpl.setProperty(PropertyResolverImpl.java:353)  
 at org.apache.myfaces.el.PropertyResolverImpl.setValue(PropertyResolverImpl.java:148)  
 at org.apache.shale.faces.ShalePropertyResolver.setValue(ShalePropertyResolver.java:178)  
 at org.apache.myfaces.el.ValueBindingImpl.setValue(ValueBindingImpl.java:269)  
 at javax.faces.component.UIInput.updateModel(UIInput.java:226)  
 at javax.faces.component.UIInput.processUpdates(UIInput.java:165)  
 at javax.faces.component.UIForm.processUpdates(UIForm.java:85)  
 at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:428)  
 at javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:153)  
 at org.ajax4jsf.framework.ajax.AjaxViewRoot.access$101(AjaxViewRoot.java:53)  
开始以为在backbean的某个setter方法，是不必须的，虽然我有这个字段，也需要从外部得到这个字段，但是不会直接设置这个字段。所以就去掉了该setter方法，导致以上错误。在debug跟踪阶段，得到了以下异常：BufferUnderflowException The buffer is already empty。估计是myfaces在保存backbean是调用setter方法。该backbean的scope是session。

 

2\. Exception: \[ERROR 2009-01-08 20:33:40,068] failed to configure class com.\*\*\*.\*\*\*\*\*\*.jsf.menu.ListMenuRender  
javax.faces.FacesException: java.lang.InstantiationException: com.\*\*\*.\*\*\*\*\*\*.jsf.menu.ListMenuRender  
到现在还出这种问题，实在惭愧。  
这个问题在于，我继承一个abstract类，但是没有显示写无参的构造方法，而此时默认生成的构造方法又没有调用父类 构造方法，导致父类没有正确初始化。加上以下内容就OK了。  
public ListMenuRender(){  
 super();  
}  
还有一处很类似，为了写一个jsf的tag，component类继承UIOutput，在重写public void encodeBegin(FacesContext context) throws IOException方法时，也没有调用super.encodeBegin()导致render类的encodeBegin方法没有执行。  
切记：在存在父类情况下，构造方法和重写父类方法不要忘记调用父类构造方法和被重写方法。

 

3.\[ERROR 2009-01-08 21:44:52,129] Servlet.service() for servlet Faces Servlet threw exception  
java.lang.NullPointerException  
 at java.lang.String.endsWith(String.java:1296)  
 at org.apache.shale.clay.faces.ClayViewHandler.indexOfClayTemplateSuffix(ClayViewHandler.java:254)  
 at org.apache.shale.clay.faces.ClayViewHandler.restoreView(ClayViewHandler.java:275)  
 at org.apache.shale.view.faces.ViewViewHandler.restoreView(ViewViewHandler.java:164)  
 at org.apache.shale.tiles.TilesViewHandler.restoreView(TilesViewHandler.java:230)  
 at org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl.restoreView(JspTilesViewHandlerImpl.java:320)  
是因为在配置时候没有加上“/”。  
&lt;navigation-rule&gt;  
  &lt;from-view-id&gt;  
   /MenuList.jsp  
  &lt;/from-view-id&gt;  
  &lt;navigation-case&gt;  
   &lt;from-outcome&gt;refresh&lt;/from-outcome&gt;  
   &lt;to-view-id&gt;/MenuList.faces&lt;/to-view-id&gt;  
  &lt;/navigation-case&gt;  
 &lt;/navigation-rule&gt;