RE: [rules-users] ClassNotFoundException when using a function in a rule
by Antonio Giurini
I am having a similar problem, but I'm using java 14 (for compatibility with
a third party library):
java.lang.NoClassDefFoundError: Validity/ScadenzaCalcolata
at ASMAccessorImpl_140430961206010324450.getValue(Unknown Source)
Could someone suggest another workaround?
Is there a know bug? How can I check for bugs
thanks, A.
Switched from java 1.6 to java 1.5 and I don't have the problem anymore . So
I guess there is some issue with functions and java 1.6 in release 4.0.4
--zoly
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Zoltan Farkas
Sent: Tuesday, March 04, 2008 11:33 AM
To: Rules Users List
Subject: [rules-users] ClassNotFoundException when using a function in a
rule
Here is the exception:
Exception in thread "mythread" java.lang.NoClassDefFoundError:
com/daxtechnologies/optima/fault/eventprocessor/NewEvent
at ASMAccessorImpl_716163221204646531490.getValue(Unknown Source)
at org.mvel.ASTNode.getReducedValueAccelerated(ASTNode.java:174)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
--
View this message in context: http://www.nabble.com/Executing-BRMS-Snap-shot-tp15819564p16091916.html
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 8 months
Atlanta area contact?
by Benjamin McMillan
Hi all,
Is anyone involved in (as in, an actual dev or lead) Drools residing in
the Atlanta area, by any chance?
Thanks,
Benjamin J McMillan | Application Development Analyst
Software Research Center
Aflac Incorporated
Tel: 770-448-9823 x. 8964 | Fax: 770-448-4770
3720 DaVinci Court, Suite 225, Norcross GA 30092
BMcMillan2(a)aflac.com | aflac.com
This e-mail and any attachments may contain confidential information
intended solely for the use of the addressee. If the reader of this
message is not the intended recipient, any distribution, copying, or use
of this e-mail or its attachments is prohibited. If you received this
message in error, please notify the sender immediately by e-mail and
delete this message and any copies. Thank you
Confidentiality Notice:
This e-mail and any attachments may contain confidential information intended solely for the use of the addressee. If the reader of this message is not the intended recipient, any distribution, copying, or use of this e-mail or its attachments is prohibited. If you received this message in error, please notify the sender immediately by e-mail and delete this message and any copies. Thank you.
16 years, 8 months
Upgrade 4.0.4 to 4.0.5 failed !?
by Markus Helbig
Dear Drools users,
i tried to replace Drools 4.0.4 with 4.0.5 and know i get the following errors:
[20.03.08 09:21:24:100 CET] 00000036 SystemOut O 2008-03-20
09:21:24 XXX XXXX ERROR Exception executing predicate
org.drools.base.mvel.MVELPredicateExpression@329c329c -
org.drools.RuntimeDroolsException: Exception executing predicate
org.drools.base.mvel.MVELPredicateExpression@329c329c
org.drools.RuntimeDroolsException: Exception executing predicate
org.drools.base.mvel.MVELPredicateExpression@329c329c
at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:216)
at org.drools.rule.OrConstraint.isAllowed(OrConstraint.java:50)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:145)
at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:145)
at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:145)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
at org.drools.reteoo.Rete.assertObject(Rete.java:175)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:915)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:887)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:688)
Caused by:
java.lang.ClassCastException:
org/drools/rule/AbstractCompositeConstraint$MultiFieldConstraintContextEntry
incompatible with
org/drools/rule/PredicateConstraint$PredicateContextEntry
at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:209)
at org.drools.rule.OrConstraint.isAllowed(OrConstraint.java:50)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:145)
at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:145)
at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:145)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
at org.drools.reteoo.Rete.assertObject(Rete.java:175)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:915)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:887)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:688)
What do i have to change? Do i miss sth important?
Cheers
Markus
16 years, 8 months
firing rules dynamically
by hanumesh.m
Hi,
I am working with an application, where in it does polls a directory
regularly. When ever it finds a file in the directory, it reads the file
name ( which contains some mask say ABC-834-xxxx ), which my application
sets the ABC-834 to bean of rules. Based on this mask, the targetQ for this
file-content will be decided.
I am able to do that using .drl file. But as partners increase new files
with their masks will be placed in the source folder. So I have an admin
module which creates partners with the details of mask, sourceQueue and
destinationQ which will act as my rules.
I need to get all the rules from the database as soon as I found a file in
the source folder, so that I can fire all the rules and decide on the target
queue.(Assuming, partner details will be upadted using admin module)
Any help for this situation will be very helpful.
Thanks in Advance,
Hanumesh M
--
View this message in context: http://www.nabble.com/firing-rules-dynamically-tp16142265p16142265.html
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 8 months
Drools and Repast S
by Marcus Lunzenauer
Hi,
I am trying to use Drools inside of my Repast S[1] project. I have got
some errors running my simple rules:
> Unable to resolve ObjectType 'Message' : [Rule name=Your First Rule,
> agendaGroup=MAIN, salience=0, no-loop=false]
> test.MessageRule Compilation error : [Rule name=Your First Rule,
> agendaGroup=MAIN, salience=0, no-loop=false]
> apackage/Rule_Your_First_Rule_0.java (2:25) : Only a type can be
> imported. test.Message resolves to a package
> apackage/Rule_Your_First_Rule_0.java (7:250) : message cannot be
> resolved
There are two Java classes involved:
* MyAgent.class - my Repast S agent (basically a modified
HelloWorldExample from the Drools examples)
* Message.class - a bean
Both live in the package test.
My rule file consists of:
> package apackage
> import test.Message;
>
> rule "Your First Rule"
> when
> Message( message : message )
> then
> System.out.println(message);
> end
When I am running my MyAgent class as a Java application, everything is
ok. But if I am incorporating my MyAgent class into Repast S, I get the
aforementioned error.
So how can I find the source of this error? Does anyone have a clue how
to proceed?
I would be so glad, if you could help me. (Using JESS would be much less
fun :-)
Best Regards,
Marcus
[1]: http://repast.sourceforge.net/
16 years, 8 months
use data enumeration in DSL in BRMS
by Felbecker, Tobias
Hi,
I have a following DSL sentence defined:
[when] when the fact field is {field} =Fact(field=="{field}") ....
And I have a defined a data enumeration :
'Fact.field' : (new com.helper.DataProvider()).getValues()
When you choose "Add a restriction on a field" then I get the dropdown
with the values but when I choose the DSL sentence that I have a input
field.
Is it possible to have the dropdown values in the dsl sentence??
Cheers Tobi
16 years, 8 months
Uploading the fact model to the DRools BRMS
by Felbecker, Tobias
Hi, I fixed the Problem.
First I got rid of the Error
[STDOUT] ERROR 16-01 11:42:25,609 (Contexts.java:flushAndDest
royContexts:335) could not discover transaction status ...
by editing the web.xml of drools-jbrms ear. I found that earlier in this
list.
After that my exception changed into
java.lang.UnsupportedClassVersionError: Bad version number in .class
file ....
So I created my jars with some different Java versions and with jdk 1.6
the exception was gone. I don't why this is, cause drools and JBoss
should work with 1.5.
Cheers Tobi
Message: 2
Date: Tue, 18 Mar 2008 18:11:31 +0100
From: "Felbecker, Tobias" <t.felbecker(a)sap.com>
Subject:
To: <rules-users(a)lists.jboss.org>
Message-ID:
<72C6F8BBBED23343950D2C03D78E1BF84D3978(a)dewdfe1g.wdf.sap.corp>
Content-Type: text/plain; charset="us-ascii"
Hi ,
I got the same problem and wonder if there is a solution for that yet.
I'am using
JBOSS: AS 4.2.2 GA
DBMR: 4.0.4
JAVA: 1.5.0_15
After uploading the jar, editing the import in the package configuration
and finally validating the package I get the following exception:
java.lang.reflect.InvocationTargetException at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at
org.jboss.seam.util.Reflections.invoke(Reflections.java:21) at.....
The import statement should and the packaging of the jar file seems to
be correct. Otherwise there would be a Class not found error but no
exception.
I tried all kinds of packaging: binaries, source and binaries, creating
the jar through eclipse and from cmd.
This is my very simple java class:
package test;
public class MyBean{
public MyBean(){
}
private int number;
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
}
Cheers Tobi
16 years, 8 months
Trouble with insertlogical
by XIAOTAO
Hi,
i modified the shopping example from drool 4.0.4 example downloaded from jboss website in order to have a better understanding of insertlogical.
the rule is as follows
package org.drools.examples
dialect "mvel"
import org.drools.examples.ShoppingExample.Customer
import org.drools.examples.ShoppingExample.Product
import org.drools.examples.ShoppingExample.Purchase
import org.drools.examples.ShoppingExample.Discount
rule "Purchase notification"
salience 10
when
$c : Customer()
$p : Purchase( customer == $c)
then
System.out.println( "Customer " + $c.name + " just purchased " + $p.product.name );
end
rule "Discount removed notification"
when
$c : Customer()
not Discount( customer == $c )
then
$c.discount = 0 ;
System.out.println( "Customer " + $c.name + " now has a discount of " + $c.discount );
end
rule "Discount awarded notification"
when
$c : Customer()
$d : Discount( customer == $c )
then
System.out.println( "Customer " + $c.name + " now has a discount of " + $d.amount );
end
rule "Apply 10% discount if total purcahses is over 100"
no-loop true
dialect "java"
when
$c : Customer()
$i : Double(doubleValue > 100) from accumulate ( Purchase( customer == $c, $price : product.price ),
sum( $price ) )
then
$c.setDiscount( 10 );
insertLogical( new Discount($c, 10) );
System.out.println( "Customer " + $c.getName() + " now has a shopping total of " + $i );
end
my java lanucher
package org.drools.examples;
import java.io.InputStreamReader;
import org.drools.FactHandle;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.StatefulSession;
import org.drools.audit.WorkingMemoryFileLogger;
import org.drools.compiler.PackageBuilder;
public class ShoppingExample {
public static final void main(String[] args) throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( ShoppingExample.class.getResourceAsStream( "Shopping.drl" ) ) );
final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( builder.getPackage() );
final StatefulSession session = ruleBase.newStatefulSession();
final WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger( session );
logger.setFileName( "log/shoppingExample" );
Customer mark = new Customer( "mark",
0 );
session.insert( mark );
Product shoes = new Product( "shoes",
900 );
session.insert( shoes );
Product hat = new Product( "hat",
160 );
session.insert( hat );
session.insert( new Purchase( mark,
shoes ) );
session.insert( new Purchase( mark,
hat ) );
session.fireAllRules();
Product pent = new Product("pent", 100);
session.insert(new Purchase(mark, pent));
System.out.println( "Customer mark also buy the pent" );
session.fireAllRules();
logger.writeToDisk();
}
public static class Customer {
private String name;
private int discount;
public Customer(String name,
int discount) {
this.name = name;
this.discount = discount;
}
public String getName() {
return name;
}
public int getDiscount() {
return discount;
}
public void setDiscount(int discount) {
this.discount = discount;
}
}
public static class Discount {
private Customer customer;
private int amount;
public Discount(Customer customer,
int amount) {
this.customer = customer;
this.amount = amount;
}
public Customer getCustomer() {
return customer;
}
public int getAmount() {
return amount;
}
}
public static class Product {
private String name;
private float price;
public Product(String name,
float price) {
this.name = name;
this.price = price;
}
public String getName() {
return name;
}
public float getPrice() {
return price;
}
}
public static class Purchase {
private Customer customer;
private Product product;
public Purchase(Customer customer,
Product product) {
this.customer = customer;
this.product = product;
}
public Customer getCustomer() {
return customer;
}
public Product getProduct() {
return product;
}
}
}
i got the following output after i ran the java code
Customer mark just purchased hat
Customer mark just purchased shoes
Customer mark now has a shopping total of 1060.0
Customer mark now has a discount of 10
Customer mark also buy the pent
Customer mark just purchased pent
Customer mark now has a discount of 0
Customer mark now has a shopping total of 1160.0
Customer mark now has a discount of 10
i don not know why "Customer mark now has a discount of 0" still get printed. As my understanding, the insertion of the pent purchase should still keep the "Apply 10% discount if total purcahses is over 100" rule valid, so the logical Discount is not retracted which means that the engine should not print out the "
Customer mark now has a discount of 0". However i got the opposite answer.
is my understanding wrong or i miss something ?
I am running drools 4.0.4
Thanks for any help
Regards,
Tao
_________________________________________________________________
MSN圣诞礼物火热登场,免费发放中,快来领取吧!
http://im.live.cn/emoticons/?ID=18
16 years, 8 months