Hi Laune !
I am using 5.4 version. When I tried ur second solution, it gives
*NullPointerException*.
Below is Stack trace and also please find my Rule file.....
*WARNING: Unhandled Exception thrown: class java.lang.NullPointerException
Jul 30, 2012 2:01:18 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet action threw exception
java.lang.NullPointerException
at
org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:451)
at org.drools.reteoo.ReteooRuleBase.addPackage(ReteooRuleBase.java:435)
at com.drools.facts.RuleRunner.loadRules(RuleRunner.java:71)
at com.drools.facts.RuleRunner.getStatefulSession(RuleRunner.java:227)
at com.drools.facts.RuleMain.main(RuleMain.java:43)
at com.drools.action.PolicyAction.execute(PolicyAction.java:25)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
*
laune wrote
Could you please post the exact code of your rule with solution #2 and
the NPE stack trace? You're using Drools 5.4.0?
This works with 5.4.0 - notice the "no-loop true". $sum has class
Number, this needs intValue() (or whatever) to match the parameter
type of the setter.
rule "accumulate Policy values into Agent"
no-loop true
when
$a: Agent( $id: id )
accumulate( Policy( agentId == $id, $v: value ); $sum: sum( $v ) )
then
modify( $a ){ setValue( $sum.intValue() ) }
System.out.println( $a.toString() );
end
On 30/07/2012, zeeshan <zeeshan.spring@> wrote:
> HI Laune,
>
> Thanks for ur solutions, first one working fine but* we want agentAPE
> value
> for other rules or atleast we want them on RuleMain.java*(where we create
> agent csv bean objects).
>
> Your second solution when we implemented was throwing NULL Pointer
> Exception.
>
> Laune can u suggest us way in which we can solve problem related to first
> solution
> and if possible can we move with second one.
>
>
> Thanks....
>
>
>
>
>
> --
> View this message in context:
>
http://drools.46999.n3.nabble.com/Using-global-variable-in-DRL-file-tp401...
> Sent from the Drools: User forum mailing list archive at
Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users@.jboss
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
rules-users@.jboss
https://lists.jboss.org/mailman/listinfo/rules-users
http://drools.46999.n3.nabble.com/file/n4018960/Sample.drl Sample.drl
--
View this message in context:
http://drools.46999.n3.nabble.com/Using-global-variable-in-DRL-file-tp401...
Sent from the Drools: User forum mailing list archive at
Nabble.com.