Resuming a simple process involving human task
by Touma
Hi all,
For the past few weeks I've been trying to get a simple drools flow example
involving human tasks up and running. I've done quite a bit to the point
that my session, process, task and workitems are being persisted in the
database. Here is what my flow looks like:
Start -> Ruleflow -> Decision node -> Human Task -> Printing Node -> End
The work item handler for the Human task simply performs the task of
persisting the Task instance. After reaching the Human Task, the flow stops
and the state is persisted. But how would I go about restarting/resuming the
flow so that the 'Printing node' is reached? I've tried using the
loadStatefulKnowledgeSession(sessionId) to load the session but querying the
list of all the processes for the given session returns an empty list. Ditto
with the list of all the process events. I have all the ID's with me
(workitem, process, task, session) but am pretty confused as to how these
can be put to use to resume my suspended workflow.
Any pointers would be much appreciated. TIA.
Peace,
/T\
--
View this message in context: http://n3.nabble.com/Resuming-a-simple-process-involving-human-task-tp716...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 2 months
creating .pkg from .drl
by Amit Kumar
Hi Folks,
I am trying to create a .pkg file (for probably faster loading) from a .drl
file
Does anybody has a code snippet which I can use. Am unable to find it in
javadocs.
Thanks
Amit
14 years, 4 months
Failed to read schema document when trying to transform from XML to DRL
by Chang Liu
Hi there,
Error message:
(null: 5, 77): schema_reference.4: Failed to read schema document 'drools.org/drools-5.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
I ran into this issue when experimenting a project that transforming the rules back and forth from DRL to XML with utility classes as documented in following link:
http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/ht...
My code:
...
XmlPackageReader xmlReader = new XmlPackageReader(null);
StringReader sr = new StringReader(rulesInXml);
try {
PackageDescr packageDescr = xmlReader.read(sr);
DrlDumper drlDumper = new DrlDumper();
String drlString = drlDumper.dump(packageDescr);
}
catch (Exception ex) {
System.out.println(ex);
}
...
where string "rulesInXml" is the result xml string transformed from a valid .drl file. It looks like:
<?xml version="1.0" encoding="UTF-8"?>
<package name="com.sample"
xmlns="http://drools.org/drools-5.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0 drools.org/drools-5.0.xsd">
<import name="com.sample.DroolsTest.Message" />
<rule name="Hello World">
<lhs><pattern identifier="m" object-type="Message" >
<field-constraint field-name="status">
<qualified-identifier-restriction evaluator="==">Message.HELLO </qualified-identifier-restriction>
</field-constraint>
<field-binding field-name="message" identifier="myMessage" />
</pattern>
</lhs>
<rhs> System.out.println( myMessage );
m.setMessage( "Goodbye cruel world" );
m.setStatus( Message.GOODBYE );
update( m );
</rhs>
</rule>
<rule name="GoodBye">
<lhs><pattern object-type="Message" >
<field-constraint field-name="status">
<qualified-identifier-restriction evaluator="==">Message.GOODBYE </qualified-identifier-restriction>
</field-constraint>
<field-binding field-name="message" identifier="myMessage" />
</pattern>
</lhs>
<rhs> System.out.println( myMessage );
</rhs>
</rule>
</package>
What did I miss here?
Moreover, the Drools 5.0 API's for XML support are poorly-documented. For example, the constructors of class "XmlPackageReader" has an arg of "SemanticModules" type which is not documented. :(
Any help would be highly appreciated!
Thanks,
Chang
**********************************************************************
CONFIDENTIALITY NOTICE: The information contained in this email is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If you are not the intended recipient, you are hereby notified that any unauthorized review, use, dissemination, distribution or copying of this communication is prohibited and may be subject to legal restriction or sanction. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of the information and all copies. If you are the intended recipient but do not wish to receive communications through this medium, please advise the sender immediately. Thank you
14 years, 4 months
Decision Tree input?
by Wilson O Ojwang
All,
Is there something in the works to support Decision Tree Inputs in
addition to Decision Table?
Regards
Wilson
14 years, 5 months
java.lang.NoSuchMethodError on every Action node
by Ana F Santos
Hi everyone.
I've been trying to use Drools for the past month, and sometimes I have
problems I can't guess anymore how to solve.
This time, every action I try to insert in a ruleflow, I receive a
java.lang.NoSuchMethodError. I'm even trying a really simple ruleflow with
just one simple action - like System.out.println("Test"); - and all I get
is a java.lang.NoSuchMethodError.
[
The stack trace:
java.lang.NoSuchMethodError:
br.com.pst.packages.ruleflows.Process_br_com_pst_packages_ruleflows_0.action0(Lorg/drools/spi/KnowledgeHelper;Lorg/drools/spi/ProcessContext;)V
at
br.com.pst.packages.ruleflows.Process_br_com_pst_packages_ruleflows_0Action0Invoker.execute(
Process_br_com_pst_packages_ruleflows_0Action0Invoker.java:20)
at
org.drools.workflow.instance.node.ActionNodeInstance.internalTrigger(
ActionNodeInstance.java:54)
at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(
NodeInstanceImpl.java:111)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(
NodeInstanceImpl.java:142)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(
NodeInstanceImpl.java:128)
at
org.drools.workflow.instance.node.StartNodeInstance.triggerCompleted(
StartNodeInstance.java:49)
at
org.drools.workflow.instance.node.StartNodeInstance.internalTrigger(
StartNodeInstance.java:41)
at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(
NodeInstanceImpl.java:111)
at
org.drools.ruleflow.instance.RuleFlowProcessInstance.internalStart(
RuleFlowProcessInstance.java:16)
at org.drools.process.instance.impl.ProcessInstanceImpl.start(
ProcessInstanceImpl.java:185)
at
org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.start(
WorkflowProcessInstanceImpl.java:230)
at org.drools.common.AbstractWorkingMemory.startProcess(
AbstractWorkingMemory.java:1639)
at org.drools.common.AbstractWorkingMemory.startProcess(
AbstractWorkingMemory.java:1604)
at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(
StatefulKnowledgeSessionImpl.java:267)
at br.com.pst.packages.ServicePackages.main(
ServicePackages.java:99)
]
Actually, the beginning problem was with my project, with a process and
subprocess. The subprocess works fine, but the main process throws a
java.lang.NoSuchMethodError always on any node I put after a specific
RuleFlowGroup node. Everyting used to work before, but when I begin to
enlarge it, nothing seems to work anymore. And, as I told, I can't always
guess the exact problem as the thrown exceptions are very generic.
Hope anyone could help me!
Thanks a lot
ANA FLÁVIA FONSECA DOS SANTOS
Analista de Desenvolvimento de Software
PST Eletrônica S/A
Phone: +55 19 3787 6379
aflavia(a)pst.com.br
www.pst.com.br
www.positron.com.br
14 years, 5 months
KnowledgeAgent doesn't load dsl files and dslr file from a change-set correctly
by Pritham
I have a folder in classpath:
dsl/global.dsl
rules/section-A.dslr
rules/section-A/page-1.dslr
I create a knowledge base like this:
public KnowledgeBase createKnowledgeBase() throws DroolsParserException,
IOException {
KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory
.newKnowledgeBuilder();
knowledgeBuilder.add(ResourceFactory
.newClassPathResource("dsl/global.dsl"),
ResourceType.DSL);
knowledgeBuilder.add(ResourceFactory
.newClassPathResource("rules/section-A.dslr"),
ResourceType.DSLR);
knowledgeBuilder.add(ResourceFactory
.newClassPathResource("rules/section-A/page-1.dslr"),
ResourceType.DSLR);
if (knowledgeBuilder.hasErrors()) {
throw new RuntimeException(knowledgeBuilder.getErrors().toString());
}
KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
knowledgeBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages());
return knowledgeBase;
}
// code
knowledgeBase = createKnowledgeBase();
session = knowledgeBase.newStatefulKnowledgeSession();
// insert facts
session.fireAllRules();
session.dispose();
The above code works and I can get a unit test to work that processes rules
accordingly. I can see my dslr converting to a drl using the "drl viewer"
correctly (provided I temporarily place the dsl file in the same location
since expander doesn't accept a relative path).
The problem, however is when I use a change-set.xml and a KnowledgeAgent,
things don't work
code for loading via knowledgeAgent
public static KnowledgeBase loadKnowledgeBase() throws
DroolsParserException, IOException {
agent = KnowledgeAgentFactory.newKnowledgeAgent("msll agent");
agent.applyChangeSet(ResourceFactory.newClassPathResource("change-set.xml"));
return agent.getKnowledgeBase();
}
<change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd'
>
<add>
<resource source='classpath:dsl/' type='DSL' />
<resource source='classpath:rules/' type='DSLR' />
<resource source='classpath:rules/section-A/' type='DSLR' />
</add>
</change-set>
I get the following generic drools errors:
ERR 103] Line 4:0 rule 'rule_key' failed predicate:
{(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule[7,0]: [ERR 101]
Line 7:0 no viable alternative at input 'import' in rule Con in rule
attribute
...
...
The rules are same, folder location is the same. I believe that drools has a
problem resolving path (expander global.dsl) from the dslr file when using a
KnowlegeAgent since in the earlier strategy, one could build a dsl into the
knowledgeBuilder directly from the classpath.
Pl suggest.
--
View this message in context: http://n3.nabble.com/KnowledgeAgent-doesn-t-load-dsl-files-and-dslr-file-...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 5 months
Debug as within Eclipse
by chris richmond
I used the upate site to update my Eclipse Galileo IDE with the drools
tools, created a new drools project, had it add the hello/goodbye test class
and pointed my workspace to the 5.1M binaries. It runs fine, but when I
Debug As -> Drools Application I get the following errors. I get this error
for any drools project I try to debug as Drools application within Eclipse.
Any ideas?
Thanks,
CHris
FATAL ERROR in native method: JDWP No transports initialized,
jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: transport error 202: connect failed: Connection refused
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized
[../../../src/share/back/debugInit.c:690]
14 years, 5 months
Persistence issue using Oracle
by ramram
Hi All,
I have been using the H2 in memory database to test all my Drools Flow
scenarios using Guvnor and Gwt Console provided. And I have some questions
to ask and was wondering if someone can help. The main plan now is to switch
from using the H2 in memory database to Persist using the Oracle database.
1- What are the files that should be affected in this switch? or where
should I be looking into?
2- Are the tables created dynamically? and under which schema?
3- is there any test case implemented using this technology?
Thnx in advance for your help
Regards,
Ram
--
View this message in context: http://n3.nabble.com/Persistence-issue-using-Oracle-tp417257p417257.html
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 6 months
MVEL strict mode -- when, why?
by Barry Kaplan
I have never gotten any of my rules to compile using mvel strict mode. If I
leave the default I get spews of error messages that I can't make any sense
of. For example with:
---
package systeminsights.plugin.core.schedule
rule "foo"
when
eval(true)
then
// noop
end
---
I get messages like
[Error: Failed to compile: 3 compilation error(s):
- (1,21) unqualified type in strict mode for: plugin
- (1,26) unqualified type in strict mode for: core
- (1,35) unqualified type in strict mode for: schedule]
[Near : {... Unknown ....}]
^
[Line: 1, Column: 0]
If I set strict mode to false all is good.
So, what is actually going on with strict mode? And how does one interpret
messages such as the above?
-barry
--
View this message in context: http://n3.nabble.com/MVEL-strict-mode-when-why-tp95666p95666.html
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 6 months