Rules in Database.
by tom ska
Hi,
what I can't do is to save rules defined in Guvnor to DBMS's tables. I want
another application to read rules, and this another application can read
from Database. I saved Guvnor's data in database, but I can't see tables
with rules definition... How can I do it?
Thanks in advance,
tom.
15 years, 10 months
Error while applying changeset in 5.1 version
by Swapnil Sawant
Hi,
I have used 5.1 drools-api and drools-core JARs and wrote following code :
String currentWorkingDirectory = System.getProperty("ofbiz.home");
kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyRuleAgent"
);
String url =
"file:"+currentWorkingDirectory+"/framework/drools/config/changeset.xml";
System.out.println("Url is "+url+"\t CwD
"+currentWorkingDirectory);
kagent.applyChangeSet( ResourceFactory.newUrlResource( url ) );
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newUrlResource( url ),
ResourceType.CHANGE_SET );
kbase = kagent.getKnowledgeBase();
ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();
While execution , I got following error :
Service invocation error
Exception: org.ofbiz.service.GenericServiceException
Message: Service [ruleServiceJava] target threw an unexpected exception
(org/drools/rule/CompositeClassLoader)
---- cause
---------------------------------------------------------------------
Exception: java.lang.NoClassDefFoundError
Message: org/drools/rule/CompositeClassLoader
---- stack trace
---------------------------------------------------------------
java.lang.NoClassDefFoundError: org/drools/rule/CompositeClassLoader
org.drools.builder.impl.KnowledgeBuilderFactoryServiceImpl.newKnowledgeBuilder(KnowledgeBuilderFactoryServiceImpl.java:34)
org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:47)
org.drools.agent.impl.KnowledgeAgentImpl.createKBuilder(KnowledgeAgentImpl.java:1214)
org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:884)
org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:704)
org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:584)
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:185)
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:168)
org.ofbiz.drools.event.drool.RuleIntegrate.createKnowledgeBase(RuleIntegrate.java:46)
org.ofbiz.drools.event.drool.RuleIntegrate.createWorkingMemory(RuleIntegrate.java:29)
org.ofbiz.payroll.DroolsRule.callRuleJava(DroolsRule.java:42)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker(StandardJavaEngine.java:100)
org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java:57)
org.ofbiz.service.ModelServiceReader$GenericInvokerImpl.runSync(ModelServiceReader.java:761)
_$gen.file_58$.D_58$.Swapnil_95$Data.ofbiz_95$payroll.ofbiz_45$17_45$Aug_45$2010.applications.payroll.servicedef.services
_46$xml_35$ruleServiceJava.runSync(file:/D:/Swapnil_Data/ofbiz_payroll/ofbiz-17-Aug-2010/applications/payroll/servicedef/
services.xml#ruleServiceJava:114)
org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:399)
org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:226)
org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:165)
org.ofbiz.webapp.event.ServiceEventHandler.invoke(ServiceEventHandler.java:336)
org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:637)
org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:383)
org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:227)
org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:90)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:271)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Thread.java:619)
--------------------------------------------------------------------------------
Then I check drools-core.jar in version 5 and in 5.1 too.
The problem I found was 'org/drools/rule/CompositeClassLoader' class
was present in 5.0 version but was not there in 5.1 .
Pl help me in resolving this issue.
Thanks,
Swapnil Sawant
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Error-while-applying-...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 10 months
Stream Mode with Temporal Reasoning and Event Lifecycle Management
by Tina Vießmann
Hi,
I'm thinking about something. Maybe anyone can tell me.
The Stream Processing Mode of Drools Fusion provides automatic lifecycle
managment. For my understandings this is based on the sliding windows
used inside the rule conditions, the @expires metadata and the @delay
metadata. Am I right so far?
My questions is now: How are Events handled if non of the things listed
above are used?
Let's say I've got rules just using the temporal reasoning operators
inside the rule conditions - no sliding windows at all. I'm also not
using any of the @expires and @delay metadata. Is it correct than that:
- Drools matches the event coming in and the events existing in the
KnowledgeBase and eventually activates a rule. And after fireAllRules()
is called the resulting actions are performed and all Events are
retracted by the automatic lifecycle managment, because there are no
hints (like a sliding window) that events will be needed again. (So that
the knowledge base would be empty again?)
Thanks for any explanations. :)
Tina
15 years, 10 months
Please help me to fix the AgendaFilter related issue
by Sanjib Karmakar
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.spi.Activation;
import org.drools.spi.AgendaFilter;
.
.
.
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(
ResourceFactory.newClassPathResource(resourceIndicator),
ResourceType.XDRL
);
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
.
.
.
public Object getSpecificRuleReport(
Object requestDTO,
Object responseDTO,
final String ruleAry[]
)
throws Exception
{
AgendaFilter agendafilter =
new StatefulKnowledgeSessionImpl.AgendaFilterWrapper(null)
{
public boolean accept(Activation activation)
{
boolean returnFlag = false;
int ruleArySize = ruleAry.length;
for (int cnt=0; cnt<ruleArySize; cnt++)
{
if (activation.getRule().getName().equals(ruleAry[cnt]))
returnFlag = false;
else
returnFlag = true;
}
return returnFlag;
}
};
try
{
ksession.insert(requestDTO);
ksession.insert(responseDTO);
ksession.fireAllRules(agendafilter);
}catch(Exception t)
{
_logger.error(t.getMessage()+"\n"+t);
}
return responseDTO;
}
Eclipse is showing that there is a method fireAllRules() which takes
AgendaFilter as a parameter
but I am getting error "The method fireAllRules(int) in the type
StatefulRuleSession is not applicable for the arguments (AgendaFilter)" at
'ksession.fireAllRules(agendafilter);'
I am trying to execute specific rules out of set of rules. Please help me to
fix this issue.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Please-help-me-to-fix...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 10 months
IAE when calling constructor from RHS
by Wolfgang Laun
In Java, a constructor with package level visibility can be called from some
other class in the same package.
It seems that this is not possible from the RHS of a rule that is in a .DRL
file that has the same "package" declaration as the package of the class
that should be instantiated. An IllegalAccessException is thrown.
This looks as if the constructor called reflectively from another package?!
xception in thread "main" java.lang.IllegalAccessError: tried to access
method
rss.ixl.route.TrainStartGoalConn.<init>(Lrss/ixl/cfg/jaxb/elrep/FrontBackType;Lrss/ixl/cfg/jaxb/elrep/FrontBackType;Ljava/lang/String;Lrss/ixl/cfg/jaxb/elrep/ElemType;)V
from class rss.ixl.route.Rule_concatenateRoutes_0
at
rss.ixl.route.Rule_concatenateRoutes_0.consequence(Rule_concatenateRoutes_0.java:12)
at
rss.ixl.route.Rule_concatenateRoutes_0ConsequenceInvoker.evaluate(Rule_concatenateRoutes_0ConsequenceInvoker.java:38)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1086)
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:183)
at rss.aws.engine.impl.DroolsEngine.runUntilIdle(DroolsEngine.java:85)
at rss.aws.init.Main.exec(Main.java:133)
at rss.aws.init.Main.main(Main.java:199)
Best
-W
15 years, 10 months
Drools flow - foreach element
by Miloslav Vlach
Hi,
I have to use the for each element:
<forEach id="7" name="pro všechny PM" x="5" y="16" width="650" height="773"
variableName="projectManager" collectionExpression="invoice.pmArray" >
</forEach>
the variable projectManager shlould be addressable in the forEach node. But
the variable cannot be used in the split element (there is created drl
content which cannot access the projectManger variable name)
<split id="22" name="Schvaleno/Neschvaleno" x="409" y="188" width="49"
height="49" type="2" >
<constraints>
<constraint toNodeId="7" toType="DROOLS_DEFAULT" name="pokračování"
priority="1" type="rule" dialect="mvel" >eval(false)</constraint>
<constraint toNodeId="27" toType="DROOLS_DEFAULT" name="neschváleno"
priority="1" type="rule" dialect="mvel"
>eval("mvlach".equals(projectManager))</constraint>
</constraints>
</split>
Where is the problem, can somebody help me ?
Thanks Miloslav Vlach
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-flow-foreach-e...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 10 months