I've created the following rule in BRMS and deployed it -
rule "Underwriting Rule 1"
dialect "mvel"
when
p : Policy( premium < "50.00" )
then
p.setStatus( 32 );
end
I have the following code processing the rule -
public void main(Policy inputPolicy) throws Exception
{
RuleBase ruleBase = loadRuleBase();
StatefulSession session = ruleBase.newStatefulSession();
session.insert(inputPolicy);
session.fireAllRules();
}
private RuleBase loadRuleBase() throws IOException, Exception
{
RuleAgent agent = RuleAgent.newRuleAgent("/uwrules.properties");
RuleBase ruleBase = agent.getRuleBase();
return ruleBase;
}
When I run my application I get the following error. Could someone tell
me why or where to look to determine the reason? Do I have something
coded incorrectly?
Exception in thread "main" javax.ejb.EJBException:
java.lang.ClassCastException: java.util.HashSet
at
org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
at
org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
.
.
.
Caused by: java.lang.ClassCastException: java.util.HashSet
at org.drools.rule.Package.readExternal(Package.java:172)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at
org.drools.agent.HttpClientImpl.fetchPackage(HttpClientImpl.java:54)
at org.drools.agent.URLScanner.readPackage(URLScanner.java:137)
at org.drools.agent.URLScanner.getChangeSet(URLScanner.java:109)
at
org.drools.agent.URLScanner.loadPackageChanges(URLScanner.java:88)
at
org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:297)
at
org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:265)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:251)
at org.drools.agent.RuleAgent.init(RuleAgent.java:183)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:192)
Show replies by date
Folks,
Using 4.0.1. Getting an exception when using rule flow:
org.mvel.PropertyAccessException
unable to resolve property: System.out.println("*** ACTION *** No
Errors.")
Stack Trace:
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChai
n(ReflectiveAccessorOptimizer.java:280)
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccess
or(ReflectiveAccessorOptimizer.java:108)
org.mvel.ASTNode.getReducedValueAccelerated(ASTNode.java:187)
org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
org.mvel.CompiledExpression.getValue(CompiledExpression.java:99)
org.mvel.MVEL.executeExpression(MVEL.java:219)
org.drools.ruleflow.instance.impl.ActionNodeInstanceImpl.trigger(ActionN
odeInstanceImpl.java:49)
org.drools.ruleflow.instance.impl.RuleFlowSplitInstanceImpl.trigger(Rule
FlowSplitInstanceImpl.java:77)
org.drools.ruleflow.instance.impl.RuleFlowSequenceNodeInstanceImpl.trigg
erCompleted(RuleFlowSequenceNodeInstanceImpl.java:38)
org.drools.common.RuleFlowGroupImpl$DeactivateCallback.execute(RuleFlowG
roupImpl.java:212)
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWor
kingMemory.java:1260)
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemo
ry.java:438)
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemo
ry.java:396)
In action : Action No Errors I have defined :
System.out.println("*** ACTION *** No Errors.");
Any idea why?
Thanks,
-Sergey
**********************
** LEGAL DISCLAIMER **
**********************
This E-mail message and any attachments may contain
legally privileged, confidential or proprietary
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of
this message to the intended recipient(s), you are
hereby notified that any dissemination, distribution
or copying of this E-mail message is strictly
prohibited. If you have received this message in
error, please immediately notify the sender and
delete this E-mail message from your computer.
Actions in RuleFlow are interpreted at runtime using MVEL. This error seems to indicate
that there is a problem in the syntax of your MVEL expression. However, looking at your
example, I do not see any problem, System.out.println("Your text here"); as
action property should work (I just tested it with the 4.0.1 release). Could you open a
JIRA and provide a self-contained test that shows the problem?
That said, we still need to add syntax checking for actions during ruleflow validation, to
ensure that this error is encountered when checking the ruleflow (at compile time) and not
during execution.
Kris