[rules-users] Interface implementation not working..
CK
chrisckc at gmail.com
Wed Dec 2 11:58:10 EST 2009
Try changing your BOM_TRANSACTION_DETAILS Display() method access to
public and see if it works.
Currently, you have it as "void Display()" in your
BOM_TRANSACTION_DETAILS method declaration. Change it to "public void
Display()". It might solve your problem.
No need to change method declaration in the interface as it's correct.
-Chris
On Dec 2, 2009, at 1:35 AM, Deepak Jambhekar wrote:
>
> Hi....
>
> I have created a rule which is as below
> rule "myrule"
> dialect "mvel"
> when
> tr : BOM_TRANSACTION_DETAILS( country == "CH" )
> then
> tr.setCarrierName( "orange" );
> tr.Display();
> end
>
> And the Model class is defined as below...
>
> interface Generalized
> {
> void Display();
>
> }
>
> public class BOM_TRANSACTION_DETAILS implements Generalized {
> getter and setter.....
> void Display()
> {
> .....
> }
> }
>
>
> Now when I run this rule, it is giving me the following exception .
> Can any one please help me why this exception is coming....? and
> also when I removed the Display() from interface Generalized the
> code works fine...
> So is this because of Interface?? Can we use interface for defining
> Models..??
>
> org.drools.runtime.rule.ConsequenceException: [Error: tr.Display():
> Class org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer can
> not access a member of class com.drools.icas.transaction.Generalized
> with modifiers "public abstract"]
> [Near : {... Unknown ....}]
> ^
> [Line: 1, Column: 0]
> at
> org
> .drools
> .runtime
> .rule
> .impl
> .DefaultConsequenceExceptionHandler
> .handleException(DefaultConsequenceExceptionHandler.java:23)
> at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:943)
> at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:
> 885)
> at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:
> 1082)
> at
> org
> .drools
> .common
> .AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:682)
> at
> org
> .drools
> .common
> .AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:649)
> at
> org
> .drools
> .impl
> .StatefulKnowledgeSessionImpl
> .fireAllRules(StatefulKnowledgeSessionImpl.java:177)
> at com.drools.icas.transaction.DemoTest.main(DemoTest.java:92)
> Caused by: [Error: tr.Display(): Class
> org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer can not
> access a member of class com.drools.icas.transaction.Generalized
> with modifiers "public abstract"]
> [Near : {... Unknown ....}]
> ^
> [Line: 1, Column: 0]
> at
> org
> .mvel2
> .optimizers
> .impl
> .refl
> .ReflectiveAccessorOptimizer
> .compileGetChain(ReflectiveAccessorOptimizer.java:382)
> at
> org
> .mvel2
> .optimizers
> .impl
> .refl
> .ReflectiveAccessorOptimizer
> .optimizeAccessor(ReflectiveAccessorOptimizer.java:140)
> at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:137)
> at org.mvel2.MVELRuntime.execute(MVELRuntime.java:91)
> at
> org
> .mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:
> 101)
> at org.mvel2.MVEL.executeExpression(MVEL.java:968)
> at
> org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:89)
> at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934)
> ... 6 more
> Caused by: java.lang.IllegalAccessException: Class
> org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer can not
> access a member of class com.drools.icas.transaction.Generalized
> with modifiers "public abstract"
> at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
> at java.lang.reflect.Method.invoke(Method.java:583)
> at
> org
> .mvel2
> .optimizers
> .impl
> .refl
> .ReflectiveAccessorOptimizer
> .getMethod(ReflectiveAccessorOptimizer.java:936)
> at
> org
> .mvel2
> .optimizers
> .impl
> .refl
> .ReflectiveAccessorOptimizer
> .compileGetChain(ReflectiveAccessorOptimizer.java:321)
> ... 13 more
>
>
>
> Thanks....
>
> Deepak Jambhekar
>
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091202/59ec409b/attachment.html
More information about the rules-users
mailing list