Guvnor only: NullPointerException AfterEvaluator.evaluateCachedRight
by kappert
Version 5.5.0.Final (Guvnor and libraries)
We are seeing the NPE with the stack trace given below, but only when
loading rules through Guvnor. Same rules file and code runs fine without
Guvnor, but error with Guvnor.
*With Guvnor:* KnowlegdeBase from KnowledgeAgent using changeset.xml,
scanner running for on-the-fly rule updates in Guvnor.
*Without Guvnor:* kbuilder.add(new ClassPathResource("Rules.drl",
getClass()), ResourceType.DRL);
I have only little experience with Drools and would appreciate advice on how
to approach this problem.
Could it be something in the rules file itself?
But why would it make a difference whether the rules came from Guvnor or a
file?
Could the error point to something missing from the POJO model in Guvnor? I
am still in the process of determining what should go in the JAR file
exported from Eclipse and what not. The rules validate OK in Guvnor though,
and the package can be built.
What else to consider?
A similar problem was discussed here
<http://thread.gmane.org/gmane.comp.java.drools.user/15285> , but the
solution seems to have been an upgrade to version 5.
Unexpected exception caught: null
java.lang.NullPointerException
at
org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.evaluateCachedRight(AfterEvaluatorDefinition.java:322)
at
org.drools.rule.constraint.EvaluatorConstraint.isAllowedCachedRight(EvaluatorConstraint.java:80)
at
org.drools.common.TripleBetaConstraints.isAllowedCachedRight(TripleBetaConstraints.java:101)
at org.drools.reteoo.JoinNode.propagateFromRight(JoinNode.java:156)
at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:148)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-only-NullPointerException-AfterE...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months
Purpose of difficultyWeightFactoryClass in @PlanningEntity annotation.
by Michiel Vermandel
Hi,
I am struggling with the purpose of difficultyWeightFactoryClass in the @PlanningEntity annotation.
I thought it was used to indicate which PlanningEntities to handle first in order to get faster to a solution.
Though it seems that it also has impact on whether or not to get to a zero-hardscore solution.
I mean I have a testcase that resolves to a zero-hardscore solution.
Then I change something small in how the difficultyWeightFactoryClass calculates the weight and all the sudden I get a negative-hardscore solution.
I thought it would still get to the same zero-hardscore solution but in a shorter solving time.
My solver termination is as follows:
<termination>
<terminationCompositionStyle>OR</terminationCompositionStyle>
<maximumSecondsSpend>3600</maximumSecondsSpend>
<scoreAttained>0hard/0soft</scoreAttained>
</termination>
and constructionHeuristic:
<constructionHeuristic>
<constructionHeuristicType>BEST_FIT_DECREASING</constructionHeuristicType>
</constructionHeuristic>
I do not reach a zero-hardscore and the time spent is about 2.8 seconds...
If I read the best solution I get:
.isEveryProblemFactChangeProcessed(): true
.isTerminateEarly(): false
Any idea why I do not get a zero-hardscore solution anymore when only making a small change to the difficultyWeightFactoryClass logic?
Thanks
Michiel.
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
11 years, 10 months
How do you use packages in Guvnor?
by dunnlow
I've been using Guvnor for a while (on v5.4) now. However, I've always had
everything in one "package." As my project grows however I am looking to
improve the organization of my assets - it is getting harder and harder for
me to find in Guvnor the rule I am looking for. As I looked into this it
occurred to me that I don't really understand the concept/purpose of a
package.
For example, I have a main package, "Auto" that contains generic
rules/assets for automobiles. I have assets specific to types of autos, so
I created packages "Auto.Compact" and "Auto.Sedan". Those packages are
created neatly under the Auto Package. However, when I looked at the source
for Auto, I expected to see the source for assets in Auto, Auto.Compact and
Auto.Sedan, but it only contains the source for Auto (rather than having
them rolled up).
I'm a java developer, so I expected the same sort of "package"
functionality; all of the sub packages being contained within the main
package.
FYI, I have a drools server that connects to Guvnor to obtain/create the
most recent rule base.
I have Drools Dev Cookbook, and looked through the online guide, but didn't
really find anything to help.
Can anyone explain to me the purpose/intention of a package (or point me to
some good documentation about it).
Any best practices out there on how to organize assets.
Thanks very much,
-J
--
View this message in context: http://drools.46999.n3.nabble.com/How-do-you-use-packages-in-Guvnor-tp402...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months
Fwd: Retrieving constraints based on a manual solution
by Sreeni Maheshwaram
>
> Hi,
>
> Could you please advise:
>
> I am using the Drools Planner (5.5) to a) optimize the solution and get
> best
> solution b) allow the manual solution and resolve the conflicts, based on
> the business requirement.
>
> 1. scenario a is straight forward. I could run the solver, get the best
> solution, set it to the ScoreDirector as working solution, get the
> constraints from the working memory.
>
> 2. in scenario b, I do not want to run the solver for best solution. When I
> set the manual solution as a working solution on the ScoreDirector, I could
> not get the constraints.
>
> As a work around, either I have to run the solver in scenario b for some
> time to get the constraints, which I can not afford and I do not think the
> constraints relate to the manual solution.
>
> Is there a way to get cosntraints based on the manual solution without
> running the solver?
>
> regards,
> Sreeni
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Retrieving-constraints-based-on-a-manua...
> Sent from the Drools: User forum mailing list archive at Nabble.com.
>
>
--
Thanks, Sreeni M
--
Thanks, Sreeni M
11 years, 10 months
unmarshal global variable
by acormond
Gentlepeople,
I am fairly new to Drools and have what I hope is a simple question. I am
attempting to marshal (serialize) a Drools knowledge session and then
unmarshall it. The marshalling works but the unmarshalling fails with a
null pointer exception. The error is apparently with unmarshalling a global
variable in the session.
The session is created from a spreadsheet (decision table). This
spreadsheet
has two RuleTables. The first of these exists solely so that I can enter
some
constants into the session, specifically the name and price of the product
the
spreadsheet is dealing with. The second ruletable is where the rules are
specified. The exception occurs when unmarshalling the first rule in the
first
rule table. If, as a test, I eliminate the first rule table, then I can
successfully marshal and unmarshall the session.
The marshalling is done using the following, simplified, code:
Marshaller marshaller = MarshallerFactory.newMarshaller(kbase);
File droolsSessionFile = new File(MARSHAL_FILE);
foStream = new FileOutputStream(droolsSessionFile);
baos = new ByteArrayOutputStream();
marshaller.marshall(baos, ksession);
baos.writeTo(foStream);
and the unmarshalling is done like this:
Marshaller marshaller =
MarshallerFactory.newMarshaller(pricingProcessor.getKnowledgeBase());
FileInputStream fis = new FileInputStream(MARSHAL_FILE);
StatefulKnowledgeSession ksession = marshaller.unmarshall(fis);
So, where did I go wrong? Perhaps I need to deal with the global variable
differently, perhaps by putting it in the knowledgeBase before I unmarshall
the session?
Thank you for any help.
Alex Ormond
--
View this message in context: http://drools.46999.n3.nabble.com/unmarshal-global-variable-tp4021375.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months
Correlating 2 independent streams of events
by Esteban Aliverti
Let's say I have two independent streams of different events: EventA and
EventB. Which is the best way to get all the occurrences of EventB that
happened between the last 3 occurrences of EventA?
For example:
from:
$b1:EventB, $a1:EventA, $b2:EventB, $b3:EventB, $a2:EventA,
$b4:EventB, $b5:EventB, $a3:EventA, $b6:EventB
I would like to get $b2, $b3, $b4, $b5
Best Regards,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
- Blog @ http://ilesteban.wordpress.com
11 years, 10 months
Finding matching values in composite constraint
by bdolbeare
Is there a way to determine (in the rule consequence) which condition in a
composite constraint caused a rule to succeed?
I am working on a system that allows users to create rules via a custom UI
and when one of their rules fires, I want to be able to create a message
that describes why their rule fired. In a real example, they might have a
list of a few hundred conditions in a composite constraint.
An example rule with just two conditions in a composite constraint follows:
rule "test rule"
when
MyObject( (myfield str[startsWith] "a" || myfield str[startsWith] "b") )
then
System.out.prinltn(kcontext.getRule().getName() + " fired because myfield
started with ???");
end
Is this exposed somewhere in the variables like kcontext that are available
to each rule in their consequence?
--
View this message in context: http://drools.46999.n3.nabble.com/Finding-matching-values-in-composite-co...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months
Drools Fusion and Twitter Storm
by karlunho
Hi Folks,
I'd like to hear about any stories of using Drools in combination with
Twitter's Storm <http://storm-project.net/> .
The problem that I'm trying to solve is making a highly scalable event
processing system with the following properties:
1. Lots of events for the same timeframe - that means if the events expire
within 30 minutes, there are too many events to compute in a 30 minute
period for a single node
2. Fault tolerant - Meaning that if a node goes down, event processing will
not be affected or data will not be lost.
3. Perform Aggregates across large number of events
Has anyone tried to integrate the two systems ? There are a couple of
thoughts that I have why the two would be a nice match:
1. Twitter Storm seems to take care of most of the distributed processing
problem. Specifically, it allows for generating partial aggregate on
multiple nodes, followed by creating complete aggregates across nodes. Kind
of like a streaming map-reduce system.
2. Drools seems to have better a better language for event processing -
especially when there are layers and layers of business rules.
3. Drools Guvnor allows on-the-fly modification of rules - this is a huge
limitation of Twitter storm because it does not allow on-the-fly
modification of event processing topologies.
Let me know what everyone thinks (or if anyone has implemented this) !
The system I'm planning to apply this to is a mobile analytics system where
we are collecting network traffic and log data across potentially millions
of smartphones in real-time.
Regards,
Alan Ho
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Fusion-and-Twitter-Storm-tp40213...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months