当我在我的控制器(zk)中设置单个模型时,一切都很好,但是当我尝试为多个模型执行此操作时,我有错误java.lang.NullPointerException
。我的错误是什么?
代码......
public void doAfterCompose (Component comp) throws Exception {
super.doAfterCompose(comp);
// set models and render to listbox after composed
articuloListBox.setModel(getArticulosModel());
articuloListBox.setItemRenderer(new ArticulosRenderer());
// Setting this second model the error is trow....
try {
familiaListBox.setModel(getFamiliasModel());
familiaListBox.setItemRenderer(new FamiliasRenderer());
} catch (Exception e) {
System.out.println("EXCEPTION: "+e);
}
}
这是完整的堆栈跟踪...
Grave:java.lang.NullPointerException at controllers.ArticulosViewController.doAfterCompose(ArticulosViewController.java:89) 在 org.zkoss.zk.ui.impl.UiEngineImpl.doAfterCompose(UiEngineImpl.java:529) 在 org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:824) 在 org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:770) 在 org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:679) 在 org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:643) 在 org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:394) 在 org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:316) 在 org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:215) 在 org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:135) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:687)at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)at at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682) 在 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318) 在 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) 在 org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734) 在 org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673) 在com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)at 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) 在 com.sun.enterprise.v3.services.impl.ContainerMapper $ HttpHandlerCallable.call(ContainerMapper.java:459) 在 com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167) 在 org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201) 在 org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175) 在 org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235) 在 org.glassfish.grizzly.filterchain.ExecutorResolver $ 9.execute(ExecutorResolver.java:119) 在 org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284) 在 org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201) 在 org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133) 在 org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112) 在 org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) 在 org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561) 在 org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) 在 org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) 在 org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access $ 100(WorkerThreadIOStrategy.java:56) 在 org.glassfish.grizzly.strategies.WorkerThreadIOStrategy $ WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) 在 org.glassfish.grizzly.threadpool.AbstractThreadPool $ Worker.doWork(AbstractThreadPool.java:565) 在 org.glassfish.grizzly.threadpool.AbstractThreadPool $ Worker.run(AbstractThreadPool.java:545) 在java.lang.Thread.run(Thread.java:745)