Shannon,
What is the following method doing?
engine.process(reading);
Can you please open a JIRA and attach your test case or point me to the
jira reporting this problem if it exists already?
Thanks,
Edson
2011/5/23 Shannon Hastings <shannon.hastings(a)inventrio.com>
I am using drools 5.2.0.M2 and I still get this error:
Caused by: java.lang.NullPointerException
at
org.drools.marshalling.impl.InputMarshaller.readLeftTuple(InputMarshaller.java:469)
Which was reported on drools 5.1.0 JIRA and claimed to be fixed. I see the
error when trying to load a session that was persisted that had objects
inserted that are time depended and cause rules to fire that use terms from
flow such as "after". I only see this error if create a new session, submit
some facts to it, close it, and then try to reload. If i do not submit any
facts to it I do not get the error. I.E. If all i do is create the KB with
my rules I can reload a session from the DB no problem, but if i submit some
facts and persist the session, then i cannot reload it. This seems to be an
issue with the JPA loading of the session that has facts in it that use Flow
(JBPM). Any help would be greatly appreciated. Below are my simple rules
followed by the test code used to submit the facts:
package com.inventrio.rules.readings
import com.inventrio.healthmonitoring.model.*;
declare Reading
@role(event)
@timestamp(readingTime)
end
rule "High Blood Pressure"
when
$eventA : Reading(readingType.name == "BPMETER")
$systolic : Value( this.valueType.name == "SYSTOLIC" ) from$eventA.values
$diastolic : Value( this.valueType.name == "DIASTOLIC" ) from$eventA.values
eval( $systolic.getLongValue() > 180 && $diastolic.getLongValue() > 120 )
then
System.out.println("HIGH BLOOD PRESSURE" );
end
rule "Weight Trending Up"
when
$eventC : Reading(readingType.name == "WEIGHT" )
$eventB : Reading( readingType.name == "WEIGHT" , this after[5s, 1m]
$eventC )
$eventA : Reading( readingType.name == "WEIGHT" , this after[5s, 1m]
$eventB )
$weight3 : Value( this.valueType.name == "WEIGHT" ) from $eventC.values
$weight2 : Value( this.valueType.name == "WEIGHT" ) from $eventB.values
$weight1 : Value( this.valueType.name == "WEIGHT" ) from $eventA.values
eval( $weight3.getDoubleValue().doubleValue() <
$weight2.getDoubleValue().doubleValue() + 1.0 &&
$weight2.getDoubleValue().doubleValue() <
$weight1.getDoubleValue().doubleValue() + 1.0 )
then
System.out.println("WEIGHT IS GOING UP" );
end
rule "Weight Trending Down"
when
$eventC : Reading(readingType.name == "WEIGHT" )
$eventB : Reading( readingType.name == "WEIGHT" , this after[5s, 1m]
$eventC )
$eventA : Reading( readingType.name == "WEIGHT" , this after[5s, 1m]
$eventB )
$weight3 : Value( this.valueType.name == "WEIGHT" ) from $eventC.values
$weight2 : Value( this.valueType.name == "WEIGHT" ) from $eventB.values
$weight1 : Value( this.valueType.name == "WEIGHT" ) from $eventA.values
eval( $weight3.getDoubleValue().doubleValue() >
$weight2.getDoubleValue().doubleValue() + 1.0 &&
$weight2.getDoubleValue().doubleValue() >
$weight1.getDoubleValue().doubleValue() + 1.0 )
then
System.out.println("WEIGHT IS GOING DOWN" );
end
And next is my object i insert before closeing and then trying to reload
the session.
public void testWeightRules() {
try {
Reading reading = new Reading();
reading.setReadingTime(new Date(System.currentTimeMillis()));
ReadingType type = new ReadingType();
type.setName("WEIGHT");
type.setDescription("");
reading.setReadingType(type);
Value value = new Value();
value.setDoubleValue(140.0);
ValueType valueType = new ValueType();
valueType.setName("WEIGHT");
valueType.setDataType(ValueDataType.DOUBLE);
value.setValueType(valueType);
reading.getValues().add(value);
reading.setReadingType(type);
engine.process(reading);
Thread.sleep(7000);
reading = new Reading();
reading.setReadingTime(new Date(System.currentTimeMillis()));
type = new ReadingType();
type.setName("WEIGHT");
type.setDescription("");
reading.setReadingType(type);
value = new Value();
value.setDoubleValue(142.0);
valueType = new ValueType();
valueType.setName("WEIGHT");
valueType.setDataType(ValueDataType.DOUBLE);
value.setValueType(valueType);
reading.getValues().add(value);
reading.setReadingType(type);
engine.process(reading);
Thread.sleep(7000);
reading = new Reading();
reading.setReadingTime(new Date(System.currentTimeMillis()));
type = new ReadingType();
type.setName("WEIGHT");
type.setDescription("");
reading.setReadingType(type);
value = new Value();
value.setDoubleValue(144.0);
valueType = new ValueType();
valueType.setName("WEIGHT");
valueType.setDataType(ValueDataType.DOUBLE);
value.setValueType(valueType);
reading.getValues().add(value);
reading.setReadingType(type);
engine.process(reading);
} catch (Throwable t) {
t.printStackTrace();
}
}
Shannon Hastings
Inventrio
545 Metro Place South, Suite 475
Dublin, OH 43017
*Phone*: (614) 389-2795 x101
*Fax:* (614) 522-6249
*Email:* shannon.hastings(a)inventrio.com
http://www.inventrio.com
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users