NPE when using directory scanner and drl is incorrect. Possible bug! (Drools 4.0.7)
by Przemysław Różycki
Hi,
I think I found a bug.
When I use rule agent with directory scanner, and the rule that is being
scanned contains a bug, then I receive a NPE instead of error message:
java.lang.NullPointerException
at
org.drools.agent.FileScanner.readPackage(FileScanner.java:102)
at
org.drools.agent.FileScanner.getChangeSet(FileScanner.java:79)
at
org.drools.agent.FileScanner.loadPackageChanges(FileScanner.java:57)
at
org.drools.agent.DirectoryScanner.loadPackageChanges(DirectoryScanner.java:43)
at
org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:330)
at
org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:298)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:284)
at org.drools.agent.RuleAgent.init(RuleAgent.java:208)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:176)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:164)
... (further entries of stack trace contains my application's lines)
When I looked into code I found that DirectoryScanner object, used by
the agent uses FileScanner object to scan each file in a directory. And
the file scanner does not have a listener set. That's why the NPE is thrown.
It's difficult to find a bug in the rule.
I didn't find it in JIRA. If anyone knows, that it was reported, then I
won't duplicate, otherwise, I think it is worth to create a report.
Best regards,
--
Przemysław Różycki
AMG.net, A Bull Group Company
ul. Łąkowa 29
90-554 Łódź
www.amg.net.pl
17 years
How to get rid of the imports
by FlaviusVesp
Hello,
I am currently developing a project with intensive usage of Drools. Users
should write their rules in DSL, but I want to not burden them with writing
the right "import com.sample.my.own.Class;", because they shouldn't know
anything about my classes. They should know only the DSL I provide them
(they should be psychology teachers and so on, not the IT folk).
One solution is to fully qualify every usage of the class in DSL, but this
isn't a nice solution, because it will bloat the mapping.
I could provide the the imports and globals file separately, merge them with
some rules file and then load it into drools, but this would probably break
the ability to debug the rules in Eclipse (well, I am even not sure how it
is possible, but it works).
Has anyone provided some solution coded in drools? I can't find it.
Thanks for any reply.
--
View this message in context: http://www.nabble.com/How-to-get-rid-of-the-imports-tp22404890p22404890.html
Sent from the drools - user mailing list archive at Nabble.com.
17 years
how to use drools4 implements similar function like drools5M?
by 王磊
Hi
EveryBody,I want to write code like this in drools4,but I got a problem
that no class defined as FactType, how to refactor it ?
RuleAgent agent = RuleAgent.newRuleAgent("/rules.properties");
RuleBase rb = agent.getRuleBase();
//constructor a model ,
FactType appType = rb.getFactType("test.MerInfo");
Object merinfo = appType.newInstance();
appType.set(merinfo, "resp_code", "00");
appType.set(merinfo, "avg_amt", 5000.0);
StatelessSession ss = rb.newStatelessSession();
ss.execute(merinfo);
17 years
Strange exit in RuleFlow
by Femke De Backere
Hi!
I have a really strange problem with my ruleflow. I have a ruleflow
process with some workhandlers. The flow seems to work perfectly,
until I arrive at the timer. The timer itself executes well, if it
delays for a period of only 4 milliseconds. The flow stops running on
the join component (because I don't reach the workhandler CheckRass,
in the debugging).
If I give the timer a delay period of 1 minute (60 000
milliseconds), the flow stops running at the timer component. The
action nodes before and after the timer contain print statements and
in this case I never reach the printstatement after the timer.
I really don't understand why my flow stops running at these points,
as I never reach an end node. Does anyone see the problem? (I added a
printscreen of my ruleflow)
Thx!
Femke
If I
17 years
Literal representation for value objects
by David Boaz
Hi,
In my application we use few value objects. For example, Dates, Quantities
and Durations. These objects are immutable and have some behavior. For
example, comparing two quantities may involve quantity-conversion
computations (“2 foot” < “3 meter”).
In drools documentation I found an interesting example (section
6.5.2.1.1.3.2. Literal Restrictions, example 6.20):
Cheese( bestBefore < “27-Oct-2007”)
How Does the parser knows to create a Date object from that String? Does
Date has a ‘specialized’ behavior in drools? Is it possible to ‘plugin’
similar behavior for my value classes? How?
I’d like to achieve the following functionality:
Person(height < “2-meter”)
Thanks, David
--
View this message in context: http://www.nabble.com/Literal-representation-for-value-objects-tp22397729...
Sent from the drools - user mailing list archive at Nabble.com.
17 years
Agenda events in a Stateless session
by David Boaz
Hi all,
Im trying to listen to the events fired during the evaluation of a stateless
session. I implemented org.drools.event.rule.AgendaEventListener. The events
fire as expected. From the event I can extract the Activation, the Rule and
the list of FactHandles. Now, from each FactHandle I want to retrieve the
associated fact (Object). For that, I need a WorkingMemory. But the WM
doesn't participate in the event signature. In addition, since Im using a
stateless session, the working memory does not exist until I execute()
method.
Can you please help?
Thanks, David
--
View this message in context: http://www.nabble.com/Agenda-events-in-a-Stateless-session-tp22332020p223...
Sent from the drools - user mailing list archive at Nabble.com.
17 years
sequential execution mode throws an exception
by Michal Bali
Hi,
The sequential execution mode throws an exception when working with the new
API. It works fine with the old API.
I used the following configuration:
KnowledgeBaseConfiguration configuration =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
configuration.setOption(SequentialOption.YES);
This exception has been thrown:
java.lang.ArrayIndexOutOfBoundsException: -1
at org.drools.common.ArrayAgendaGroup.add(ArrayAgendaGroup.java:136)
at org.drools.common.DefaultAgenda.addActivation(DefaultAgenda.java:354)
at
org.drools.reteoo.RuleTerminalNode.assertLeftTuple(RuleTerminalNode.java:247)
at
org.drools.reteoo.RuleTerminalNode.assertLeftTuple(RuleTerminalNode.java:165)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:117)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:78)
at
org.drools.reteoo.LIANodePropagation.doPropagation(LIANodePropagation.java:47)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:671)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:659)
at
org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:213)
at com.sample.DroolsTest.main(DroolsTest.java:47)
For this rule:
rule "Hello World"
when
Message()
then
System.out.println( "test" );
end
Tested with snapshot from 7. Mar 2009
Best Regards,
Michal
17 years
Difference between join type XOR and Discriminator
by David Sinclair
Anyone give me a better explanation of the differences between these two
joins node types? Per the documentation
*XOR means that it continues if one of its incoming branches has been
completed.
**Discriminator means that it continues if one of its incoming branches has
been completed. *
Reading this, they seem to be the same thing.
thanks
17 years
Drools Flow, constraint parametrization
by Ricardo Gil Alcañiz
Hi,
I'm not a new drools user but I started to test rule flows (5.0M5) recently
and I'm stucked, so any clue will be welcomed :). I'm testing how to share a
StatefulKnowledgeSession between N rule flow instances. I'm trying to
parametrize each instance with process variables at start time but I don't
know how to use them from rule constraints (in event waits, splits, etc.).
I've read the documentation and I've found this text related to constraints
"Both rule and code constraints have access to globals that are defined for
the process and can reuse imports at the process level." I tried it
assigning (from an action) a variable value to a global variable but it's
not working for me. ¿I'm missing something?
Thanks in advance!
Ricardo.
17 years