NullPointerException

19 views
Skip to first unread message

Ian Clarke

unread,
Jun 1, 2011, 6:39:11 PM6/1/11
to epo...@googlegroups.com
Hi, I just created my first ambitious Model, and I'm getting the following exception:

Exception in thread "main" java.lang.NullPointerException

at org.epochx.gp.op.init.FullInitialiser.getValidNodes(Unknown Source)

at org.epochx.gp.op.init.FullInitialiser.getNodeTree(Unknown Source)

at org.epochx.gp.op.init.FullInitialiser.getNodeTree(Unknown Source)

at org.epochx.gp.op.init.FullInitialiser.getNodeTree(Unknown Source)

at org.epochx.gp.op.init.FullInitialiser.getNodeTree(Unknown Source)

at org.epochx.gp.op.init.FullInitialiser.getNodeTree(Unknown Source)

at org.epochx.gp.op.init.FullInitialiser.getNodeTree(Unknown Source)

at org.epochx.gp.op.init.FullInitialiser.getNodeTree(Unknown Source)

at org.epochx.gp.op.init.FullInitialiser.getFullNodeTree(Unknown Source)

at org.epochx.gp.op.init.FullInitialiser.getInitialProgram(Unknown Source)

at org.epochx.gp.op.init.FullInitialiser.getInitialPopulation(Unknown Source)

at org.epochx.core.InitialisationManager.initialise(Unknown Source)

at org.epochx.core.RunManager.run(Unknown Source)

at org.epochx.core.Model.run(Unknown Source)

at org.epochx.gp.model.GPModel.run(Unknown Source)

at mtgoxtrader.Evolve.main(Evolve.java:31)


Unfortunately its not terribly informative due to epochx-1.4.jar being compiled without debugging information.  I tried to compile it myself, but its been a long time since I've used javac directly, and I'm getting a bunch of "cannot find symbol" errors.

Any ideas on the exception above? How do I compile from source using javac?

Thanks!

Ian.



--
Ian Clarke

Tom Castle

unread,
Jun 1, 2011, 8:21:06 PM6/1/11
to EpochX
Yes, that's not particularly informative is it.

It looks as though one of your nodes may be doing something strange
though. One possible thing to look for is to make sure any terminal
nodes have a non-null return type. In particular the return type for a
literal is by default the data type of its value, so if you're not
overriding this then ensure the value of your DateTime constants etc
can never be null.

To compile with javac, make sure the jar files in lib are on the
classpath, and all .java files in src are compiled together. If you
recursively generate a list of .java files under src, you can pass the
list with @filelist.txt. Something like:

javac -cp .;../lib/commons-lang-2.5.jar;...etc @filelist.txt -d ../bin

Tom

Ian Clarke

unread,
Jun 3, 2011, 9:09:52 AM6/3/11
to epo...@googlegroups.com
Yes, it was a dumb mistake in some of my Nodes' implementation.  

To aid with debugging, you might consider enabling the debugging information in the distributed .jar file, I don't think it would have a significant impact on performance.

Ian.
Reply all
Reply to author
Forward
0 new messages