2017-01-09 53 views
1

樹在選擇節點時拋出異常,在backinbean中它會發送正確節點的值。但是這個例外不是來自哪裏。primefaces在選擇節點時樹會拋出異常

日誌:

信息:java.lang.IllegalArgumentException異常:無法將類型類org.primefaces.model.DefaultTreeNode的Territorio IV類com.delisa.ejb.util.utls.GrupoUtil 的Java。 lang.IllegalArgumentException:無法將類org.primefaces.model.DefaultTreeNode的Territorio IV轉換爲類com.delisa.ejb.util.utls.GrupoUtil at com.sun.el.lang.ELSupport.coerceToType(ELSupport.java:424 ) at com.sun.el.lang.ELSupport.coerceToType(ELSupport.java:382) at com.sun.el.parser.AstValue.setValue(AstValue.java:248) at com.sun.el. ValueExpressionImpl.setValue(ValueExpressionImpl.java:294) 在org.jboss.weld.el.WeldValueExpression.setValue(WeldValueExpression.java:64) 在com.sun.faces.facelets.el.TagValueExpression.setValue(TagValueExpression.java: 131) 在org.primefaces.component.api.UITree.updateSelection(UITree.java:524) 在org.primefaces.component.api.UITree.processUpdates(UITree.java:490) 在org.primefaces.component。 tree.Tree.processUpdates(Tree.java:425) at com.sun.faces.context.PartialViewContextImpl $ PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:577) at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback( PartialVisitContext.java:183) at org.primefaces.component.api.UITree.visitTree(UITree.java:738)(UIComponent.visitTree)(UIComponent.java:1700) at javax.faces.component.UIForm.visitTree(UIForm.java:371) at javax.faces.component.UIComponent.visitTree(UIComponent。的java:1700) 在javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) 在javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) 在com.sun.faces.context。 PartialViewContextImpl.processComponents(PartialViewContextImpl.java:403) 在com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:266) 在org.primefaces.context.PrimePartialViewContext.processPartial(PrimePartialViewContext.java:57) 在javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:1252) at com.sun.faces.lifecycle.UpdateModelValuesPhase.execute(UpdateModelValuesPhase.java:78) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle。 LifecycleImpl.execute(LifecycleImpl.java:198) 在javax.faces.webapp.FacesServlet.service(FacesServlet.java:654) 在org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682) 在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at com.delisa.jsf.util.NoCacheFilter。 doFilter(NoCacheFilter.java:38) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.jav一:256) 在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) 在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316) 在org.apache。 catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline。 java:673) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline。的java:99) 在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174) 在org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415) 在org.apache。 catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282) at com.sun.enterprise.v3.services.impl.ContainerMapper $ HttpHandlerCallable.call(ContainerMapper.java:459) at com.sun.enterprise.v3。 services.impl.ContainerMapper.service(ContainerMapper.java:167) at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206) at org.glassfish.grizzly.http.server.HttpHandler。 doHandle(HttpHandler.java:180) at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235) at o rg.glassfish.grizzly.filterchain.ExecutorResolver $ 9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283) at org.glassfish.grizzly.filterchain.DefaultFilterChain .executeChainPart(DefaultFilterChain.java:200) 在org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132) 在org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536) at org.glassfish.grizzly.strategies.AbstractIOStrategy .fireIOEvent(AbstractIOStrategy.java:112) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access $ 100(WorkerThreadIOStrategy.java:56) at org.glassfish.grizzly.strategies .WorkerThreadIOStrategy $ WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) at org.glassfish.grizzly.threadpool.AbstractThreadPool $ Worker.doWork(AbstractThreadPool.java:591) at org.glassfish.grizzly.threadpool.AbstractThreadPool $ Worker.run (AbstractThreadPool.java:571) 在java.lang.Thread.run(Thread.java:745)

Advertencia:java.lang.IllegalArgumentException異常:無法轉換型類org.primefaces.model.DefaultTreeNode的Territorio IV至class com.delisa.ejb.util。 utls.GrupoUtil

我XHTML頁面

<p:dialog responsive="true" dynamic="true" showEffect="fade" resizable="false" appendTo="@(body)" modal="true" position="center top" style="margin-top: 50px" 
 
          id="dialogInt" header="Seleccione donde desea moverlo" widgetVar="dialogGruph" width="600" height="600" closeOnEscape="true"> 
 
        <h:form id="frmGrupph"> 
 
         <div class="Container100"> 
 

 
          <div class="ContainerIndent"> 
 
           <p:tree id="treeEstrucph" styleClass="Wid100" value="#{mBEstructura.rootParentChange}" var="nodepc" 
 
              selectionMode="single" selection="#{mBEstructura.selectedParentchange}" >  
 

 
            <p:ajax event="select" update=":frmGrupph" listener="#{mBEstructura.parentChange}" /> 
 
                   
 

 
            <p:treeNode expandedIcon="ui-icon-folder-open" collapsedIcon="ui-icon-folder-collapsed"> 
 
             <h:outputText value="#{nodepc}"/> 
 
            </p:treeNode> 
 
           </p:tree> 
 
          </div>  
 
         </div> 
 

 

 
         
 
         <p:blockUI block="treeEstrucph" trigger="treeEstrucph" /> 
 
        </h:form> 
 
       </p:dialog> 

最後我backingbean

public void parentChange(NodeSelectEvent event) throws Exception { 
    try { 
     JbGrupos ep = (JbGrupos) event.getTreeNode().getData(); 
     /** 
     * 
     */ 

    } catch (Exception e) { 
     JsfUtil.addErrorMessage(e, "Error: parentChange() " + e.getMessage()); 
    } 
} 
+0

檢查您在樹中使用的不同類型的對象 –

+0

請添加您在樹中使用的不同類型的對象(r​​ootParentChange,selectedParentchange ...) –

+0

Gracias @YagamiLight ... eso es todo ... – meyquel

回答

1

,你在你的樹面臨的問題的對象類型你在樹中使用的不同元素,檢查你將要樹的每個元素髮現錯誤(在這種情況下,你成功地做到了這一點)。

即使樹構造有樹節點類型可以例如它結合於其它類型的

treeConstruct = new DefaultTreeNode(new client(), null); 

每個您在樹使用節點可以選擇和使用的客戶端數據

希望對你有所幫助。