enabled attribute behavior (possible bug?)
by Philipp Herzig
Dear developers,
I've stumbled over another nullpointer exception when using the
enabled attribute in conjunction with deleting and adding rules to the
kbase.
For my test I have only one simple rule
rule 'newUser'
enabled(!RuleEngineConf.LOAD)
when
$evt : EventObject(type=='new_user') from entry-point eventstream
then
updateApi.createPlayer($evt.getPlayerid(), true, $evt.getId());
retract($evt);
Not I execute the following sequence
1. setting LOAD=false
2. insert a "new_user" event (works as expected, RHS called)
3. setting LOAD=true
4. insert another "new_user" event (works as expected, RHS NOT called)
5. setting LOAD=false
6. insert another "new_user" event (works as expected, RHS called,
which ends up having two new entities in my entity provider)
7. delete the "newUser" rule; ends up with the following stacktrace
java.lang.NullPointerException
at org.drools.reteoo.RuleTerminalNode$RTNCleanupAdapter.cleanUp(RuleTerminalNode.java:514)
at org.drools.reteoo.BetaNode.doRemove(BetaNode.java:458)
at org.drools.common.BaseNode.remove(BaseNode.java:109)
at org.drools.reteoo.RuleTerminalNode.doRemove(RuleTerminalNode.java:358)
at org.drools.common.BaseNode.remove(BaseNode.java:109)
at org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:261)
at org.drools.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:459)
at org.drools.common.AbstractRuleBase.removeRule(AbstractRuleBase.java:1107)
at org.drools.common.AbstractRuleBase.removeRule(AbstractRuleBase.java:1085)
at org.drools.impl.KnowledgeBaseImpl.removeRule(KnowledgeBaseImpl.java:208)
8. adding the rule again is followed by stacktrace
java.lang.NullPointerException
at org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:259)
at org.drools.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:459)
at org.drools.common.AbstractRuleBase.removeRule(AbstractRuleBase.java:1107)
at org.drools.common.AbstractRuleBase.mergePackage(AbstractRuleBase.java:851)
at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:610)
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:472)
at org.drools.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:150)
However, when I omit step 4., i.e., leaving no orphan event in the WM,
everything works fine, so obviously the ignored event is causing the
exception somehow, i.e., the object retrieved from the activation is
null (the clean up method seems to pickup the activation from the
leftTuple which is null)
Maybe I dont understand it correctly, then I would be happy if someone
explains the proper usage.
Thanks a lot in advance,
Philipp
12 years, 4 months
unable to resolve method using strict-mode
by larryc
Hello. We are attempting to migrate old 5.0.0 Guvnor rules to BRMS version
5.3. We keep running into variations of the following error:
[Error: unable to resolve method using strict-mode:
org.drools.spi.KnowledgeHelper.request()]
[Near : {... .addFieldToDocument(request, "ALL", "COVG_SR22_FEE ....}]
^ [Line: 5, Column: 37]
I've seen similar postings concerning "unable to resolve method..." but we
still haven't been able to figure out what's wrong. Here is the actual rule
from 5.0.0.
rule "VA SR22 Amount"
no-loop
ruleflow-group "default"
dialect "mvel"
when
request : FormRequest(
payload.policy.drivers != ""
&& != ( null ),
driver :
payload.policy.drivers.driver != "" && != ( null ),
payload.policy.ratingState
== "VA" )
drivers : ArrayList()
from collect( Driver( key != "",requiresSR22=="true") from driver)
then
int size = drivers.size();
for(int i =0; i < size; i++){
Driver dvr = drivers.get(i);
int drvNbr =
Integer.parseInt(dvr.getKey().substring(6));
DocumentHelper.addFieldToDocument(request, "ALL",
"COVG_SR22_FEE_AMT","$0.00");
}
End
Any help would be appreciated.
Thanks! --Larry
--
View this message in context: http://drools.46999.n3.nabble.com/unable-to-resolve-method-using-strict-m...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 4 months
Extracting data from strings(regular expression)
by abing19881226
Hi:
I am trying to match a string to my regular expression and then capture
certain groups from the string.
I know previously there is no such feature , but I am just wondering if
there is one now?
Basically , what am trying to do is, insert strings into the session, and
carry out the reasoning to see if matches a certain regular expression.
In JAVA I did it as this:
public double parsingZ4_Ph_Reach(String line){
String regx="3240, Z4 Ph. Reach, .*, (.*), ohm, .*, .*,
.*";
Pattern
p=Pattern.compile(regx,Pattern.CASE_INSENSITIVE);
Matcher m =p.matcher(line);
if(m.matches()){
return Double.parseDouble(m.group(1));
}
return 0;
}
The purpose is to extract the data in the strings using drools.
Could you please give me some idea I I could do that in Drools?
Many thx.
--
View this message in context: http://drools.46999.n3.nabble.com/Extracting-data-from-strings-regular-ex...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 4 months
Problem importing processes from one system to another
by David Shields OpenCDS
I have created a repository on my own computer (localhost:8080) which
contains a large number of rules and several processes, and exported it to a
file.
I then imported the file into a new remote server (edmopencdsdev:8081) that
is running on a different port: 8081 instead of 8080.
Guvnor seems to work correctly on the new server, except for one thing: It
bombs when I try to open a process that was created on my local machine. It
seems that there are references to the host on the original server stored
within the imported repository somewhere.
Am I doing something wrong, or is this a known issue? If so, is there a
work-around short of separately saving the BPMN2 files and importing each
one of them individually? I have attached a sample of one of the processes
that causes this issue, although all of the processes I have tried fail with
the same error message (shown below) in the logs.
05:57:04,945 INFO [org.apache.jackrabbit.core.TransientRepository]
(http--0.0.0.0-8081-3) Session opened
05:57:22,290 INFO [org.jbpm.designer.server.EditorHandler]
(http--0.0.0.0-8081-2) The diagram editor is running in production mode.
Javascript will be served compressed
05:57:33,587 INFO [org.jbpm.designer.server.EditorHandler]
(http--0.0.0.0-8081-2) Performing diagram information pre-processing steps.
05:57:33,618 ERROR
[org.jbpm.designer.web.preprocessing.impl.JbpmPreprocessingUnit]
(http--0.0.0.0-8081-2) http://localhost:8080/drools-guvnor/rest/packages/
05:57:33,618 INFO [stdout] (http--0.0.0.0-8081-2) Setting up default
workitem configuration
05:57:33,618 INFO [stdout] (http--0.0.0.0-8081-2) End setting up default
workitem configuration
05:57:34,493 ERROR [org.jbpm.designer.web.server.ServletUtil]
(http--0.0.0.0-8081-2) http://localhost:8080/drools-guvnor/rest/packages/
05:57:34,493 INFO
[org.jbpm.designer.web.preprocessing.impl.JbpmPreprocessingUnit]
(http--0.0.0.0-8081-2) Successfully deleted file
:C:\JBoss\jboss-as-7.1.1.Final\standalone\tmp\vfs\temp8d0d9283eb376a77\desig
ner.war-a884420b84204c5f\stencilsets/bpmn2.0jbpm/bpmn2.0jbpm.json
05:57:34,602 INFO
[org.jbpm.designer.web.preprocessing.impl.JbpmPreprocessingUnit]
(http--0.0.0.0-8081-2) Created
file:C:\JBoss\jboss-as-7.1.1.Final\standalone\tmp\vfs\temp8d0d9283eb376a77\d
esigner.war-a884420b84204c5f\stencilsets/bpmn2.0jbpm/bpmn2.0jbpm.json
05:57:38,040 ERROR
[org.jbpm.designer.web.repository.impl.UUIDBasedJbpmRepository]
(http--0.0.0.0-8081-1) Unable to connect to Gunvor. Is it running?
[http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/oryxeditor?uui
d=77827ae5-ce58-43d7-84f7-fe5785e5400f&usr=admin&pwd=admin]
05:57:38,587 ERROR [org.jbpm.designer.web.server.ServletUtil]
(http--0.0.0.0-8081-2) http://localhost:8080/drools-guvnor/rest/packages/
05:57:38,743 INFO [org.jbpm.designer.web.server.DictionaryServlet]
(http--0.0.0.0-8081-2) check connection response code: 404
Thanks for any help you can give.
-- des
12 years, 4 months
Marshalling/Unmarshalling KnowledgeBase/StatefulSession
by Paulo Reis
Hi guys,
Im having some issues with the time drools takes to build a knowledge base.
I have couple of pkgs that are compiled (something about 3mb) and drools takes almost 5s to give me the knowledge.
So I would like to know whether I could serialize the knowledge base on the database or even the stateful session that was built using the related knowledge. Is there any example that I could follow?
If you guys know other ways to improve the performance, please let me know.
Thanks in advance.
Paulo Reis
casmeiron(a)gmail.com
12 years, 4 months
Accessing FactField Metadata
by pcourtney
I have been able to access the FactType annotations by using
factType.getFactClass().getAnnotations(). However I cannot find any way to
access FactField annotations. Using a debugger I can see that the declared
type's field AnnotationDefinition is stored in the FieldDefinition but it is
not accessable via the FactField interface. Is there any way to access the
field annotations for DRL declared types? Will the 5.1.1 release fix the
problem (re JBRULES-2792)?
Thanks, Phil
--
View this message in context: http://drools.46999.n3.nabble.com/Accessing-FactField-Metadata-tp4019366....
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 4 months