From: Nick C. <nic...@gm...> - 2017-06-19 14:48:53
|
I think you also need to set an id on the context in the ContextBuilder. For example, public Context build(Context<Object> context) { context.setId(“jzombies"); ... That id needs to match context defined in context.xml in your scenario. For example, <context id="jzombies"> ... Nick > On Jun 19, 2017, at 10:22 AM, Tatara, Eric R. <ta...@an...> wrote: > > Did you specify the dataloader in the Scenario Tree? It should specify a custom context builder implementation which is your context builder class. > > eric > > From: Juan Moreno Oto [mailto:jua...@te... <mailto:jua...@te...>] > Sent: Friday, June 16, 2017 3:26 PM > To: rep...@li... <mailto:rep...@li...> > Subject: [Repast-interest] Error while initializing simulation > > I'm programming a model in Repast Simphony. When running it, i receive an error message "repast.simphony.ui.RSApplication - Error while initializing simulation > java.lang.NullPointerException" (the complete error report can be seen below). I've pruned my model to get a minimal example with the same error, that you can see below. > Does anyone have an idea about solving it? > > Thanks a lot > > ------ > > package test2; > > import java.util.ArrayList; > import java.util.Iterator; > > import repast.simphony.context.Context; > import repast.simphony.context.space.graph.NetworkBuilder; > import repast.simphony.context.space.graph.NetworkGenerator; > import repast.simphony.context.space.graph.RandomDensityGenerator; > import repast.simphony.dataLoader.ContextBuilder; > import repast.simphony.space.graph.Network; > import repast.simphony.space.graph.RepastEdge; > > public class Start implements ContextBuilder<Individual> { > > public Context<Individual> build(Context<Individual> context) { > System.out.println("______________________"); > System.out.println("Build beginning "); > System.out.println(""); > return context; > } > > } > > ------ > > package test2; > > import java.util.ArrayList; > import repast.simphony.engine.schedule.ScheduledMethod; > > > public class Individual { > int index; > String name; > double reputation; > > public Individual(int index, String name) { > this.index = index; > this.name = name; > this.reputation = 0.5; > > } > > public void report (){ > System.out.println(this.index); > System.out.println(this.name); > System.out.println(this.reputation); > > } > > @ScheduledMethod(start = 0, interval = 1, shuffle = true) > public void influenceOnAction() { > System.out.println("Individual " + this.index + " is influencing on action..."); > } > > > } > > ------- > > jun 16, 2017 10:02:42 PM java.util.prefs.WindowsPreferences <init> > WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5. > ERROR [AWT-EventQueue-0] 22:02:53,742 repast.simphony.ui.RSApplication - Error while initializing simulation > java.lang.NullPointerException > at repast.simphony.engine.controller.ScheduledMethodControllerAction.processContext(ScheduledMethodControllerAction.java:157) > at repast.simphony.engine.controller.ScheduledMethodControllerAction.runInitialize(ScheduledMethodControllerAction.java:182) > at repast.simphony.engine.controller.DefaultController$2.visit(DefaultController.java:214) > at repast.simphony.engine.controller.DefaultController$2.visit(DefaultController.java:1) > at repast.simphony.util.collections.NaryTree.preOrderTraverals(NaryTree.java:292) > at repast.simphony.util.collections.NaryTree.preOrderTraverals(NaryTree.java:295) > at repast.simphony.util.collections.NaryTree.preOrderTraversal(NaryTree.java:288) > at repast.simphony.engine.controller.DefaultController.runInitialize(DefaultController.java:212) > at repast.simphony.engine.controller.DefaultController.runInitialize(DefaultController.java:383) > at repast.simphony.ui.RSApplication.initSim(RSApplication.java:157) > at repast.simphony.ui.RSApplication.start(RSApplication.java:189) > at repast.simphony.ui.action.StartRun.actionPerformed(StartRun.java:17) > at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) > at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) > at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) > at javax.swing.DefaultButtonModel.setPressed(Unknown Source) > at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) > at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) > at java.awt.Component.processMouseEvent(Unknown Source) > at javax.swing.JComponent.processMouseEvent(Unknown Source) > at java.awt.Component.processEvent(Unknown Source) > at java.awt.Container.processEvent(Unknown Source) > at java.awt.Component.dispatchEventImpl(Unknown Source) > at java.awt.Container.dispatchEventImpl(Unknown Source) > at java.awt.Component.dispatchEvent(Unknown Source) > at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) > at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) > at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) > at java.awt.Container.dispatchEventImpl(Unknown Source) > at java.awt.Window.dispatchEventImpl(Unknown Source) > at java.awt.Component.dispatchEvent(Unknown Source) > at java.awt.EventQueue.dispatchEventImpl(Unknown Source) > at java.awt.EventQueue.access$500(Unknown Source) > at java.awt.EventQueue$3.run(Unknown Source) > at java.awt.EventQueue$3.run(Unknown Source) > at java.security.AccessController.doPrivileged(Native Method) > at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) > at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) > at java.awt.EventQueue$4.run(Unknown Source) > at java.awt.EventQueue$4.run(Unknown Source) > at java.security.AccessController.doPrivileged(Native Method) > at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) > at java.awt.EventQueue.dispatchEvent(Unknown Source) > at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) > at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) > at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) > at java.awt.EventDispatchThread.pumpEvents(Unknown Source) > at java.awt.EventDispatchThread.pumpEvents(Unknown Source) > at java.awt.EventDispatchThread.run(Unknown Source) > > > > > <image001.jpg> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > Libre de virus. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org <http://slashdot.org/>! http://sdm.link/slashdot_______________________________________________ <http://sdm.link/slashdot_______________________________________________> > Repast-interest mailing list > Rep...@li... <mailto:Rep...@li...> > https://lists.sourceforge.net/lists/listinfo/repast-interest <https://lists.sourceforge.net/lists/listinfo/repast-interest> |