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, 4 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, 4 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, 4 months
Implementing Timers With Drools Persistence Enabled
by nanic23
Hi All,
I was able to implement some timers and they behave as expected until I
enable persistence. Timers work (get triggered) when creating the
StatefulKnowledgeSession by kbase.newStatefulKnowledgeSession() but they do
NOT work (do not get triggered) when creating the StatefulKnowledgeSession
by JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
I am calling ksession.fireUntilHalt() from within a new thread and all that.
The problem is not getting timers to work, as I have already accomplished
this, but the problem is rather getting them to work with persistence
enabled.
- Has anyone implemented timers while using (having enabled) persistence?
- Did you experience any problems such as timers not triggering?
- If so, have you found a work around you could share?
The timers are being implemented in ruleflow (DRF) and I'm using drools
5.1.0
Any comments are welcome.
Thanks,
Nick.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Implementing-Timers-W...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 4 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, 4 months
Drools and Guvnor 5.1M2 - Exception being thrown in processChangeSet
by Jeffrey Schneller
I am trying to upgrade to the 5.1M2 build from 5.0.1 and am running into
some issues. I have installed the new 5.1 Guvnor and imported the rules
from my 5.0.1 Guvnor instance.
I then removed the old 5.0.1 drools jars from my app and replaced them
with the 5.1M2 drools jars. I was also added all the dependent
libraries. The code that worked with the 5.0.1 version does not work
with the 5.1M2 version. In 5.0.1 I was constructing the xml and
streaming it into the applyChangeSet method. With 5.1M2 I am just
pointing to the change set xml file that is in the Guvnor.
I am seeing a NullPointerException being thrown in the processChangeSet
method as shown below.
Caused by: java.lang.NullPointerException
at
org.drools.agent.impl.KnowledgeAgentImpl.processChangeSet(KnowledgeAgent
Impl.java:171)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentIm
pl.java:143)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentIm
pl.java:130)
Did I miss something? Am I doing something wrong? Below is the code
that I have.
KnowledgeAgentConfiguration kaconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
kaconf.setProperty( "drools.agent.scanDirectories",
"true" );
kaconf.setProperty("drools.agent.newInstance",
"false");
ResourceFactory.getResourceChangeScannerService().start();
ResourceFactory.getResourceChangeNotifierService().start();
String url =
"http://rulerserver/drools-guvnor/org.drools.guvnor.Guvnor/package/my.ru
le.package/LATEST/ChangeSet.xml";
KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent( "Configuration", kaconf );
kagent.setSystemEventListener(new MyDroolsListener());
try {
kagent.applyChangeSet(ResourceFactory.newUrlResource(new URL(url)));
// ERROR IS OCCURING INSIDE OF applyChangeSet
} catch (MalformedURLException e) {
e.printStackTrace();
}
14 years, 5 months
Rule Validation/Package Build Error in Guvnor: Class Not Found
by Ike Okafo
Hello,
I am new to Drools and have written a rule .DRL file which contains some
helper function imports from other packages, fact objects imports from
other packages and the rules that act on these facts. The file works well
when I call it from my javacode using the rulebase or knowledgebase
approach.
The drl file itself is in its own package.
I now have a requirement to call the same rules from within Guvnor.
The goal is to enable business users modify these rules through the
Guvnor UI and also take advantage of the disable individual rules
feature within guvnor.
My current difficulty is importing and validating the rules in guvnor,
along with the associated fact jar files and finally interfacing
with guvnor from my code. Any help would be appreciated .
The main error happens when I try to build a binary package and create
a snapshot of the working rule file I imported for deployment.
When I hit the save and validate configuration button, I get
*"class not found"* validation errors for all the classes imported at
the top of the rule file - includingng the helper import functions
and facts used in the rules. Same thing happens when I try to
build the package I get the following errors
"Error importing: <list of all classes in import statement in rule file>"
Here are the steps I followed in importing the rule file and Jar file
containing the classes
into Guvnor
(1) First within Guvnor I created a package corresponding to the package
path
for for each of the jar files whose classes are referenced/imported in the
rule .DRL file
(2) I created the jar files for each of these packages in eclipse
(3) Imported those jars individually into each of the packages created in
guvnor
using upload model jar function and selecting the appropriate path as
created in step 1 2 above
(4) Imported the rule file which is in its own package - using the create
package (upload method)
(5) I then try to save and validate the imported rule file in step 5 (this
is where the error occurs)
I have already setup my code to call guvnor as follows
RuleAgent agent = RuleAgent.newRuleAgent("guvnor.properties");
RuleBase masterRuleBase = agent.getRuleBase();
guvnor.properties contains only one entry
url =
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Some...
It is my understanding that after I import the rule file
I need to save and validate and build the package
in order to point the url to the path above. If I point the url to just
the drl file itself will it work?
i.e url=
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Some...
Any help to resolve the class not found error will
be much appreciated
Thanks
14 years, 5 months