Server deployment
by Bertrand Grottier
Hello,
At the present time, I am in the learning process of Drools.
However, in the future, I will have to deploy a client - Drools server application. After a very quick (I confess) search, I did not found the documentation related to Drools server. Can someone provide me with this documentation and/or examples ?
At the present time, the future possible architecture is very fuzzy for me. Are there general rules ? Can someone give me some feedback on its own experiments ?
Thank you in advance.
Benoît
_________________________________________________________________
Consultez gratuitement vos emails Orange, Gmail, Free, ... directement dans HOTMAIL !
http://www.windowslive.fr/hotmail/agregation/
15 years, 11 months
[Flow 5.0] named query not found: ProcessInstancesWaitingForEvent
by Nol de Wit
[Drools Flow 5.0, mySql, running a flow from within Eclipse]
Hi All,
Trying to set up Persistence I moved back from 5.1.M1 to 5.0, hoping
for an easier ride. I've got a bit further, but still have errors
while running my flow.
Without Persistence my model executes fine. I've added persistence
much like the way it is explained in chapter 5 of the introduction.
My flow still executes, and in the sessioninfo table get's a record
after the execution. However, at the end of the execution there is an
exception, saying a named query is not found
(ProcessInstancesWaitingForEvent), see below. Since these mostly
reside in mapped classes, I realised that one table in de DB doesn't
have a mapping class in the persisence.xml definition. That table is
'processinstanceinfo_eventtypes'. Could that be the cause of this? If
not, what could be?
Below the stack, and part of my persistence.xml.
26-mrt-2010 9:40:54 bitronix.tm.journal.DiskJournal open
WARNING: active log file is unclean, previous server crash ?
26-mrt-2010 9:40:54 bitronix.tm.recovery.Recoverer run
INFO: recovery committed 0 dangling transaction(s) and rolled back 0
aborted transaction(s) on 1 resource(s) [jdbc/processInstanceDS]
Hibernate: insert into SessionInfo (dirty, lastModificationDate,
rulesByteArray, startDate) values (?, ?, ?, ?)
Fri Mar 26 09:40:59 CET 2010 DEBUG: Executing XA statement: XA START
0x3137322e31362e3230342e32320000012799a1a43700000000,0x3137322e31362e3230342e32320000012799a1a47600000002,0x42746e78
Fri Mar 26 09:40:59 CET 2010 DEBUG: Executing XA statement: XA END
0x3137322e31362e3230342e32320000012799a1a43700000000,0x3137322e31362e3230342e32320000012799a1a47600000002,0x42746e78
Fri Mar 26 09:40:59 CET 2010 DEBUG: Executing XA statement: XA COMMIT
0x3137322e31362e3230342e32320000012799a1a43700000000,0x3137322e31362e3230342e32320000012799a1a47600000002,0x42746e78
ONE PHASE
Hibernate: insert into ProcessInstanceInfo (lastModificationDate,
lastReadDate, processId, processInstanceByteArray, startDate, state,
OPTLOCK) values (?, ?, ?, ?, ?, ?, ?)
Fri Mar 26 09:40:59 CET 2010 DEBUG: Executing XA statement: XA START
0x3137322e31362e3230342e32320000012799a1a4e300000007,0x3137322e31362e3230342e32320000012799a1a51200000009,0x42746e78
bepaal scenario voor regel:
Hibernate: insert into ProcessInstanceInfo (lastModificationDate,
lastReadDate, processId, processInstanceByteArray, startDate, state,
OPTLOCK) values (?, ?, ?, ?, ?, ?, ?)
stuurdata ophalen voor rapportage BWB
bepaal scenario voor regel:
execute scenario 99 voor regel: BBI1
bepaal scenario voor regel:
execute scenario 99 voor regel: BBI2
bepaal scenario voor regel:
execute scenario 99 voor regel: BBI3
bepaal scenario voor regel:
execute scenario 99 voor regel: BBI4
java.lang.IllegalArgumentException: Named query not found:
ProcessInstancesWaitingForEvent
at org.hibernate.ejb.AbstractEntityManagerImpl.createNamedQuery(AbstractEntityManagerImpl.java:108)
at org.drools.persistence.processinstance.JPASignalManager.getProcessInstancesForEvent(JPASignalManager.java:50)
at org.drools.persistence.processinstance.JPASignalManager.signalEvent(JPASignalManager.java:29)
at org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:191)
at org.drools.workflow.instance.node.EndNodeInstance.internalTrigger(EndNodeInstance.java:56)
at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:111)
at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:141)
at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:128)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence
version="1.0"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="nl.dnb.avb.drools.jpa">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/processInstanceDS</jta-data-source>
<class>org.drools.persistence.session.SessionInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceEventInfo</class>
<class>org.drools.persistence.processinstance.WorkItemInfo</class>
<properties>
<!-- property name="hibernate.dialect"
value="org.hibernate.dialect.H2Dialect"/ -->
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.BTMTransactionManagerLookup"/>
</properties>
</persistence-unit>
</persistence>
15 years, 11 months
Persitence configuration issue in Drools Flow 5.1.M1 (PersistenceException/AnnotationException)
by Nol de Wit
Hi,
(using Droolw Flow 5.1.M1)
I've made a reasonably simple Drool Flow model, containing a ForEach,
a split and and a couple of actions. Without Persistence it works
nicely: I start it with one variable/parameter, a class I call Report
with 4 Lines of data . Each of the lines get's worked on correctly in
the ForEach.
Next I want to add Persistence to the model; I made a persistence.xml,
which is based on the one as shown in chapter 5 of the online Drools
Flow documentation. See below.
I changed the H2 db to a mysql DB.
The firs call (after creating the datasource) in my test now gives an
exception. See the call and exception below.
1) what's wrong? I think my persistence.xml is correct. So what is the
error trying to tell me? Is saying that I should map my parameters
data (Report and Line)? I just read an article from salaboy about
variable persistence 5.1, but I'm not using that...
2) What puzzles me is the link between the persistence.xml (containing
mapping info), and the datasource (containing the credentials of the
DB). In the doc and PerformanceTest.java class in the examples I don't
see any link. Is creating the DataSource enough to get it in JNDI?
Thanks,
Nol
Some of my code and config:
// See makeDataSource() below
PoolingDataSource ds = makeDataSource();
// this call gives an exception:
EntityManagerFactory emf =
Persistence.createEntityManagerFactory( "nl.dnb.avb.drools.jpa" );
25-mrt-2010 14:30:00 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class:
org.drools.persistence.processinstance.WorkItemInfo
25-mrt-2010 14:30:00 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity org.drools.persistence.processinstance.WorkItemInfo
on table WorkItemInfo
javax.persistence.PersistenceException: [PersistenceUnit:
nl.dnb.avb.drools.jpa] Unable to configure EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:265)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:125)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
at pilot.tests.DroolFlowPersistenceTest.main(DroolFlowPersistenceTest.java:41)
Caused by: org.hibernate.AnnotationException: Use of @OneToMany or
@ManyToMany targeting an unmapped class:
org.drools.persistence.processinstance.ProcessInstanceInfo.variables[org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo]
at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:1071)
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:602)
at org.hibernate.cfg.annotations.MapBinder$1.secondPass(MapBinder.java:79)
Persistence.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence
version="1.0"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="nl.dnb.avb.drools.jpa">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/processInstanceDS</jta-data-source>
<class>org.drools.persistence.session.SessionInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceEventInfo</class>
<class>org.drools.persistence.processinstance.WorkItemInfo</class>
<properties>
<!-- property name="hibernate.dialect"
value="org.hibernate.dialect.H2Dialect"/ -->
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.BTMTransactionManagerLookup"/>
</properties>
</persistence-unit>
</persistence>
private static PoolingDataSource makeDataSource() {
PoolingDataSource ds = new PoolingDataSource();
ds.setUniqueName("jdbc/processInstanceDS");
ds.setClassName("com.mysql.jdbc.jdbc2.optional.MysqlXADataSource");
ds.setMaxPoolSize(3);
ds.setAllowLocalTransactions(true);
ds.getDriverProperties().put("user", "drools");
ds.getDriverProperties().put("password", "drools");
ds.getDriverProperties().put("URL", "jdbc:mysql://DNB35362:3306/drools");
ds.init();
return ds;
}
15 years, 11 months
Activated rule not firing eventhough was never cancelled
by H.C.
I have about a dozen rules across various ruleflow groups orchestrated
through a ruleflow. I am trying to troubleshoot why a particular rule in a
downstream ruleflow group is not firing.
I see an activation created for this particular rule as facts are added to
working memory (by looking at the audit log). My ruleflow starts and I
insepct all cancelled activations for all subsequent fact
inserts/updates/retracts and don't see the rule's activation ever being
cancelled before it reaches the rule's ruleflow group activation. The rule's
ruleflow group is activated but the rule's activation isn't executed.
I would think I would see a cancellation of the rule if a prior fact change
had rendered the rule uneligible.
Why might this happen?
--
View this message in context: http://n3.nabble.com/Activated-rule-not-firing-eventhough-was-never-cance...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 11 months
Call class method from LHS of a rule
by orchid
Hi All,
I'm trying to call a class method from the LHS of a rule in the following
way:
public class Cheese{
private string type;
//setters and getters
public boolean existsInShop(String shop){
...
return true;
}
}
I would like to call the method "existsInShop" from a rule:
Rule "Rule1"
when
$c:Cheese(type == "chedar", existsInShop "shopName")
then
System.out.println("Rule1 is fired");
end
I get the compilation error: "no viable alternative at input "shopName" in
rule "Rule1" in pattern document". How can I call the method from the rule?
Thanks in advance.
--
View this message in context: http://n3.nabble.com/Call-class-method-from-LHS-of-a-rule-tp108383p108383...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 11 months
drools-guvnor, problem when creating test scenarios based on referenced domain model
by Krunoslav Sabljak
Hi all,
first of all, i appologise if i'm starting a topic that already exists (but
i couldn't find one :-)
i'm having some difficulties with creating test scenarios in guvnor when the
domain model is based on referenced objects.
Suppose we have a model like this one:
Class Role with attributes:
roleId: Long
roleName: String
Class User with attributes:
userId: Long
userName: String
firstName: String
lastName: String
role: Role
Then, lets suppose the rule like this one (it's pritty simple one)
rule "my first rule"
dialect "mvel"
when
usr: User(firstName=="John", lastName="Doe", role.roleName="ADMIN" )
then
usr.userName="ADMIN"
end
Now, i'm trying to create a test scenario for this rule. And my nightmare
begins...
Seems to me that there is no possibility to define referenced object in test
scenario, ie:
GIVEN
User [usr]
firstName = "..."
lastName = "..."
*role.roleName = "..."*
EXPECTING
..............
Hope that you can understand what i'm talking about. Can somebody (pretty
please) give me some directions how to achieve something like this in test
scenarios.
Thank you for your answers and suggestions (if any) :-))
15 years, 11 months