Я добавил компонент пользовательского интерфейса JSF Tomahawk t: tree2, и страница отображается нормально. Однако, как только я что-то делаю на странице: нажмите кнопку, которая отправляет submit (), или нажмите кнопку с установленным параметром action, появится сообщение об ошибке:
java.lang.NullPointerException
viewId=/job.xhtml
location=trunk\tce\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\EWC\job.xhtml
phaseId=RESTORE_VIEW(1)
Caused by:
java.lang.NullPointerException
at org.apache.myfaces.custom.tree2.UITreeData.getDataModel(UITreeData.java:701)
Вот трассировка стека:
java.lang.NullPointerException
at org.apache.myfaces.custom.tree2.UITreeData.getDataModel(UITreeData.java:701)
at org.apache.myfaces.custom.tree2.UITreeData.setNodeId(UITreeData.java:387)
at org.apache.myfaces.custom.tree2.AbstractHtmlTree.setNodeId(AbstractHtmlTree.java:101)
at org.apache.myfaces.custom.tree2.UITreeData.visitTree(UITreeData.java:541)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:958)
at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1073)
at javax.faces.component.UIData.visitTree(UIData.java:2169)
at javax.faces.component.UIForm.visitTree(UIForm.java:354)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:958)
at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1073)
at org.apache.myfaces.lifecycle.DefaultRestoreViewSupport.processComponentBinding(DefaultRestoreViewSupport.java:105)
at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:146)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:170)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:112)
at com.mainconcept.rews.webclient.controller.MyFacesServletWrapper.service(MyFacesServletWrapper.java:44)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:357)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1805)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Место, где выдается исключение, находится в начале, компонент поддержки даже не создается снова:
MyFacesServlet::service(ServletRequest request, ServletResponse response)
Код на странице xhtml:
<h:dataTable value="#{JobMgmtBean.presetsTreesList}" var="presetsTree">
<h:column>
<t:tree2
value = "#{presetsTree}"
var = "presetsTreeNode"
varNodeToggler = "t"
showLines = "true"
showRootNode = "true"
showNav = "true"
clientSideToggle = "true"
preserveToggle = "true">
<f:facet name="facetPresetTree">
<h:panelGroup>
<h:selectBooleanCheckbox
value = "#{JobMgmtBean.idsT2[presetsTreeNode.identifier]}"
title = "#{presetsTreeNode.identifier}"
valueChangeListener ="#{JobMgmtBean.setPresetsTreeNodeState}"
/>
<h:outputText value="#{presetsTreeNode.description}" styleClass="text"/>
</h:panelGroup>
</f:facet>
</t:tree2>
</h:column>
</h:dataTable>
И связанные члены bean:
protected List<TreeNodeChecked> presetsTreesList;
private HashMap<String, Boolean> idsT2;
В чем может быть причина?