Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Tree - Null Exception

Hi,

A very strange problem I am currently facing with Tree.

I have created a simple tree application.

The context for the view is as follows:

Context
 |---Root                 <-- Value Node
   |---FirstLevel         <-- Value Node
   | |---FirstLevelText   <-- Value Attribute
   |--Text                <-- Value Attribute

From the above , it is clear that we have a Root as Value Node, Text as Value Attribute of Node Root.

In wdDoInit, this is the code I have attached.

  public void wdDoInit()
  {
    //@@begin wdDoInit()
	IPrivateMyTestTreeCompView.IRootNode rootNode = wdContext.nodeRoot();
	IPrivateMyTestTreeCompView.IRootElement rootElement = rootNode.createRootElement();
	
	rootElement.setText("My Root Node");
	rootNode.addElement(rootElement);
	
	IPrivateMyTestTreeCompView.IFirstLevelNode firstLevelNode = rootNode.nodeFirstLevel();
	IPrivateMyTestTreeCompView.IFirstLevelElement firstLevelElement = firstLevelNode.createFirstLevelElement();
	
	firstLevelElement.setFirstLevelText("First Level");
	firstLevelNode.addElement(firstLevelElement);
	
    //@@end
  }

<b>Context Mapping</b>

In my view, I have only one UI Element, which is Tree. I have mapped it to Root of Context Element. I have created a NodeType of FirstLevelNode and mapped it to FirstLevel of Context. I have also correctly mapped the text property of the tree and its nodetype to the context value attributes.

<u><b>Error</b></u>

The root Node with the proper text i.e. My Root Node gets populated properly. However, the value First Level never comes up. Instead I have got this huge error log of NullPointerException in some TreeAdapter.java

I know this is some absolutely silly mistake, but I just can't figure it out. Please help.

I have done a sample Tree application based on the Tutorial available for Recursive Tree. It works great. I also looked at a Non-Recursive tutorial, but it just doesn't help.

Regards,

Subramanian V.

StackTrace attached below

Trees

My Root Node

-->An error has occurred:

"Failed to process the request."

Please contact your system administrator.

-


Hide details

Error stacktrace:

java.lang.NullPointerException

at com.sap.tc.webdynpro.clientimpl.html.uielib.standard.uradapter.TreeAdapter$Nodes.getIsClickable(TreeAdapter.java:1517)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.ie6.TreeRenderer.renderTreeNodeFragment(TreeRenderer.java:1829)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.ie6.TreeRenderer.renderTreeFragment(TreeRenderer.java:510)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.ie6.TreeRenderer.render(TreeRenderer.java:49)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.AbstractRenderManager.render(AbstractRenderManager.java:269)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.AbstractRenderManager.render(AbstractRenderManager.java:95)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.ie6.GridLayoutRenderer.renderGridLayoutCellFragment(GridLayoutRenderer.java:626)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.ie6.GridLayoutRenderer.renderGridLayoutRowFragment(GridLayoutRenderer.java:330)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.ie6.GridLayoutRenderer.renderGridLayoutFragment(GridLayoutRenderer.java:261)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.ie6.GridLayoutRenderer.render(GridLayoutRenderer.java:57)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.AbstractRenderManager.render(AbstractRenderManager.java:269)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.AbstractRenderManager.render(AbstractRenderManager.java:95)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.ie6.ScrollContainerRenderer.renderScrollContainerFragment(ScrollContainerRenderer.java:344)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.ie6.ScrollContainerRenderer.render(ScrollContainerRenderer.java:41)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.AbstractRenderManager.render(AbstractRenderManager.java:269)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.AbstractRenderManager.render(AbstractRenderManager.java:95)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.UiWindowRenderer.render(UiWindowRenderer.java:43)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.AbstractRenderManager.render(AbstractRenderManager.java:269)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.AbstractRenderManager.render(AbstractRenderManager.java:95)

at com.sap.tc.webdynpro.clientimpl.html.client.HtmlClient.sendHtml(HtmlClient.java:522)

at com.sap.tc.webdynpro.clientimpl.html.client.HtmlClient.sendResponse(HtmlClient.java:351)

at com.sap.tc.webdynpro.clientimpl.html.client.HtmlClient.sendResponse(HtmlClient.java:249)

at com.sap.tc.webdynpro.clientimpl.html.client.HtmlClient.sendResponse(HtmlClient.java:204)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:669)

at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)

at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:249)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:48)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

Message was edited by: Subramanian Venkateswaran

Former Member
Former Member replied

Hi

Which version are you using. In SP10 your scenario works fine. Of course to achieve a Node within a Node you will have to write some more logic. But regarding the Null pointer exception , it doesnt seem to happen in SP10 and SP11. It gives a clean output with Root Node and below that a value attribute with name "First Level Text"

Your coding is fine. Maybe the version there is a problem.

regards

ravi

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question