Problems with repeated execution of rules
by Dmitri Pissarenko
Hello!
I have following rules file:
import java.util.List;
global List outErrorCodes;
global Boolean condition1;
global Boolean condition2;
global Boolean condition3;
rule "01"
when
eval( condition3 == false);
then
outErrorCodes.add("ERROR_CODE1");
System.out.println("01");
end
rule "02"
when
eval((condition1 == true) && (condition2 == true));
then
outErrorCodes.add("ERROR_CODE2");
System.out.println("02");
end
When I evaluate this file repeatedly, it is evaluated correctly only
the first time.
I don't understand why it happens, because I always create a new
knowledge base for every execution (I don't re-use sessions).
Here is the code:
final KnowledgeBase knowledgeBase2 = createKnowledgeBase(getRuleFileNames());
final StatefulKnowledgeSession session2 =
knowledgeBase2.newStatefulKnowledgeSession();
...
Then, I set condition1, condition2 and condition3 with calls like this:
session2.setGlobal(curName, curValue);
curValue is Boolean.TRUE or Boolean.FALSE.
Then, I insert the value of the output variable:
session2.setGlobal("outErrorCodes",
new LinkedList<String>());
Then, I invoke these methods:
session2.fireAllRules();
...
session2.dispose();
After fireAllRules, outErrorCodes is always empty (apart from the
first run), even in cases, where rule "01" should apply.
What am I doing wrong?
Thanks in advance
Dmitri
13 years, 10 months
java.lang.RuntimeException: Unexpected global
by Saleem Lakhani
Hi,
What is the actual reason for this error? Why cant drools give some
better explaination of this problem when the exception is thrown.
Here is the snippet of my code:
workingMemory.setGlobal("validationErrorHierarchy",
validationErrorHierarchy); //workingMemory is StatefulKnowledgeSession
I am using the following variable in dslr:
global com.model.ValidationErrorHierarchy validationErrorHierarchy;
thanks
saleem
13 years, 10 months
Caused by: java.lang.NullPointerException at org.drools.persistence.jta.JtaTransactionManager.rollback(JtaTransactionManager.java:181)
by odelyaholiday
Hi!
I am working already for 3 days, trying to configure bitronix with spring
and drools.
I defined
1. persistence unit:
<persistence-unit name="org.drools.persistence.jpa" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/DS1</jta-data-source>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.Oracle10gDialect" />
<property name="hibernate.connection.autocommit" value="false" />
<property name="hibernate.max_fetch_depth" value="3" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.current_session_context_class" value="jta" />
<property name="hibernate.connection.driver_class"
value="oracle.jdbc.xa.client.OracleXADataSource" />
<property name="hibernate.jndi.class"
value="bitronix.tm.jndi.BitronixInitialContextFactory"/>
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.BTMTransactionManagerLookup" />
</properties>
</persistence-unit>
2. in my application context:
<!-- Bitronix Transaction Manager embedded configuration -->
<bean id="oracleDataSource"
class="bitronix.tm.resource.jdbc.PoolingDataSource"
init-method="init" destroy-method="close">
<property name="className"
value="oracle.jdbc.xa.client.OracleXADataSource" />
<property name="uniqueName" value="jdbc/DS1" />
<property name="maxPoolSize" value="5" />
<property name="allowLocalTransactions" value="true" />
<property name="testQuery" value="SELECT 1 FROM DUAL" />
<property name="driverProperties">
<props>
<prop key="user">myuser</prop>
<prop key="password">myuser</prop>
<prop key="URL">myurl</prop>
</props>
</property>
</bean>
<bean id="btmConfig" factory-method="getConfiguration"
class="bitronix.tm.TransactionManagerServices">
<property name="serverId" value="spring-btm" />
</bean>
<bean id="BitronixTransactionManager"
factory-method="getTransactionManager"
class="bitronix.tm.TransactionManagerServices" depends-on="btmConfig"
destroy-method="shutdown" />
<bean id="JtaTransactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager" ref="BitronixTransactionManager" />
<property name="userTransaction" ref="BitronixTransactionManager" />
</bean>
<!-- end of Bitronix Transaction Manager embedded configuration -->
3. and in the code:
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
env.set(EnvironmentName.GLOBALS, new MapGlobalResolver());
env.set(EnvironmentName.TRANSACTION_MANAGER,
TransactionManagerServices.getTransactionManager());
ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null,
env);
However in the last code I get:
Caused by: java.lang.IllegalStateException:
java.lang.reflect.InvocationTargetException
at
org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommanService(KnowledgeStoreServiceImpl.java:130)
at
org.drools.persistence.jpa.KnowledgeStoreServiceImpl.newStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:54)
at
org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:109)
at
com.mycompany.util.BookWorkflowUtilities.createSession(BookWorkflowUtilities.java:83)
at com.mycompany.util.BookWorkflowService.init(BookWorkflowService.java:62)
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.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:340)
at
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:293)
at
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:130)
... 29 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommanService(KnowledgeStoreServiceImpl.java:116)
... 40 more
Caused by: java.lang.RuntimeException: Could not commit session or rollback
at
org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:133)
... 45 more
Caused by: java.lang.RuntimeException: Unable to rollback transaction
at
org.drools.persistence.jta.JtaTransactionManager.rollback(JtaTransactionManager.java:184)
at
org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:131)
... 45 more
Caused by: java.lang.NullPointerException
at
org.drools.persistence.jta.JtaTransactionManager.rollback(JtaTransactionManager.java:181)
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Caused-by-java-lang-N...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months
Requesting your help for a Survey on data privacy while using web services
by vishal dwivedi
Dear Drools Flow Users,
We are researchers at Carnegie Mellon University who are conducting a survey
of users who compose web services in their workflows to build applications.
One of the goals of this survey is to better understand the privacy concerns
of web service users (or lack thereof), and how well users are able to
resolve these concerns. Even if you have no data privacy and security
problems while using web services, we would still appreciate your feedback
because that would give us a better perspective of the problem scenario.
Please take time to fill the following questionnaire:
https://www.surveymonkey.com/s/YQP39DG<https://www.surveymonkey.com/s/Y9FM836>
The survey consists of maximum 17 questions and can be completed in about 10
minutes. There are no correct or incorrect responses. This survey is
approved by CMU Institutional Review Board (IRB), and would follow the
appropriate safety protocols set by the IRB (Protocol Number: HS11-091). All
responses would be treated confidentially and will not be traceable to
individual respondents.
Thank you in advance for your assistance and time !!
Best Regards,
Vishal Dwivedi and Kunn Niu
Carnegie Mellon University,
Pittsburgh, USA.
Email: vdwivedi(a)cs.cmu.edu & kunn(a)andrew.cmu.edu
13 years, 10 months
Using Diverging gateway on Drools Server
by Jon Gil
Hi all.
Currently I have a rule flow that uses one XOR diverging gateway. I can get
it working using some simple return true or return false, and can get it to
System.out.println as well. However, I cannot seem to get access to the
FactModel I've passed to the rule server.
I've tried adding a variable of the same type and name, as well as importing
the class in the constraints, but I didn't really expect those to work.
I've seen in one example that I need to add mapping to a my object when I
create the server HTTP request, but when I attempt this, none of the rules
fire at all.
Is it possible to use the factModel to make decisions on the a gateway like
this? Or would it just be simpler to add some Globals that I can write to in
a rule table that will fire first?
Cheers, and thanks.
J
13 years, 10 months
Drools for test case formulation
by Dmitri Pissarenko
Hello!
I am testing a rather complex system, which behaves according to some
business rules (written as semi-formal text).
The goal is to create test cases, which cover as many states of the
system as possible. I want to automate this task in the following way:
1) Formalize the business rules in Drools
2) Then use some mechanism to create a list of all possible situations
(which need to be tested)
For example, I have following business rule package with two rules
(this is only an example, real business rules are much more complex):
global List outErrorCodes;
global Boolean condition1;
global Boolean condition2;
global Boolean condition3;
rule "01"
when
eval( condition3 == false);
then
outErrorCodes.add("ERROR_CODE1");
end
rule "02"
when
eval((condition1 == true) && (condition2 == true));
then
outErrorCodes.add("ERROR_CODE2");
end
condition1, condition2 and condition3 are inputs. outErrorCode is the output.
That is, condition1, condition2 and condition3 describe a certain
situation, and outErrorCode describes the expected behaviour of the
system in that particular situation.
I want to create a mechanism, which automatically creates a list of
all possible tuples (condition1, condition2, condition3,
outErrorCodes), based on the logic in the rules. Each tuple represents
a state of the system.
These tuples will then be used as a basis for creating actual test cases.
Is it possible with Drools? If so - how?
Many thanks in advance
Dmitri
13 years, 10 months
taskService restart problem (urgent response needed)
by KiranP
i m having 2-3 tasks in my flow the flow works fine in the normal conditions
the tasks are handled by the MinaTaskServer and MinaTaskClient but the
problem is that it uses the command and the call back mechanism using the
map of tasks request (if i m not wrong) hence when the taskservice restarts
all the callback refrence is lost and completing any task wont updated to
the MinaTaskServer (even if the task is available)
can any one hint me who i can achieve trans-restart task completion.....
till today none of my posts got a reply..............i think u r all
busy............if some one gets time plz help....
bcoz now it has become a grave matter.........it urgent...
thanks
-----
Keep Working >>:working:
KiranP
--
View this message in context: http://n3.nabble.com/taskService-restart-problem-urgent-response-needed-t...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months
drools and gwt-console
by Francois Le Fevre
Dear all
I am a newbie to drools.
I have installed the guvnor, designer in JBoss5.1 with a mysqldatasource
I didn't find any documentation on how to install gwt-console.
I have
* downloaded the 2 war
* putted in the deploy
But I need surely to configure a datasource ?
to configure the access ?
Is it link to the same datasource as guvnor ?
Thanks a lot for your help.
Francois
--
--
*Francois LE FEVRE*
Ingenieur
Email: flefevre(a)genoscope.cns.fr <mailto:flefevre@genoscope.cns.fr>
Tel: 33 (0)1 60 87 45 83
Fax: 33 (0)1 60 87 25 14
*Laboratoire d'Analyses Bioinformatiques pour la Génomique et le
Métabolisme -- LABGeM --
CEA / DSV / FAR / IG / Genoscope
(French Atomic Energy Commission)
*
Website: http://www.genoscope.cns.fr/agc/
Mail: 2 rue Gaston Cremieux,, CP 5706 91057 Evry, France
13 years, 10 months
how to modify Changeset.xml
by Sathya Prakash
Hi ,
How to modify changeset.xml through drools guvnor console?
--
Cheers,
Sathya Prakash.
**
13 years, 10 months