java.lang.reflect.InvocationTargetException

ZK-Tracker | vincentjian | 5 years ago
  1. 0

    Process to reproduce the problem 1. Set MVVM bean properties in session {code:java} package demo; public class BookVM { List<Item> items; String label2; public class Item { String name; public Item(String name) { this.name = name; } public String getName() { return name; } } public List<Item> getItems() { items = (ListModelList<Item>) Sessions.getCurrent().getAttribute("items"); if (items == null) { Sessions.getCurrent().setAttribute("items", items = new ListModelList<Item>()); items.add(new Item("A")); } return items; } @GlobalCommand public void doButton(@BindingParam("item") Item item) { System.out.println("vm1:" + item.getName()); } } {code} {code:java} package demo; public class BookVM2 { List<CheckItem> checkItems; public class CheckItem { String name; public CheckItem(String name) { this.name = name; } public String getName() { return name; } } public List<CheckItem> getCheckItems() { checkItems = (ListModelList<CheckItem>) Sessions.getCurrent().getAttribute("checkItems"); if (checkItems == null) { Sessions.getCurrent().setAttribute("checkItems", checkItems = new ListModelList<CheckItem>()); checkItems.add(new CheckItem("AAA")); } return checkItems; } @GlobalCommand @NotifyChange("checkItems") public void doButton(@BindingParam("item") Item item) { System.out.println("vm2:" + item.getName()); CheckItem i = new CheckItem(item.getName()); checkItems.add(i); } } {code} 2. load zul content below {code:xml} <zk> <window border="normal" width="100%" height="100%"> <borderlayout> <center> <div apply="org.zkoss.bind.BindComposer" viewModel="@id('vm1') @init('demo.BookVM')" binder="@init(queueScope='session')"> <grid model="@load(vm1.items)"> <columns sizable="true"> <column /> <column /> <column /> </columns> <template name="model" var="item"> <row> <cell><label value="@bind(item.name)" /></cell> <cell><label value="aaaa" /></cell> <cell> <button label="click" onClick="@global-command('doButton', item=item)" /> </cell> </row> </template> </grid> </div> </center> <east size="35%"> <div apply="org.zkoss.bind.BindComposer" viewModel="@id('vm2') @init('demo.BookVM2')" binder="@init(queueScope='session')"> <listbox model="@load(vm2.checkItems)"> <listhead sizable="true"> <listheader width="15%" /> </listhead> <template name="model" var="citem"> <listitem> <listcell label="@bind(citem.name)" /> </listitem> </template> </listbox> </div> </east> </borderlayout> </window> </zk> {code} 3. load the zul, and reload again 4.click the button, you will see this exception Stack trace: {code} java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.zkoss.bind.impl.ParamCall.call(ParamCall.java:108) at org.zkoss.bind.impl.BinderImpl.doGlobalCommandExecute(BinderImpl.java:1314) at org.zkoss.bind.impl.BinderImpl.doGlobalCommand(BinderImpl.java:1291) at org.zkoss.bind.impl.BinderImpl.access$2(BinderImpl.java:1281) at org.zkoss.bind.impl.BinderImpl$QueueListener.onEvent(BinderImpl.java:235) at org.zkoss.zk.ui.event.impl.DesktopEventQueue$QueueListener.onEvent(DesktopEventQueue.java:145) at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2741) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2712) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2653) at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136) at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1699) at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1484) at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1201) at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:558) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:456) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:464) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) Caused by: java.lang.NullPointerException at org.zkoss.zk.ui.AbstractComponent.addMoved(AbstractComponent.java:478) at org.zkoss.zul.Listitem.addMoved(Listitem.java:332) at org.zkoss.zk.ui.AbstractComponent.setParent(AbstractComponent.java:1055) at org.zkoss.zk.ui.AbstractComponent.insertBefore(AbstractComponent.java:1152) at org.zkoss.zul.Listbox.insertBefore(Listbox.java:1591) at org.zkoss.zul.impl.ListboxDataLoader.doListDataChange(ListboxDataLoader.java:107) at org.zkoss.zkmax.zul.impl.LiveListboxDataLoader.doListDataChange(LiveListboxDataLoader.java:95) at org.zkoss.zul.Listbox.onListDataChange(Listbox.java:2541) at org.zkoss.zul.Listbox.access$17(Listbox.java:2523) at org.zkoss.zul.Listbox$4.onChange(Listbox.java:459) at org.zkoss.zul.AbstractListModel.fireEvent(AbstractListModel.java:60) at org.zkoss.zul.ListModelList.add(ListModelList.java:162) at org.zkoss.zktest.bind.issue.B00871BeanInSession2.doButton(B00871BeanInSession2.java:40) {code}

    ZK-Tracker | 5 years ago | vincentjian
    java.lang.reflect.InvocationTargetException
  2. 0

    Process to reproduce the problem 1. Set MVVM bean properties in session {code:java} package demo; public class BookVM { List<Item> items; String label2; public class Item { String name; public Item(String name) { this.name = name; } public String getName() { return name; } } public List<Item> getItems() { items = (ListModelList<Item>) Sessions.getCurrent().getAttribute("items"); if (items == null) { Sessions.getCurrent().setAttribute("items", items = new ListModelList<Item>()); items.add(new Item("A")); } return items; } @GlobalCommand public void doButton(@BindingParam("item") Item item) { System.out.println("vm1:" + item.getName()); } } {code} {code:java} package demo; public class BookVM2 { List<CheckItem> checkItems; public class CheckItem { String name; public CheckItem(String name) { this.name = name; } public String getName() { return name; } } public List<CheckItem> getCheckItems() { checkItems = (ListModelList<CheckItem>) Sessions.getCurrent().getAttribute("checkItems"); if (checkItems == null) { Sessions.getCurrent().setAttribute("checkItems", checkItems = new ListModelList<CheckItem>()); checkItems.add(new CheckItem("AAA")); } return checkItems; } @GlobalCommand @NotifyChange("checkItems") public void doButton(@BindingParam("item") Item item) { System.out.println("vm2:" + item.getName()); CheckItem i = new CheckItem(item.getName()); checkItems.add(i); } } {code} 2. load zul content below {code:xml} <zk> <window border="normal" width="100%" height="100%"> <borderlayout> <center> <div apply="org.zkoss.bind.BindComposer" viewModel="@id('vm1') @init('demo.BookVM')" binder="@init(queueScope='session')"> <grid model="@load(vm1.items)"> <columns sizable="true"> <column /> <column /> <column /> </columns> <template name="model" var="item"> <row> <cell><label value="@bind(item.name)" /></cell> <cell><label value="aaaa" /></cell> <cell> <button label="click" onClick="@global-command('doButton', item=item)" /> </cell> </row> </template> </grid> </div> </center> <east size="35%"> <div apply="org.zkoss.bind.BindComposer" viewModel="@id('vm2') @init('demo.BookVM2')" binder="@init(queueScope='session')"> <listbox model="@load(vm2.checkItems)"> <listhead sizable="true"> <listheader width="15%" /> </listhead> <template name="model" var="citem"> <listitem> <listcell label="@bind(citem.name)" /> </listitem> </template> </listbox> </div> </east> </borderlayout> </window> </zk> {code} 3. load the zul, and reload again 4.click the button, you will see this exception Stack trace: {code} java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.zkoss.bind.impl.ParamCall.call(ParamCall.java:108) at org.zkoss.bind.impl.BinderImpl.doGlobalCommandExecute(BinderImpl.java:1314) at org.zkoss.bind.impl.BinderImpl.doGlobalCommand(BinderImpl.java:1291) at org.zkoss.bind.impl.BinderImpl.access$2(BinderImpl.java:1281) at org.zkoss.bind.impl.BinderImpl$QueueListener.onEvent(BinderImpl.java:235) at org.zkoss.zk.ui.event.impl.DesktopEventQueue$QueueListener.onEvent(DesktopEventQueue.java:145) at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2741) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2712) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2653) at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136) at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1699) at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1484) at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1201) at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:558) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:456) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:464) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) Caused by: java.lang.NullPointerException at org.zkoss.zk.ui.AbstractComponent.addMoved(AbstractComponent.java:478) at org.zkoss.zul.Listitem.addMoved(Listitem.java:332) at org.zkoss.zk.ui.AbstractComponent.setParent(AbstractComponent.java:1055) at org.zkoss.zk.ui.AbstractComponent.insertBefore(AbstractComponent.java:1152) at org.zkoss.zul.Listbox.insertBefore(Listbox.java:1591) at org.zkoss.zul.impl.ListboxDataLoader.doListDataChange(ListboxDataLoader.java:107) at org.zkoss.zkmax.zul.impl.LiveListboxDataLoader.doListDataChange(LiveListboxDataLoader.java:95) at org.zkoss.zul.Listbox.onListDataChange(Listbox.java:2541) at org.zkoss.zul.Listbox.access$17(Listbox.java:2523) at org.zkoss.zul.Listbox$4.onChange(Listbox.java:459) at org.zkoss.zul.AbstractListModel.fireEvent(AbstractListModel.java:60) at org.zkoss.zul.ListModelList.add(ListModelList.java:162) at org.zkoss.zktest.bind.issue.B00871BeanInSession2.doButton(B00871BeanInSession2.java:40) {code}

    ZK-Tracker | 5 years ago | vincentjian
    java.lang.reflect.InvocationTargetException
  3. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.zkoss.zk.ui.AbstractComponent.addMoved()
    2. ZK Kernel
      AbstractComponent.addMoved
      1. org.zkoss.zk.ui.AbstractComponent.addMoved(AbstractComponent.java:478)
      1 frame
    3. ZK XUL Components
      Listitem.addMoved
      1. org.zkoss.zul.Listitem.addMoved(Listitem.java:332)
      1 frame
    4. ZK Kernel
      AbstractComponent.insertBefore
      1. org.zkoss.zk.ui.AbstractComponent.setParent(AbstractComponent.java:1055)
      2. org.zkoss.zk.ui.AbstractComponent.insertBefore(AbstractComponent.java:1152)
      2 frames
    5. ZK XUL Components
      ListboxDataLoader.doListDataChange
      1. org.zkoss.zul.Listbox.insertBefore(Listbox.java:1591)
      2. org.zkoss.zul.impl.ListboxDataLoader.doListDataChange(ListboxDataLoader.java:107)
      2 frames
    6. org.zkoss.zkmax
      LiveListboxDataLoader.doListDataChange
      1. org.zkoss.zkmax.zul.impl.LiveListboxDataLoader.doListDataChange(LiveListboxDataLoader.java:95)
      1 frame
    7. ZK XUL Components
      ListModelList.add
      1. org.zkoss.zul.Listbox.onListDataChange(Listbox.java:2541)
      2. org.zkoss.zul.Listbox.access$17(Listbox.java:2523)
      3. org.zkoss.zul.Listbox$4.onChange(Listbox.java:459)
      4. org.zkoss.zul.AbstractListModel.fireEvent(AbstractListModel.java:60)
      5. org.zkoss.zul.ListModelList.add(ListModelList.java:162)
      5 frames
    8. org.zkoss.zktest
      B00871BeanInSession2.doButton
      1. org.zkoss.zktest.bind.issue.B00871BeanInSession2.doButton(B00871BeanInSession2.java:40)
      1 frame