youseries / urule

URULE是一款基于RETE算法的纯Java规则引擎,提供规则集、决策表、决策树、评分卡,规则流等各种规则表现工具及基于网页的可视化设计器,可快速开发出各种复杂业务规则。
Apache License 2.0
1.83k stars 723 forks source link

客户端调用服务端规则时,客户端报错:bean named 未定义 #100

Closed lhch102 closed 6 years ago

lhch102 commented 6 years ago

为了您的问题能得到及时准确解答,请认真填写下面各个选项,感谢您的配合。

com.bstek.urule.RuleException: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'rCheckOrderAction' is defined

at com.bstek.urule.action.ExecuteMethodAction.execute(ExecuteMethodAction.java:115)
at com.bstek.urule.model.rule.lhs.Criteria.evaluate(Criteria.java:74)
at com.bstek.urule.runtime.rete.CriteriaActivity.enter(CriteriaActivity.java:53)
at com.bstek.urule.runtime.rete.CriteriaActivity.enter(CriteriaActivity.java:31)
at com.bstek.urule.runtime.rete.AbstractActivity.visitPahs(AbstractActivity.java:52)
at com.bstek.urule.runtime.rete.ObjectTypeActivity.enter(ObjectTypeActivity.java:37)
at com.bstek.urule.runtime.rete.ReteInstance.enter(ReteInstance.java:35)
at com.bstek.urule.runtime.KnowledgeSessionImpl.evaluationRete(KnowledgeSessionImpl.java:345)
at com.bstek.urule.runtime.KnowledgeSessionImpl.execute(KnowledgeSessionImpl.java:206)
at com.bstek.urule.runtime.KnowledgeSessionImpl.fireRules(KnowledgeSessionImpl.java:139)
at com.bstek.urule.model.flow.BindingNode.executeKnowledgePackage(BindingNode.java:52)
at com.bstek.urule.model.flow.RuleNode.enterNode(RuleNode.java:42)
at com.bstek.urule.model.flow.FlowNode.enter(FlowNode.java:57)
at com.bstek.urule.model.flow.Connection.execute(Connection.java:68)
at com.bstek.urule.model.flow.FlowNode.leave(FlowNode.java:69)
at com.bstek.urule.model.flow.DecisionNode.doCriteria(DecisionNode.java:94)
at com.bstek.urule.model.flow.DecisionNode.enterNode(DecisionNode.java:47)
at com.bstek.urule.model.flow.FlowNode.enter(FlowNode.java:57)
at com.bstek.urule.model.flow.Connection.execute(Connection.java:68)
at com.bstek.urule.model.flow.FlowNode.leave(FlowNode.java:73)
at com.bstek.urule.model.flow.StartNode.enterNode(StartNode.java:44)
at com.bstek.urule.model.flow.FlowNode.enter(FlowNode.java:57)
at com.bstek.urule.model.flow.FlowDefinition.newInstance(FlowDefinition.java:71)
at com.bstek.urule.runtime.KnowledgeSessionImpl.startProcess(KnowledgeSessionImpl.java:179)
at com.bstek.urule.runtime.KnowledgeSessionImpl.startProcess(KnowledgeSessionImpl.java:152)
at com.test.InvokeTest.doTest(InvokeTest.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:233)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:87)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:176)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'rCheckOrderAction' is defined at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:702) at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1180) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:284) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1076) at com.bstek.urule.action.ExecuteMethodAction.execute(ExecuteMethodAction.java:49) ... 52 more

服务器页面规则配置:

image

youseries commented 6 years ago

自己定义的spring bean要保证在调用时当前调用的应用中有这个bean,否则就会出现你遇到的问题。 urule的规则执行发生在具体调用的应用中,是分布式执行方式,这点需要理解。

lhch102 commented 6 years ago

感谢!