Date equal comparison fails - don't understand why
by Saloojee, Karim
Hi
I am comparing SimpleAccount( dateAccountOpened == "5-Feb-2011")
where dateAccountOpened is "Sat Feb 05 00:00:00 GMT+02:00 2011" (if you
call toString()). The equal comparator fails (==) but the greater than
comparator passes (>) which I don't understand.
I feel I am missing something obvious here, but I have no idea what it
is.
rule "Test date equality"
when
$acc : SimpleAccount( dateAccountOpened == "5-Feb-2011")
then
System.out.println("Expected and found an account opened
on 5-Feb-2011: " + $acc);
end
rule "Some dates are more equal than others"
when
$acc : SimpleAccount( dateAccountOpened > "5-Feb-2011")
then
System.out.println("Unexpected match: " +
$acc.getDateAccountOpened());
end
Regards,
Karim
To read FirstRand Bank's Disclaimer for this email click on the following address or copy into your Internet browser:
https://www.fnb.co.za/disclaimer.html
If you are unable to access the Disclaimer, send a blank e-mail to
firstrandbankdisclaimer(a)fnb.co.za and we will send you a copy of the Disclaimer.
11 years, 1 month
Transaction problems in high concurrency JBPM+Drools+Hibernate instalation
by Alberto R. Galdo
Hi guys,
We have an application built around long running JBPM processes with a
large user base and high concurrency ... early on we began to have issues
with transactions in JBPM and nowadays are watching lots of different
realizations of transaction managing problems that lead to dead human tasks
( state: ERROR ), errors running processes and so on ( different
exceptions follows ):
13:22:48,261 WARN [org.drools.persistence.jta.JtaTransactionManager]
(pool-11-thread-1) Unable to commit transaction:
javax.transaction.RollbackException: ARJUNA016053: Could not commit
transaction
Caused by: javax.persistence.PersistenceException: error during managed
flush
Caused by: javax.transaction.RollbackException: ARJUNA016053: Could not
commit transaction.
at
com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1177)
at
com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:117)
at
com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
at
org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:167)
at
org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:179)
[drools-persistence-jpa-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
Caused by: javax.persistence.PersistenceException:
org.hibernate.HibernateException: Flush during cascade is dangerous
at
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1361)
[hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289)
[hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
11:46:23,754 ERROR [stderr] (schedulerVT_Worker-8)
javax.persistence.PersistenceException: org.hibernate.HibernateException:
proxy handle is no longer valid
11:46:23,754 ERROR [stderr] (schedulerVT_Worker-8) at
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1361)
11:46:23,755 ERROR [stderr] (schedulerVT_Worker-8) at
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289)
11:46:23,756 ERROR [stderr] (schedulerVT_Worker-8) at
org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:261)
11:46:23,756 ERROR [stderr] (schedulerVT_Worker-8) at
So, we're running this installation by the manual. Are using JBoss 7 as
application server, it's transaction manager, Hibernate 4.x as entity
manager, our connection pool delivers READ_COMMITED connections ( so does
hibernate ) ...
Is there anything else we should be doing to avoid this transactional
problems? Has anyone ever tested JBPM in such concurrent scenario? Any
experiences?
Alberto R. Galdo
argaldo(a)gmail.com
11 years, 1 month
Drools server and knowledge agent functionality
by Manuel Ortiz
Hello everybody:
I am taking a look at Drools Integration documentation to understand how
Drools server works and how can be used, and have a doubt concerning, let's
say... 'KnowledgeAgent capabilities'. Does Drools server support on the fly
rule updating as when using KnowledgeAgent to create KnowledgeBase objects?
If it does, where can be configured 'KnowledgeAgent related' properties such
as newInstance or resource scanner interval?
Thank you in advance for your time.
Kind regards,
Manuel Ortiz.
11 years, 2 months
Question about custom accumulation functions
by Bruno Freudensprung
Hi,
While testing my custom accumulation function I noticed an unexpected
behavior (th'ats of course a personal point of view).
It seems that Drools 5.1 calls accumulate(...) and getResult(...) as
many times as the number of accumulated facts (accumulate, getResult,
accumulate, getResult, etc...).
Is it supposed to work like this?
Best regards,
Bruno.
11 years, 2 months
Dependency enumeration
by agarwalk
Hi
I have created following enumeration and java class file.
*Enumeration:*
'OrderData.propertyState':(new com.asps.rules.OrderData()).loadStates()
'OrderData.fulfillmentReviewerName[propertyState]':'(new
com.asps.rules.OrderData()).loadReviewers("@{propertyState}")'
*Java class:*
public class OrderData implements Serializable {
private String propertyState;
private String fulfillmentReviewerName;
// getters and setters
public List<String> loadStates() {
List<String> states = new ArrayList<String>();
states.add("CA");
states.add("NY");
states.add("FL");
return states;
}
public List<String> loadReviewers(final String propertyState) {
List<String> reviewers = new ArrayList<String>();
System.out.println("### in load reviewers ### : " + propertyState);
if ("CA".equalsIgnoreCase(propertyState)) {
reviewers.add("A");
reviewers.add("B");
System.out.println("Reviewers : A & B");
} else if ("NY".equalsIgnoreCase(propertyState)) {
reviewers.add("C");
reviewers.add("D");
System.out.println("Reviewers : C& D");
} else if ("FL".equalsIgnoreCase(propertyState)) {
reviewers.add("E");
reviewers.add("F");
System.out.println("Reviewers : E& F");
} else {
reviewers.add("G");
reviewers.add("H");
System.out.println("Reviewers : G& H");
}
return reviewers;
}
}
I created a rule as follows
WHEN
There is an OrderData with:
propertyState[propertyState]* FL* --- This is a drop down which
is being displayed correctly
fulfillmentReviewerName [fulfillmentReviewerName] -- This should
have been the drop down. Values are dependent on the state selected.
When i try to create above rule the enumeration is loaded correctly for
propertyState but the enumeration is not loaded for fulfillmentReviewerName
field. When I saw the logs the correct method and condition is being
invoked (as per Sys out)but drop down does not contain anything.
ANy suggestions?
--
View this message in context: http://drools.46999.n3.nabble.com/Dependency-enumeration-tp3245703p324570...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 3 months
Guvnor - Loading enums programatically using rule metadata
by GPatel@tsys.com
The Guvnor manual specifies how to load enum data programtically but it
seems like only other fields on the same Fact can be used to filter the
values that can show up in the drop-down fields, as shown below:
'Fact.field[dependentField1, dependentField2]' : '(new
com.yourco.DataHelper()).getListOfAges("@{dependentField1}",
"@{dependentField2}")'
Is it possible to somehow use other rule attributes, like package name or
rule metadata to filter the list? Something like the following:
'Fact.field[dependentField1]' : '(new
com.yourco.DataHelper()).getListOfAges("@{dependentField1}",
drools.getRule().getMetaData().get("ID"))'
Thanks
G. Patel
-----------------------------------------
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you
11 years, 4 months
how to debug rules in JBoss AS?
by Marina
Hello,
I know one can debug rules (put breakpoints in .drl and ruleflow files) when
running/debugging an application as a Drools Application.
However, I would like to debug rules when my application is running in JBoss AS
- just like we do a normal debugging of a Remote application running in a
different JVM ,by enabling the JDWP on the server
(-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n) and then
connecting to the specified port.
Basically, I would like to be able to debug both my Java classes and rules
together. Is it possible?
thanks,
Marina
11 years, 5 months
Re: [rules-users] java.lang.ClassCastException: [Lorg.drools.rule.Package; cannot be cast to org.drools.rule.Package
by Manasi
Hi,
I am also getting same error when trying to a call rule stored in guvnor.
Following error I am getting:
Exception in thread "main" java.lang.ClassCastException:
[Lorg.drools.rule.Package; cannot be cast to org.drools.rule.Package
at org.drools.agent.HttpClientImpl.fetchPackage(HttpClientImpl.java:82)
at org.drools.agent.URLScanner.readPackage(URLScanner.java:171)
at org.drools.agent.URLScanner.getChangeSet(URLScanner.java:143)
at org.drools.agent.URLScanner.loadPackageChanges(URLScanner.java:119)
at org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:427)
at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:379)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:364)
at org.drools.agent.RuleAgent.init(RuleAgent.java:264)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:204)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:164)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:273)
I am using Drools 5.4 version.
The error is coming when trying to get the RuleAgent:
RuleAgent agent = RuleAgent.newRuleAgent("/com/model/drools.properties");
drools.properties contains:
url =
http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/FeltKnapRes...
name=guvnorAgent
enableBasicAuthentication=True
username=admin
password=admin
FeltKnapRestriktionerKundeMedAnl is the package name I have created in
guvnor ,and I want to call one of the rule in this package.
Thanks,
Manasi
--
View this message in context: http://drools.46999.n3.nabble.com/java-lang-ClassCastException-Lorg-drool...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 5 months