[rules-users] From accumulate compilation error : java.Math.BigDecimal cannot be resolved to a type

Andy Mei andy.d.mei at gmail.com
Fri Nov 16 10:44:18 EST 2007


Hi,

  I am getting compilation error when I tried to use
java.Math.BigDecimal object within from accumulate clause.  I am not
sure why Drools does not regonize full qualify namespaces for
BigDecimal.

  Here is my LHS:

>$netDailyPnl : Number ( )
>	from accumulate ( Position ( secId == $pos.secId, $baseRealizedPnl :
baseRealizedPnl, $baseUnrealizedPnl : baseUnrealizedPnl ),
>			init ( java.Math.BigDecimal netDailyPnl = new java.Math.BigDecimal ( 0 ); ),
>			action ( netDailyPnl.add($baseRealizedPnl);
netDailyPnl.add($baseUnrealizedPnl); ),
>			reverse ( ),
>			result ( netDailyPnl )
>		      )

  Here is compilation log:

Caused by: org.drools.compiler.DroolsParserException: Rule Compilation
error : [Rule name=Extreme Single Position (TID) PL Movement,
agendaGroup=MAIN, salience=43, no-loop=false]
	com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java
(12:370) : java.Math.BigDecimal cannot be resolved to a type
	com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java
(21:557) : netDailyPnl cannot be resolved
	com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java
(21:575) : java.Math.BigDecimal cannot be resolved to a type
	com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java
(31:1030) : netDailyPnl cannot be resolved
	com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java
(31:1065) : netDailyPnl cannot be resolved
	com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java
(47:1667) : netDailyPnl cannot be resolved

	at com.trg.ruleengine.util.RuleBaseBuilder.readRule(RuleBaseBuilder.java:104)
	at com.trg.ruleengine.impl.DroolsRuleEngineBuilder.getRuleBase(DroolsRuleEngineBuilder.java:109)
	... 10 more

  Thanks!

Andy



More information about the rules-users mailing list