Drools 5.2.0-SNAPSHOT: NullPointerException in PatternBuilder#build
by ljnelson
See https://issues.jboss.org/browse/JBRULES-2932.
Stack:
Caused by: java.lang.NullPointerException
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:323)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:268)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:107)
at
org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:65)
at
org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:39)
at
org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:65)
at
org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:39)
at
org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:65)
at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:80)
at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:1313)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:664)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:310)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:483)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
This is on a (monstrous) rules file that has compiled fine for months under
5.1.1 and under earlier 5.2.0-SNAPSHOT versions.
Best,
Laird
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-5-2-0-SNAPSHOT...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months
Drools 5.2.0-SNAPSHOT: .drl broken?
by ljnelson
My rule that I'm using in unit testing only looks like this:
rule "Testing contains"
dialect "mvel"
when
Response( $answerSelections : answerSelections )
AnswerSelection( answer.ID in (2, 3) )
then
System.out.println("Testing contains activated")
end
Response has a getAnswerSelections() method. AnswerSelection has a
getAnswer() method. Answer has a getID() method.
During rule compilation, I get the following error:
Unable to Analyse Expression answer.ID == 2 || answer.ID == 3:
[Error: Failed to compile: 1 compilation error(s):
- (1,9) unqualified type in strict mode for: ID]
[Near : {... Unknown ....}]
^
[Line: 1, Column: 0] : [Rule name='Testing contains']
If I rewrite the rule using "||" explicitly I get the same error.
This didn't happen under 5.1.1.
I'm aware that 5.2.0-SNAPSHOT is a...um...work in progress. :-) But the
DRL compilation has worked up till now. Is my rule syntax OK? Do I just
need to wait?
Best,
Laird
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-5-2-0-SNAPSHOT...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months
Drool Tutorial
by Heng hh
Hi all
I m new comer in drools. Can some one help me on this?
thanks and best regards
Heng
13 years, 9 months
Sliding windows and event retraction
by jwillans2
Hello,
I am using sliding windows in the form:
Obj(..) over window:length(1) from entry-point EP1
Where many events are being inserted into EP1. Reading the documentation I
expected Drools to infer from the window length that all events on EP1 apart
from the latest one can be retracted, is this correct? The reason I ask is
that I am not seeing retraction of events from EP1 when I debug the session,
and I am see behaviour which suggests the rule is firing against old events
on the entry point.
Basically I want to get to simulate that an entry point can only contain one
event at any point in time and that this event is the latest one to arrive.
Thanks,
James
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Sliding-windows-and-e...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months
Configure custom SystemEventListener via Drools Spring
by Steven Williams
Hi,
I have just started using the drools-spring integration (5.1.1) and I would
to use my own SystemEventListener instead of the default
PrintStreamSystemEventListener however I am not sure if it is possible or
how to configure it.
thanks
Steve
13 years, 9 months
WorkflowProcessInstance in DRL
by Gareth Evans
Hello,
I am having some problems using WorkflowProcessInstance in rules. I
have searched and not been able to find an answer to my question.
I am attempting to use rule flows to define business processes and
rules both in ruleflow groups to be executed on demand of the process
and outside of a ruleflow group for "global" rules and to potentially
direct the ruleflow(/process) is to run. Many of these processes are
comprised of subprocesses which I have been using sub flows to model.
I have used flow variables to store some minimal information about the
process such as what the process ID corresponds to in the existing
data model I am working with. My intent was so that I could use a
single rule flow group in many rule flows to extract information from
the database for the corresponding process ID in the working memory
(this extraction would also depend on other facts in the working
memory).
I've inserted the WorkflowProcessInstance by using an action node in
the "parent" process and it seems to work fine. My problem arises when
I am then in a "child" process/subflow and try to invoke this single
rule flow group with a different process ID in the flow variable,
there are no activations. I think this happens because the
WorkflowProcessInstance has not been updated in working memory so it
will not know that there might be a new process ID stored in the flow
variable (it has the same name in both flows as it is meant to
represent the same thing).
If I insert the WorkflowProcessInstance again in the sub flow I get
activations in the rule flow group for facts in the working memory
associated with both the parent and child sub flow which almost makes
sense except for this:
"We have added special logic to make sure that a variable
processInstance of type WorkflowProcessInstance will only match to the
current process instance and not to other process instances in the
Working Memory."
It seems that it is matching both instances of
WorkflowProcessInstance. I use the convention of starting variable
names from the LHS of a rule with a $ but I have tested it without and
I get the same result. Is this expected behaviour?
An alternative I've been trying to figure out is how to update the
WorkflowProcessInstance in working memory in the child process. Since
it is actually a different object I'm unsure how to do this. Should I
retract all instances and then insert the current? Is there a way to
do this more cleanly than looking through all working memory objects
and checking their type in an action node?
Finally (or perhaps firstly...), am I going about this correctly?
Cheers,
Gareth
13 years, 9 months
DSL parsing in 5.2 and GUI hints
by drdaveg
I have posted a few times about domain specific languages and have a few
issues for users and
dev that seem of widespread interest.
1. The 5.2 document has less than one sentence on "hints for the gui
editor." Could someone describe what these hints are and their syntax
(i.e., {::}? Or to tie into the current object (none of the example utilize
the "object" field of DSL sentences)?
2. Some of the things I have noticed as bugs have been getting cleared up on
a daily basis. What is the best way to document a "bug" for the group? Does
the staff want JIRA's, or an email to someone first (after the JIRA's have
been searched)?
I would be happy to help test the Eclipse integration and can do some coding
for it. Thanks!
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/DSL-parsing-in-5-2-an...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months
Unknown process ID error.
by smolnij
Hello gentlemen
After the migration to from 407 to 501 drools, I opened in eclipse all old
ruleflows and eclipse converted them to the new format. After I uploaded it
to guvnor, I was able to compile one of my packages, but when I call drools
session.execute method, I get the following error:
java.lang.IllegalArgumentException: Unknown process ID:
conf.ConnectorSelection_Rule_Flow.rf
13:30:37,620 ERROR [STDERR] at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1635)
I opened the ConnectorSelection_Rule_Flow.rf file, converted to new format
and found in the very beginning:
<?xml version="1.0" encoding="UTF-8"?>
As you can see, the id I have is id="conf.ConnectorSelection_Rule_Flow.rf",
but it was recognized by drools as invalid.
Can I ask why? What will be the valid id? What should it represent or refer
to?
What should I do to run my code?
Actually I able to see the file ConnectorSelection_Rule_Flow.rf in JCR repo.
Where can I find the documentation how to manage such problem?
Here is the simplified code I use:
Collection ruleFactList = RuleUtils.getRuleFactList();
RuleBase ruleBase = RuleUtils.getRuleBase();
//we have already downloaded rule package BLOB in rule base
StatelessSession jbSession = ruleBase.newStatelessSession();
jbSession.execute(ruleFactList);
Here is the full stacktrace I get:
13:28:51,371 INFO [STDOUT] Sending Message to ShoppingRulesTopic
13:28:51,372 INFO [STDOUT] Before calling sendMessage(rulepackage)
13:28:51,373 INFO [STDOUT] In sendmessage method - begin
13:28:52,987 INFO [STDOUT] In receiveMessage method of
ManagementRulesJmsReceiver
13:28:52,999 INFO [STDOUT] In publish package method of Management rules
msg listner
13:28:53,049 INFO [STDOUT] In sendmessage method - end
13:28:53,050 INFO [STDOUT] After calling sendMessage(rulepackage)
13:30:37,617 ERROR [STDERR] org.drools.runtime.rule.ConsequenceException:
rule: startconnectorselectionRF
13:30:37,617 ERROR [STDERR] at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
13:30:37,617 ERROR [STDERR] at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:927)
13:30:37,617 ERROR [STDERR] at
org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:856)
13:30:37,617 ERROR [STDERR] at
org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1071)
13:30:37,617 ERROR [STDERR] at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:785)
13:30:37,618 ERROR [STDERR] at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:761)
13:30:37,618 ERROR [STDERR] at
org.drools.reteoo.ReteooStatelessSession.execute(ReteooStatelessSession.java:225)
13:30:37,618 ERROR [STDERR] at
com.octopus.rules.impl.BaseRuleExecutorImpl.executeConnectorSelectionRule(BaseRuleExecutorImpl.java:294)
13:30:37,618 ERROR [STDERR] at
com.octopus.rules.impl.ShoppingSearchRuleFlowImpl.executeSupplierSelectionRule(ShoppingSearchRuleFlowImpl.java:1329)
13:30:37,618 ERROR [STDERR] at
com.octopus.shopping.search.service.ShoppingServiceImpl.applySupplierSelectionRule(ShoppingServiceImpl.java:2529)
13:30:37,618 ERROR [STDERR] at
com.octopus.shopping.search.service.ShoppingServiceImpl.searchDestinationService(ShoppingServiceImpl.java:254)
13:30:37,618 ERROR [STDERR] at
com.octopus.shopping.search.delegate.impl.SearchPropertyDelegateImpl.searchAvailableHotels(SearchPropertyDelegateImpl.java:50)
13:30:37,618 ERROR [STDERR] at
com.octopus.shopping.controller.SearchPropertyController.onSubmit(SearchPropertyController.java:955)
13:30:37,618 ERROR [STDERR] at
org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:267)
13:30:37,618 ERROR [STDERR] at
org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:250)
13:30:37,618 ERROR [STDERR] at
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
13:30:37,618 ERROR [STDERR] at
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
13:30:37,618 ERROR [STDERR] at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:857)
13:30:37,618 ERROR [STDERR] at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
13:30:37,618 ERROR [STDERR] at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:475)
13:30:37,618 ERROR [STDERR] at
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:440)
13:30:37,618 ERROR [STDERR] at
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
13:30:37,618 ERROR [STDERR] at
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
13:30:37,618 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
13:30:37,618 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
13:30:37,618 ERROR [STDERR] at
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
13:30:37,618 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
13:30:37,618 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
13:30:37,618 ERROR [STDERR] at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
13:30:37,618 ERROR [STDERR] at
org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
13:30:37,618 ERROR [STDERR] at
org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
13:30:37,618 ERROR [STDERR] at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
13:30:37,618 ERROR [STDERR] at
org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:124)
13:30:37,618 ERROR [STDERR] at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
13:30:37,619 ERROR [STDERR] at
org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
13:30:37,619 ERROR [STDERR] at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
13:30:37,619 ERROR [STDERR] at
org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
13:30:37,619 ERROR [STDERR] at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
13:30:37,619 ERROR [STDERR] at
org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
13:30:37,619 ERROR [STDERR] at
org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
13:30:37,619 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
13:30:37,619 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
13:30:37,619 ERROR [STDERR] at
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
13:30:37,619 ERROR [STDERR] at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
13:30:37,619 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
13:30:37,619 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
13:30:37,619 ERROR [STDERR] at
com.octopus.common.filter.SessionInitializationFilter.doFilter(SessionInitializationFilter.java:57)
13:30:37,619 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
13:30:37,619 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
13:30:37,619 ERROR [STDERR] at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
13:30:37,619 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
13:30:37,619 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
13:30:37,619 ERROR [STDERR] at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
13:30:37,619 ERROR [STDERR] at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
13:30:37,619 ERROR [STDERR] at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
13:30:37,619 ERROR [STDERR] at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
13:30:37,619 ERROR [STDERR] at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
13:30:37,619 ERROR [STDERR] at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
13:30:37,619 ERROR [STDERR] at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
13:30:37,619 ERROR [STDERR] at
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
13:30:37,619 ERROR [STDERR] at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
13:30:37,619 ERROR [STDERR] at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
13:30:37,619 ERROR [STDERR] at
org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
13:30:37,619 ERROR [STDERR] at
org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:381)
13:30:37,619 ERROR [STDERR] at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
13:30:37,619 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
13:30:37,620 ERROR [STDERR] Caused by: java.lang.IllegalArgumentException:
Unknown process ID: conf.ConnectorSelection_Rule_Flow.rf
13:30:37,620 ERROR [STDERR] at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1635)
13:30:37,620 ERROR [STDERR] at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1622)
13:30:37,620 ERROR [STDERR] at
connectorselectionrules.Rule_startconnectorselectionRF_0.defaultConsequence(Rule_startconnectorselectionRF_0.java:8)
13:30:37,620 ERROR [STDERR] at
connectorselectionrules.Rule_startconnectorselectionRF_0DefaultConsequenceInvoker.evaluate(Rule_startconnectorselectionRF_0DefaultConsequenceInvoker.java:24)
13:30:37,620 ERROR [STDERR] at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:917)
13:30:37,620 ERROR [STDERR] ... 64 more
Thanks
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Unknown-process-ID-er...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months
Re: [rules-users] [rules-dev] DRL - Local objects
by Felipe Piccolini
Adhir,
Im facing the same challenge using rules in a ETL process where
performance is a main concern (some millisecs do the different when you have
millions of executions), so I'm using Globals to keep data in the session.
You can add a global object as a global variable in the session scope and
all
the rules will have access to it in conditions and actions.
MyHelperClass helper = new MyHelperClass();
StatelessKnowledgeSession statelessSession =
kb.newStatelessKnowledgeSession();
if (statelessSession == null){
log.error("Session was not created.");
return;
}
statelessSession.setGlobal("myHelper", helper);
In the DRL you import the class and define the global. You can also define
some static (or not) methods in the helper class to assit you and use them
as functions in your rules (if used as functions, methods needs to be
static, if no static, then they can be used as methods of the global
instance in
the consequence block)
import com.mycompany.rules.helpers.MyHelperClass;
import function
com.mycompany.helpers.MyHelperClass.SOME_FUNCTION;
global com.emycompany.helpers.MyHelperClass helper;
This solution is not ideal, because you relay on java classes (code outside
of the rules and RETE) to perform evaluations (functions with evals in
conditions) and
the consequence hide some code in java classes, which is not so good because
one of the main features of a rule engine is the separation of the logic
from the
static code... but it works and it helps sometimes.
Good luck.
On Wed, Mar 23, 2011 at 7:55 AM, Adhir Mehta <adhirmehta21(a)gmail.com> wrote:
> Thanks for the reply.
>
> I think I was not up to the point. Modifying facts re-executes the rules to
> maintain the truth. In my case, I want to pass the data between the rules
> and also do not want rules to execute again. I know if no-loop option is
> specified, it will not be re-executed however I do not want rule engine to
> even go & check for no-loop option (which is additional work).
>
> I may be wrong as I am new to drools.
>
> Thanks,
> Adhir
>
>
> On Wed, Mar 23, 2011 at 11:48 AM, Mark Proctor <mproctor(a)codehaus.org>wrote:
>
>> On 23/03/2011 05:46, Adhir Mehta wrote:
>>
>> Hi,
>>
>> I have written the rule DRL file having around 30 rules in it. Some of
>> the rules do intermediate calculation and those calculation result is
>> expected in the other rules in same DRL file. I can do this by modifying the
>> facts objects in one rule and get the value in other rule. However,
>> modifying the facts object rebuild the RETE tree and affects the
>> performance. Is there any way by which I can pass the data across the rules
>> in same DRL file without rebuilding the RETE tree. (I am more concerned
>> about the performance)
>>
>> Please continue this conversation on the USER mailing list
>> http://www.jboss.org/drools/lists.html
>>
>> Modifying facts does not rebuild the rete. Adding/Removing rules causes
>> changes to Rete tree.
>>
>>
>> Thanks,
>> Adhir
>>
>>
>> _______________________________________________
>> rules-dev mailing listrules-dev@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-dev
>>
>>
>>
>> _______________________________________________
>> rules-dev mailing list
>> rules-dev(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-dev
>>
>>
>
> _______________________________________________
> rules-dev mailing list
> rules-dev(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>
--
-----------------------------
Felipe Piccolini
felipe.piccolini(a)gmail.com
13 years, 9 months