java.lang.ClassCastException – How to Debug
2 replies
Joshua
2 years ago #282633
I’ve been working on some custom indicator code that I want to include in my strategy generation. Unfortunately when I try to run the builder (v135.868) it eventually stops due to a ClassCastException. I’m sure I probably made a silly mistake in my custom code somewhere. However with the stacktrace I get from the SQ logs, I’m not really able to see where the problem is actually coming from. Is there anyway to get better visibility into what block is actually causing this issue? Sample stacktrace is below for reference. Thanks!
22:17:23.578 [Nonblocking computeThread – 2 – Builder_2] ERROR GPGenerationalEngine – Error
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Double (java.lang.Integer and java.lang.Double are in module java.base of loader ‘bootstrap’)
at SQ.Negater.ConditionsNegater.negate(ConditionsNegater.java:56) ~[na:na]
at com.strategyquant.tradinglib.NegatersList.negate(Unknown Source) ~[SQTradingLib.jar:na]
at SQ.Negater.AndOrNegater.negate(AndOrNegater.java:40) ~[na:na]
at com.strategyquant.tradinglib.NegatersList.negate(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.blocks.random.ReplacementsConfig.negateBlock(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.generator.StrategyGenerator.findAndReplaceNegatedBlocks(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.generator.StrategyGenerator.findAndReplaceNegatedBlocks(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.generator.StrategyGenerator.findAndReplaceNegatedBlocks(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.generator.StrategyGenerator.findAndReplaceNegatedBlocks(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.generator.StrategyGenerator.findAndReplaceNegatedBlocks(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.generator.StrategyGenerator.findAndReplaceNegatedBlocks(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.generator.StrategyGenerator.findAndReplaceNegatedBlocks(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.generator.StrategyGenerator.findAndReplaceNegatedBlocks(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.generator.StrategyGenerator.generate(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.gp.strategies.NodeFactory.generateStrategy(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.gp.strategies.NodeFactory.generateRandomCandidate(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.gp.strategies.NodeFactory.generateRandomCandidate(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.gp.GPGenerationalEngine.generateInitialPopulation(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.gp.GPGenerationalEngine.gpEvolution(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.gp.GPGenerationalEngine.evolve(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.gp.GPIslandJob.call(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.gp.GPIslandJob.call(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.gridlib.compute.performer.MultithreadComputePerformer$1.run(Unknown Source) ~[SQGridLib2.jar:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:832) ~[na:na]
Joshua
2 years ago #282692
I was able to figure out which signal block was causing the issue by disabling all of them, and then turning them on one at a time, until I found the one throwing the error.

tomas262
2 years ago #282711
Ok, thanks for letting us know
Viewing 2 replies - 1 through 2 (of 2 total)