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
StackOverflowError when serializing KnowledgeBase
by Andargor
Hello,
After adding a few hundred rules, and with the same code, KnowledgeBase serialization has started to generate StackOverflowError. I have increased the VM stack size as a workaround, but I was hoping to implement something more robust.
I specifically need to serialize the KnowledgeBase, and not the session.
I'm using this code:
private void dumpKnowledgeBase(String file, KnowledgeBase kbase) {
try {
FileOutputStream ostream = new FileOutputStream(file);
DroolsObjectOutputStream p = new DroolsObjectOutputStream(ostream);
p.writeObject(kbase);
p.flush();
ostream.close();
}
catch (Exception e) {
System.err.println(e);
e.printStackTrace();
System.err.println("Could not write knowledge base "+file);
}
}
This is due to writeObject recursion? Any ideas?
A.
14 years, 5 months
Drools with spring
by sonytvpm@gmail.com
Hi all
I would like to integrate drools with spring
If any body have example project share with me I will use spring 3
with drools 5.1
Thanks in advance
Sonu
Sent from my iPod
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
Re: [rules-users] Drools Flow
by santosh mukherjee
Hi,
My rule file is like this:
rule1:
when something
then
start process(p1);
rule2:
when something
then
startprocess(p2);
But in both the cases only p1 gets fired which was the rule flow that I last
added to the builder.
Can any body suggest me how to overcome this problem.??
Thanks
Santosh Mukherjee
14 years, 5 months
Wait state constriant
by retoy
Can anyone tell me what's wrong with this wait state constraint?
System.currentTimeMillis() >= (startWait + 3000)
The exception I'm getting ist:
[5,33]: [ERR 102] Line 5:33 mismatched input '>=' expecting 'then' in rule
"RuleFlow-Milestone-drools.test.timer-6"
but I don't think that is really getting to the heart of the problem...
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Wait-state-constriant...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 5 months
Drools and mvel
by Paul Edwards
Hi guys,
I have an issue which involves smooks, drools and mvel.
Quick explanation, the unit test is just a smooks run. Nothing complicated. The test passes happily. It contains an expression that involves an MVEL "IF" statement.
Now if I add a drools startup (I'm not using drools in the test, I'm just initialising it), the unit test now fails on the "IF" statement. The exception received is:
org.milyn.cdr.SmooksConfigurationException: Error invoking @Initialize method 'initialize' on class 'org.milyn.javabean.BeanInstancePopulator'.
at org.milyn.cdr.annotation.Configurator.invoke(Configurator.java:457)
at org.milyn.cdr.annotation.Configurator.initialise(Configurator.java:439)
at org.milyn.cdr.annotation.Configurator.configure(Configurator.java:91)
at org.milyn.cdr.annotation.Configurator.configure(Configurator.java:66)
at org.milyn.delivery.JavaContentHandlerFactory.create(JavaContentHandlerFactory.java:63)
at org.milyn.delivery.ContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.addCDU(ContentDeliveryConfigBuilder.java:623)
at org.milyn.delivery.ContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.applyCDUStrategy(ContentDeliveryConfigBuilder.java:548)
at org.milyn.delivery.ContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.applyStrategy(ContentDeliveryConfigBuilder.java:536)
at org.milyn.delivery.ContentDeliveryConfigBuilder$SmooksResourceConfigurationTableIterator.iterate(ContentDeliveryConfigBuilder.java:711)
at org.milyn.delivery.ContentDeliveryConfigBuilder$SmooksResourceConfigurationTableIterator.access$300(ContentDeliveryConfigBuilder.java:690)
at org.milyn.delivery.ContentDeliveryConfigBuilder.extractContentHandlers(ContentDeliveryConfigBuilder.java:484)
at org.milyn.delivery.ContentDeliveryConfigBuilder.load(ContentDeliveryConfigBuilder.java:349)
at org.milyn.delivery.ContentDeliveryConfigBuilder.getConfig(ContentDeliveryConfigBuilder.java:146)
at org.milyn.container.standalone.StandaloneExecutionContext.<init>(StandaloneExecutionContext.java:91)
at org.milyn.container.standalone.StandaloneExecutionContext.<init>(StandaloneExecutionContext.java:65)
at org.milyn.Smooks.createExecutionContext(Smooks.java:383)
at org.milyn.Smooks.createExecutionContext(Smooks.java:346)
at com.hyro.telstrapoc.smooks.SmooksTransformTest.runSmooksTransform(SmooksTransformTest.java:215)
at com.hyro.telstrapoc.smooks.SmooksTransformTest.testSmooks(SmooksTransformTest.java:139)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: [Error: was expecting type: java.lang.Object; but found type: null]
[Near : {... }
els ....}]
^
[Line: 3, Column: 16]
at org.mvel2.util.CompilerTools.expectType(CompilerTools.java:355)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer._getAccessor(ReflectiveAccessorOptimizer.java:1052)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeCollection(ReflectiveAccessorOptimizer.java:1079)
at org.mvel2.ast.InlineCollectionNode.<init>(InlineCollectionNode.java:50)
at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:1173)
at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:118)
at org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:65)
at org.mvel2.MVEL.compileExpression(MVEL.java:886)
at org.mvel2.MVEL.compileExpression(MVEL.java:891)
at org.mvel2.MVEL.compileExpression(MVEL.java:797)
at org.milyn.expression.MVELExpressionEvaluator.setExpression(MVELExpressionEvaluator.java:55)
at org.milyn.javabean.BeanInstancePopulator.initialize(BeanInstancePopulator.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.milyn.cdr.annotation.Configurator.invoke(Configurator.java:453)
... 42 more
If I remove the 3 lines initialising drools, it all passes again. I suspect that the MVEL engine is a singleton, and both drools and smooks are using the same instance. I believe drools is setting MVEL to disallow "IF" statements on the RHS of a rule. (see: http://drools-java-rules-engine.46999.n3.nabble.com/Trivial-rule-with-con...) I don't understand why MVEL thinks that my smooks expression is a RHS of a rule....
Heres the unit test:
@Test
public void testSmooks2() throws Exception {
String input =
"<ns5:user partyAdminRoles=\"\" lastName=\"Edwards\" firstName=\"Paul\" primary=\"false\" userID=\"pedwards\" otpTokenRemainingUses=\"0\" registrationCodeRemainingUses=\"0\" enabled=\"true\" customIntAttr1=\"0\" xmlns:ns2=\"urn:oasis:names:tc:SPML:2:0:reference\" xmlns=\"urn:oasis:names:tc:SPML:2:0\" xmlns:ns4=\"urn:oasis:names:tc:SPML:2:0:password\" xmlns:ns3=\"urn:oasis:names:tc:SPML:2:0:search\" xmlns:ns5=\"http://hyro.com/da/objectmodel\" xmlns:ns6=\"http://www.sifinfo.org/au/infrastructure/2.x\" xmlns:ns7=\"urn:oasis:names:tc:SPML:2:0:batch\">\n" +
" <ns5:emailAddresses emailAddress=\"pedwards(a)frazzle.co.nz\" primary=\"true\" type=\"Personal\" modificationMode=\"0\"/>\n" +
" <ns5:emailAddresses emailAddress=\"grumpy(a)frazzle.co.nz\" primary=\"false\" type=\"Personal\" modificationMode=\"0\"/>\n" +
" <ns5:authzRoleSubscriptions status=\"Active\" primary=\"false\" singlePasswordOptOut=\"false\" reprovision=\"false\" customBoolAttr5=\"false\" customBoolAttr4=\"false\" customBoolAttr3=\"false\" customBoolAttr2=\"false\" customBoolAttr1=\"false\" customIntAttr5=\"0\" customIntAttr4=\"0\" customIntAttr3=\"0\" customIntAttr2=\"0\" customIntAttr1=\"0\">\n" +
" <ns5:role roleName=\"Account\">\n" +
" <ns5:entitlement entitlementID=\"Open LDAP Account\" type=\"Account\"/>\n" +
" </ns5:role>\n" +
" </ns5:authzRoleSubscriptions>\n" +
" <ns5:auxEntities/>\n" +
"</ns5:user>\n";
UserType inUser = null;
Unmarshaller unmarshaller = null;
try {
log.debug("Unmarshalling: " + input);
unmarshaller = (Unmarshaller) SpmlConstants.unmarshallerPool.borrowObject();
inUser = ((JAXBElement<UserType>) unmarshaller.unmarshal(new StringReader(input))).getValue();
} catch (JAXBException e) {
log.error("Exception while trying to unmarshall input daSpmlString: " + e.getMessage());
e.printStackTrace();
throw e;
} catch (Exception e) {
log.error("Exception while trying to unmarshall input daSpmlString: " + e.getMessage());
e.printStackTrace();
throw e;
} finally {
SpmlConstants.unmarshallerPool.returnObject(unmarshaller);
}
log.debug("Unmarshalled: " + inUser.getUserID());
Properties parsed = runSmooksTransform(inUser);
assertNotNull(parsed);
for(Iterator<Object> i = parsed.keySet().iterator(); i.hasNext();) {
Object key = i.next();
Object value = parsed.get(key);
System.out.println("Key: " + key + " value: " + value);
}
}
Heres the smooks file:
<?xml version="1.0"?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:core="http://www.milyn.org/xsd/smooks/smooks-core-1.3.xsd"
xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.3.xsd">
<!-- NOTE NOTE NOTE -->
<!-- This is purely to map user or person props to the LDAP name. Anything that is handled -->
<!-- explicitly (like firstname or lastname) does not get mapped -->
<jb:bean beanId="UserOrPerson" class="java.util.Properties" createOnElement="com.hyro.spmlservice.generated.objectmodel.PersonType">
<jb:value property="employeeNumber" decoder="String" data="personID" />
<jb:value property="mobile" decoder="String" data="mobileTel" />
<jb:value property="facsimileTelephoneNumber" decoder="String" data="workFax" />
<jb:value property="telephoneNumber" decoder="String" data="workTel" />
<jb:value property="description" decoder="String" data="title" />
<jb:value property="l" decoder="String" data="customAttr27" />
<jb:value property="physicalDeliveryOfficeName" decoder="String" data="customAttr8" />
<jb:value property="postalCode" decoder="String" data="customAttr7" />
</jb:bean>
<jb:bean beanId="UserOrPerson" class="java.util.Properties" createOnElement="com.hyro.spmlservice.generated.objectmodel.UserType">
<jb:value property="firstName" decoder="String" data="firstName" />
<jb:value property="lastName" decoder="String" data="lastName" />
<jb:value property="user" decoder="String" data="userID" />
<jb:value property="displayName" decoder="String" data="customAttr4" />
<jb:value property="postalCode" decoder="String" data="customAttr2" />
<jb:expression property="mail" execOnElement="emailAddresses">
if(1 == 2) {
return emailAddresses[0].emailAddress;
}
else {
return "NOT FOUND";
}
</jb:expression>
</jb:bean>
<jb:bean beanId="emailAddresses" class="java.util.ArrayList" createOnElement="emailAddresses">
<jb:wiring beanIdRef="emailAddressType" />
</jb:bean>
<jb:bean beanId="emailAddressType" class="com.hyro.spmlservice.generated.objectmodel.EmailAddressType" createOnElement="com.hyro.spmlservice.generated.objectmodel.EmailAddressType">
<jb:value property="modificationMode" decoder="Short" data="modificationMode" />
<jb:value property="emailAddress" decoder="String" data="emailAddress" />
<jb:value property="type" decoder="String" data="type" />
<jb:value property="primary" decoder="Boolean" data="primary" />
</jb:bean>
</smooks-resource-list>
Any Ideas? I've wasted 3 days getting to this point....
--
Paul Edwards
14 years, 5 months
Problem with DRL language/ XLS decision tables.
by tom ska
Hello,
I have a problem with defining rules. I insert many, many objects (facts) to
ksession object (StatefulKnowledgeSession). I want to fire rules for
*all*of them(facts), but I want to fire only one rule from all rules
for each one
fact(not always this same rule is fired, because I use salience).
activation-group is not appropriate, because it works only with one object
(fact) - rest is not processed by engine.
Second question is: how can I stop processing rules, bot only for one fact,
not for all of them.
Thanks,
tom.
P.S. forgive me my English... :)
P.S.2 Firstly I want to do this in DRL, then, I'll try with XLS, and write
post if I would find problems...
14 years, 5 months
Re: [rules-users] Drools Integration
by santosh mukherjee
Hi,
I am trying to integrate Drools with Apama. I have Apama installed and want
to pass the events mathched through Apama into Drools. Need help as to how
to proceed doing this. Basically I want that whenever a certain event
matches and is caught by Apama. I want to send it to the drl files which
will check the criteria and start relevant process.
Thanks
Santosh Mukherjee
14 years, 5 months
Help : Can't see process in gwt-console
by Han Ming Low
Hi,
I'm trying to start a sample process in the gwt-console by following a video
tutorial and list thread
http://blog.athico.com/2009/10/drools-51-m1-release-notes.html
http://markmail.org/message/y4sae37xvv44shhh
What I did was
- start h2
- start human task
- start jboss
It looks to me that all the services are started without error.
However, I'm not seeing the process in the gwt-console -> Processes view.
The process I have loaded in Guvnor is not available in the gwt-console.
I have uploaded 2 processes in Guvnor through Eclispe.
1 of them is a .rf file and the other is a bpmn file.
And, I also notice that the Settings -> System view, the ProcessEnginePlugin
is still a red cross.
And, the log shows
10:38:00,062 INFO [STDOUT] 10:38:00,062 INFO [PluginMgr] Successfully
loaded plugin 'org.jboss.bpm.console.server.plugin.FormDispatcherPlugin':
class org.drools.integration.console.forms.FormDispatcherComposite
10:38:00,062 INFO [STDOUT] 10:38:00,062 INFO [PluginMgr] Successfully
loaded plugin 'org.jboss.bpm.console.server.plugin.GraphViewerPlugin': class
org.drools.integration.console.graph.GraphViewerPluginImpl
10:38:00,078 INFO [STDOUT] 10:38:00,078 WARN [PluginMgr] Unable to load
plugin: 'org.jboss.bpm.console.server.plugin.ProcessEnginePlugin'
I have upload some screenshots of the different pages to here.
http://img826.imageshack.us/g/gwtconsolesystem.jpg/
Thanks for any advice.
Han Ming
14 years, 5 months