[rules-users] How handle exception thrown while looping in DRL file
Hi, I ran enhanced for loop in .DRL file .Its looping perfectly but after completion of loop its throwing error mentioned as follows: *org.drools.runtime.rule.ConsequenceException: rule: Test Maadi at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029) at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:737) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:701) at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218) at com.sample.DroolsTest.main(DroolsTest.java:156) Caused by: java.lang.NullPointerException at com.sample.Rule_Test_Maadi_0.defaultConsequence(Rule_Test_Maadi_0.java:7) at com.sample.Rule_Test_Maadi_0DefaultConsequenceInvoker.evaluate(Rule_Test_Maadi_0DefaultConsequenceInvoker.java:27) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091) ... 6 more * -- View this message in context: http://drools.46999.n3.nabble.com/How-handle-exception-thrown-while-looping-in-DRL-file-tp4018727.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How handle exception thrown while looping in DRL file
Thanks for telling us. -W On 17/07/2012, ashwindrool ashwin.khandelwa...@gmail.com wrote: Hi, I ran enhanced for loop in .DRL file .Its looping perfectly but after completion of loop its throwing error mentioned as follows: *org.drools.runtime.rule.ConsequenceException: rule: Test Maadi at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029) at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:737) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:701) at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218) at com.sample.DroolsTest.main(DroolsTest.java:156) Caused by: java.lang.NullPointerException at com.sample.Rule_Test_Maadi_0.defaultConsequence(Rule_Test_Maadi_0.java:7) at com.sample.Rule_Test_Maadi_0DefaultConsequenceInvoker.evaluate(Rule_Test_Maadi_0DefaultConsequenceInvoker.java:27) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091) ... 6 more * -- View this message in context: http://drools.46999.n3.nabble.com/How-handle-exception-thrown-while-looping-in-DRL-file-tp4018727.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Counting events / fact condition not evalauted with accumulate
Dear contributors, this simple rule should trigger only when a critical amount of particular events was detected, though it seems to accept any event of this type, disregarding the fact condition (e.g. there is no single event that matches target == Long.MAX_VALUE). The current behaviour results in an unconstrained type match: LocalizationEvent(): // annotation for external event class declare LocalizationEvent @role( event ) @duration( dur ) @timestamp( time ) end // triggers on *any* LocalizationEvent, regardless of fact condition rule Detect crictial number of events when accumulate( // there is no matching event $ev: LocalizationEvent(type == TYPE.LEFT, target == Long.MAX_VALUE, area == Long.MAX_VALUE) over window:time(30s) from entry-point events/localization; $n : count( $ev ); $n 5 ) then System.out.println($n+ events detected ); end The KB is configured for stream processing, the events are inserted in a chronological order and the session pseudo clock is advanced accordingly. Drools version in use is 5.4.0. Any suggestions are appreciated! Many thanks Jaro -- View this message in context: http://drools.46999.n3.nabble.com/Counting-events-fact-condition-not-evalauted-with-accumulate-tp4018729.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How handle exception thrown while looping in DRL file
Thnks for Replying , Plz give some idea in above issue. -- View this message in context: http://drools.46999.n3.nabble.com/How-handle-exception-thrown-while-looping-in-DRL-file-tp4018727p4018730.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How handle exception thrown while looping in DRL file
You haven't asked any questions, merely stated you have an error message. Try posting some supporting code (DRL, related Java etc) it might help people. On 17 July 2012 10:03, ashwindrool ashwin.khandelwa...@gmail.com wrote: Thnks for Replying , Plz give some idea in above issue. -- View this message in context: http://drools.46999.n3.nabble.com/How-handle-exception-thrown-while-looping-in-DRL-file-tp4018727p4018730.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How handle exception thrown while looping in DRL file
Sorry Mike,Laune I am handling 100thousand records for that i am using CSV file and converting those records into objects which i am using for further calculation. According to my requirement i have loop array inside DRL file So i wrote following code in .java * agCsv.setPolCounterList(polCounterList); agCsv.setAgentList(agentListArray); // local block end for policy--- //firing all rules from here- ksession.fireAllRules(); //after firing rules destroying session object ksession.dispose(); * after this i am executing following rule DRL file *rule Loop Test salience 50 when $a:AgentCSVBean() then for(Integer agentList: $a.getAgentList()) { System.out.println(--sam=+agentList); } end* Now above loop execute absolutely well but after finishing loop it throws Error -- View this message in context: http://drools.46999.n3.nabble.com/How-handle-exception-thrown-while-looping-in-DRL-file-tp4018727p4018732.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How handle exception thrown while looping in DRL file
When you say the loop works fine, do the System.out's print what you expect? On 17 July 2012 10:34, ashwindrool ashwin.khandelwa...@gmail.com wrote: Sorry Mike,Laune I am handling 100thousand records for that i am using CSV file and converting those records into objects which i am using for further calculation. According to my requirement i have loop array inside DRL file So i wrote following code in .java * agCsv.setPolCounterList(polCounterList); agCsv.setAgentList(agentListArray); // local block end for policy--- //firing all rules from here- ksession.fireAllRules(); //after firing rules destroying session object ksession.dispose(); * after this i am executing following rule DRL file *rule Loop Test salience 50 when $a:AgentCSVBean() then for(Integer agentList: $a.getAgentList()) { System.out.println(--sam=+agentList); } end* Now above loop execute absolutely well but after finishing loop it throws Error -- View this message in context: http://drools.46999.n3.nabble.com/How-handle-exception-thrown-while-looping-in-DRL-file-tp4018727p4018732.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How handle exception thrown while looping in DRL file
Yes Mike, I am getting expected output but after completion of loop it throws error -- View this message in context: http://drools.46999.n3.nabble.com/How-handle-exception-thrown-while-looping-in-DRL-file-tp4018727p4018733.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How handle exception thrown while looping in DRL file
Add an if statement testing for a List element being null, e.g., for( Integer agentList: $a.getAgentList()) { if( agentList != null ){ System.out.println(--sam=+agentList); } else { System.out.println( null element in list ); } } -W On 17/07/2012, ashwindrool ashwin.khandelwa...@gmail.com wrote: Yes Mike, I am getting expected output but after completion of loop it throws error -- View this message in context: http://drools.46999.n3.nabble.com/How-handle-exception-thrown-while-looping-in-DRL-file-tp4018727p4018733.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How handle exception thrown while looping in DRL file
Thnks Laune for ur reply but i tried that condition part even than also its coming up with same error -- View this message in context: http://drools.46999.n3.nabble.com/How-handle-exception-thrown-while-looping-in-DRL-file-tp4018727p4018736.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How handle exception thrown while looping in DRL file
Add println() before and after the for(){...} statement. What is the output? How many AgentCSVBean() are inserted? Could one of these have a field agentLsit that is null? -W On 17/07/2012, ashwindrool ashwin.khandelwa...@gmail.com wrote: Thnks Laune for ur reply but i tried that condition part even than also its coming up with same error -- View this message in context: http://drools.46999.n3.nabble.com/How-handle-exception-thrown-while-looping-in-DRL-file-tp4018727p4018736.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How handle exception thrown while looping in DRL file
Hi Laune, I do wht u asked me, I added print statement before and after for loop * System.out.println(Before); for(Integer agentList: $a.getAgentList()) { System.out.println(-==-); if($a.getAgentList() != null ){ System.out.println(--sam=+agentList); } else{ System.out.println(null); } } System.out.println(after);* Before is getting printed twice and After only once.Then it prints Error message which i mentioned in catch block from where i called rule in java. in following order message getting printed * before list of data after before error* /im printing 128thousand records/ * No their is no null field in given records... * -- View this message in context: http://drools.46999.n3.nabble.com/How-handle-exception-thrown-while-looping-in-DRL-file-tp4018727p4018738.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How handle exception thrown while looping in DRL file
On 17/07/2012, ashwindrool ashwin.khandelwa...@gmail.com wrote: Hi Laune, I do wht u asked me, I added print statement before and after for loop Before is getting printed twice and After only once. Like this Before Before After ---Error message--- Please be more specific. Add another if statement before the for statement testing whether if( $a.getAgentList() == null ){ System.out.println( List is null ); } Then it prints Error message which i mentioned in catch block from where i called rule in java. in following order message getting printed * before list of data after before error* /im printing 128thousand records/ * No their is no null field in given records... * -- View this message in context: http://drools.46999.n3.nabble.com/How-handle-exception-thrown-while-looping-in-DRL-file-tp4018727p4018738.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How handle exception thrown while looping in DRL file
HI Laune , I did required changes in code by adding if condition before for loop *System.out.println(Before); if($a.getAgentList() != null ){ System.out.println(--samee=); } for(Integer agentList: $a.getAgentList()) { System.out.println(-==-); if($a.getAgentList() != null ){ System.out.println(--sam=+agentList); } else{ System.out.println(null); } } System.out.println(after);* Now Execution order is f*irst Before is getting printed thn Same followed by = *after Before err** -- View this message in context: http://drools.46999.n3.nabble.com/How-handle-exception-thrown-while-looping-in-DRL-file-tp4018727p4018740.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How handle exception thrown while looping in DRL file
Is this exactly (!) what you have in your rule, between 'when' and 'then'? when $a:AgentCSVBean() then -W On 17/07/2012, ashwindrool ashwin.khandelwa...@gmail.com wrote: HI Laune , I did required changes in code by adding if condition before for loop *System.out.println(Before); if($a.getAgentList() != null ){ System.out.println(--samee=); } for(Integer agentList: $a.getAgentList()) { System.out.println(-==-); if($a.getAgentList() != null ){ System.out.println(--sam=+agentList); } else{ System.out.println(null); } } System.out.println(after);* Now Execution order is f*irst Before is getting printed thn Same followed by = *after Before err** -- View this message in context: http://drools.46999.n3.nabble.com/How-handle-exception-thrown-while-looping-in-DRL-file-tp4018727p4018740.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Planner changing problem fact
last month, Ralph wrote: /All the examples in the drools-planner-examples seem to have a fixed list of problem facts (rooms, teachers, timeslots) which only should be combined optimally./ Just to address this one unanswered point. The Cloud Balancing example does support changing the problem facts, specifically by removing computers (bins). The last section of the planner documentation (section 12.4) addresses realtime planning, through the Solver.addProblemFactChange() API. This works whether you are removing problem facts (as the example shows) or modifying their contents. This generally restarts the Solver -- but, if you are relatively optimized, the adjustment is found relatively fast. (I'm curious, though -- does the Solver expressly prioritize doing moves associated with those problem facts that were just changed?) -- View this message in context: http://drools.46999.n3.nabble.com/Drools-Planner-changing-problem-fact-tp4018087p4018742.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] DSL translatio problem for !ucfirst under 5.1.1
I have solved this problem before, and think it is a JAR issue, but can't seem to remember which JAR solves my problem. The DSL sentence [consequence][]Set {field} of {object} to {value}={object}.set{field!ucfirst}({value}); is not working since !ucfirst is being ignored. I am using 5.1.1 because of a reoccurring bug with the in-place DSL editor of more recent versions of DROOLS (there are JIRA's opened, closed, reopened and commented on the bug.) What JAR would I have wrong or be missing that causes !ucfirst to not be processed, ie converting {field} to its setter? Thanks! -- View this message in context: http://drools.46999.n3.nabble.com/DSL-translatio-problem-for-ucfirst-under-5-1-1-tp4018743.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] DSL translatio problem for !ucfirst under 5.1.1
IIRC I invented the ! modifiers for the DSLR substitution while Drools was moving towards 5.2.0. I'm not sure whether these classes could be used in an earlier context, but the changes were quite local to the DSL/R context. -W On 17 July 2012 20:58, drdaveg drda...@gmail.com wrote: I have solved this problem before, and think it is a JAR issue, but can't seem to remember which JAR solves my problem. The DSL sentence [consequence][]Set {field} of {object} to {value}={object}.set{field!ucfirst}({value}); is not working since !ucfirst is being ignored. I am using 5.1.1 because of a reoccurring bug with the in-place DSL editor of more recent versions of DROOLS (there are JIRA's opened, closed, reopened and commented on the bug.) What JAR would I have wrong or be missing that causes !ucfirst to not be processed, ie converting {field} to its setter? Thanks! -- View this message in context: http://drools.46999.n3.nabble.com/DSL-translatio-problem-for-ucfirst-under-5-1-1-tp4018743.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools-Guvnor integration with Webshere- Exception during startup...Please help!!!
Hi, I am deploying drools-guvnor.war (version 5.3.0) into Websphere AS 7. The war file was working perfectly fine in JBoss AS 7. But i am getting below exception when launching the guvnor from browser... [18/07/12 12:09:02:101 SGT] 0032 SystemOut O ERROR 18-07 12:09:02,101 (LoggingHelper.java:error:74) Service method 'public abstract org.drools.guvnor.client.rpc.UserSecurityContext org.drools.guvnor.client.rpc.SecurityService.getCurrentUser()' threw an unexpected exception: java.lang.IllegalStateException: CDI hasn't been properly started. Make sure your IDE classpath is in sync with the real maven classpath. The classpath should include weld-servlet. java.lang.IllegalStateException: CDI hasn't been properly started. Make sure your IDE classpath is in sync with the real maven classpath. The classpath should include weld-servlet. at org.drools.guvnor.server.SecurityServiceServlet.getCurrentUser(SecurityServiceServlet.java:66) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:599) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248) at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62) at javax.servlet.http.HttpServlet.service(HttpServlet.java:738) at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1663) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502) at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3826) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931) at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:445) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:504) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:301) at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1563) [18/07/12 12:09:02:101 SGT] 0032 webappI com.ibm.ws.webcontainer.webapp.WebApp log SRVE0296E: [drools-guvnor_war#drools-guvnor.war][/drools-guvnor][Servlet.LOG]:.Exception while dispatching incoming RPC call:.com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract org.drools.guvnor.client.rpc.UserSecurityContext org.drools.guvnor.client.rpc.SecurityService.getCurrentUser()' threw an unexpected exception: java.lang.IllegalStateException: CDI hasn't been properly started. Make sure your IDE classpath is in sync with the real maven classpath. The classpath should include weld-servlet. at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248) at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62) at javax.servlet.http.HttpServlet.service(HttpServlet.java:738) at