TreeRenderer.encodeBegin NullPointerException ???
[Logo]
ICEsoft.org Forums: ICEfaces, ICEmobile, ICEpdf
[Search] Search   [Recent Topics] Recent Topics   [Groups] Home Page | www.icefaces.org  [Register] Register  [Login] Login 
TreeRenderer.encodeBegin NullPointerException ???  XML
Forum Index -> JBoss Seam Integration
Author Message
kirpi4ik

Joined: 12/02/2007 00:00:00
Messages: 12
Offline


I'm using :
Icefaces 1.8.2(but same problem was with at least 1.8.1)
Seam 2.2.0.GA
JBoss 5.1.0.GA

I'm trying to display tree component, but when I'm adding tree component :
Code:
 <ice:tree style="font-size: 9;padding:0px; border: 0px;width:99px; height: 80px;display: block;">
 	<ice:treeNode>
 		<f:facet name="icon">
 			<ice:panelGroup style="display: inline;">
 				<ice:graphicImage></ice:graphicImage>
 			</ice:panelGroup>
 		</f:facet>
 		<f:facet name="content">
 			<ice:panelGroup style="display: inline;">
 				<ice:commandLink>
 					<ice:outputText></ice:outputText>
 				</ice:commandLink>
 			</ice:panelGroup>
 		</f:facet>
 	</ice:treeNode>
 </ice:tree>
 


It throws me some strange exception:
Code:
 16:04:29,775 ERROR [D2DFaceletViewHandler] Problem in renderResponse: null
 java.lang.NullPointerException
         at com.icesoft.faces.component.tree.TreeRenderer.encodeBegin(TreeRenderer.java:145)
         at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:813)
         at com.icesoft.faces.component.tree.Tree.encodeBegin(Tree.java:228)
         at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:356)
         at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:96)
         at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
         at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:358)
         at com.icesoft.faces.renderkit.dom_html_basic.GridRenderer.encodeChildren(GridRenderer.java:208)
         at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
 ....
 16:04:30,353 SEVERE [lifecycle] JSF1054: (Phase ID: RENDER_RESPONSE 6, View ID: /home.xhtml) Exception thrown during phase execution: javax.faces.event.PhaseEvent[sou
 16:04:45,400 ERROR [View] Problem encountered during View.servePage
 javax.faces.FacesException: Problem in renderResponse: null
         at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:296)
         at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:153)
         at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
         at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
         at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
 ...
 Caused by: java.lang.NullPointerException
         at com.icesoft.faces.component.tree.TreeRenderer.encodeBegin(TreeRenderer.java:145)
         at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:813)
         at com.icesoft.faces.component.tree.Tree.encodeBegin(Tree.java:228)
         at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:356)
         at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:96)
         at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
 



Any help will be appreciated
With best regards
Dima
kirpi4ik

Joined: 12/02/2007 00:00:00
Messages: 12
Offline


Debugging com.icesoft.faces.component.tree.TreeRenderer class, I see strange behavior.
uiComponent is instantiated(com.icesoft.faces.component.tree.Tree@19d8b11) but
the uiComponent.getValueBinding("value") is NULL
so the next line( TreeModel treeModel = (TreeModel) uiComponent
.getValueBinding("value").getValue(facesContext);
)
throws the NullPointerException

P.S: my tree component is within <ice:form>
judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1196
Offline


Where is the datamodel that is to be bound to your tree? PLease review the markup for this component (using seam-comp-showcase or some other example of ice:tree).
applefan

Joined: 03/10/2009 00:00:00
Messages: 24
Offline


kirpi4ik wrote:
Debugging com.icesoft.faces.component.tree.TreeRenderer class, I see strange behavior.
uiComponent is instantiated(com.icesoft.faces.component.tree.Tree@19d8b11) but
the uiComponent.getValueBinding("value") is NULL
so the next line( TreeModel treeModel = (TreeModel) uiComponent
.getValueBinding("value").getValue(facesContext);
)
throws the NullPointerException

P.S: my tree component is within <ice:form> 


You need a DataModel, as Judy said, to tell ice:Tree how the tree that has to be shown is made (e.g., a root with three childs).
If you want you can take my code posted on SEAM forum as an example or, even better, the seam-showcase (in this case at least you are sure that the code is well written).

My attempt:
http://seamframework.org/Community/ProblemWithIceTree
(the view needs to be encapsulated in an ice:form for it to work)

AgnosticIceTreeNode code:
Code:
 import javax.swing.tree.DefaultMutableTreeNode;
 
 import com.icesoft.faces.component.tree.IceUserObject;
 
 public class AgnosticIceTreeNode extends IceUserObject {
 	
 	private Object payload;
 
 	public AgnosticIceTreeNode(DefaultMutableTreeNode wrapper) {
 		super(wrapper);
 		// TODO Auto-generated constructor stub
 	}
 
 	public void setPayload(Object payload) {
 		this.payload = payload;
 	}
 
 	public Object getPayload() {
 		return payload;
 	}
 
 }
 


See you and good luck. :)
kirpi4ik

Joined: 12/02/2007 00:00:00
Messages: 12
Offline


Solved

I think is too late so I have done some mistakes :)
First of all I had IceUserObject cannot be cast to com.icesoft.faces.component.tree.IceUserObject exception, I fixed it by moving all dependences from war project under ear/lib but in the meantime by mistake MyEclipse editor replaced my tree with default one, so obviously my tree model was blank.
The problem is closed, thanks to all

with best regards,
Dima
 
Forum Index -> JBoss Seam Integration
Go to:   
Powered by JForum 2.1.7ice © JForum Team