Problem creating package - validateUniqueRuleNames(PackageBuilder.java:830)
by Saleem Lakhani
Following is my code:
KnowledgeBuilderConfiguration kbc =
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
kbc.setProperty("drools.dialect.java.compiler", "JANINO");
KnowledgeBuilder builder = null;
builder = KnowledgeBuilderFactory.newKnowledgeBuilder(kbc);
Reader drlSource = new
InputStreamReader(RVEngine.class.getResourceAsStream(ruleset.getDrlSourc
e())); //ruleset.getDrlSource() = com/cit/myDrl.dslr
Reader dslSource = new
InputStreamReader(RVEngine.class.getResourceAsStream(ruleset.getDslSourc
e()));
builder.add(ResourceFactory.newReaderResource(dslSource),
ResourceType.DSL);
builder.add(ResourceFactory.newReaderResource(drlSource),
ResourceType.DSLR);
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(builder.getKnowledgePackages());
no matter what I type in my dslr (drl) file I get the following
exception on the highlighted line; ANY IDEA????
I have 1 rule or No rule it still throws the same exception. Does it
have to do with any jar files?
Caused by: java.lang.NullPointerException
at
org.drools.compiler.PackageBuilder.validateUniqueRuleNames(PackageBuilde
r.java:830)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:555)
at
org.drools.compiler.PackageBuilder.addPackageFromDslr(PackageBuilder.jav
a:355)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.j
ava:461)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.ja
va:28)
saleem
15 years, 3 months
'Long' and 'double' value comparing problem in drools 5.1.0
by Miles Wen
hi there,
I have a simple fact class:
public class Msg {
private Long lo = 5l;
private double dbl = 5.5;
public Long getLo() {
return lo;
}
public void setLo(Long lo) {
this.lo = lo;
}
public double getDbl() {
return dbl;
}
public void setDbl(double dbl) {
this.dbl = dbl;
}
}
and a simple drl program:
package com.sample
import com.sample.Msg;
rule "Hello World"
when
m:Msg(lo >= dbl)
then
System.out.println( "hello world" );
System.out.println(m.getLo());
System.out.println(m.getDbl());
end
I simply compare the Long value, which is 5, to the double value ,which is
5.5, with operator '>=', and the output is:
hello world
5
5.5
but it can't be ,cause 5 is less than 5.5.
then I modified the drl program a bit:
m:Msg(lo == dbl)
It successfully prints out the message as well.It seems that drools treated
the double value '5.5' as '5' in comparing...
Is this a bug or something?What could I do to correct it?
thanks.
15 years, 3 months
Drools Clustering & High Availability
by Carlos Santiago Moreno
Hi there! My team and I were thinking on implementing Drools Flow on a
project, running it on a Tomcat Apache server, but we have to investigate
some little details of this tools before taking any desition. The thing is,
that we have been searching, on a lots of forums, mailing lists, and blog
posts, but no one ever gives a direct answer to two particular questions.
The first one is, if Flow is compatible with clustering. Till now, we
understand that is not a problem if we use JBoss AS, but, as I said before,
we are planning to use Tomcat, so we don't know for sure if it will work.
The other question unanswered yet is, what can you tell us about the High
Availability. We need to know if it possible to set HA features on this
tool.
Everything you could tell us will be for help.
Carlos S. Moreno
15 years, 3 months
Drools Clustering & High Availability
by Carlos Santiago Moreno
Hi there! My team and I were thinking on implementing Drools Flow on a
project, running it on a Tomcat Apache server, but we have to investigate
some little details of this tools before taking any desition. The thing is,
that we have been searching, on a lots of forums, mailing lists, and blog
posts, but no one ever gives a direct answer to two particular questions.
The first one is, if Flow is compatible with clustering. Till now, we
understand that is not a problem if we use JBoss AS, but, as I said before,
we are planning to use Tomcat, so we don't know for sure if it will work.
The other question unanswered yet is, what can you tell us about the High
Availability. We need to know if it possible to set HA features on this
tool.
Everything you could tell us will be for help.
Carlos S. Moreno
15 years, 3 months
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
15 years, 3 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
15 years, 3 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.
15 years, 3 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
15 years, 3 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
15 years, 3 months