Drools 6 inject ksession with configured persistence
by Jan Šťastný
Hi,
I have a kjar with kmodule.xml, where my kbase and its ksession are defined.
Then I'd like to inject the ksession into my service component and work
with it. But. I don't know where to configure persistence for the
session. Well, in kmodule.xml there is not such an entry. And after
injection there is no way of setting the EntityManagerFactory.
Thanks
Jan
12 years
Best practice with Guvnor repository
by Sean Su
If as an organization, we are using Guvnor to host our rules and we have
multiple rule based projects which may not have anything to do with each
other, what would be the recommended practice - having one web application
instance with different packages, or having multiple Guvnor instances
therefore the repository are totally separated?
Thanks
Sean
12 years
Loading rules from the filesystem?
by Leonard93
Can anyone here give me a good documentation place or thingy where I can read
about how to implement the drools 6 method of loading your rules from a
folder in the file system instead of inside the jar.
I have it working currently with the knowledgebase class, but since that is
deprecated I want to use the new classes. Although I read the drools
documentation about KieBase and such and programmatically defining your
kmodule. I did not really understand how that will help me load my rules
from a folder.
Basically what I want is that the rules located in C:\RulesFolder\rules.drl
will be loaded into my application and available within a stateless session.
Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/Loading-rules-from-the-filesystem-tp402...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
KnowledgeBase caching
by krzysztofcislo
Hi,
In our project we would like to cache KnowledgeBase once it's created
because compilation of rules takes long time and we can't afford to do it
every time we need to process rules.
Generaly we use ehCache as caching mechanism, but I am not sure if it's the
best way to just put KnowledgeBase instance there. KnowledgeBase can have
many inner objects and total size calculation is not efficient (ehCache
complains about it). Setting count limit to cache object, and not memory
limit can lead to out of memory or at least application performance
degradation.
Did anyone try to cache this object and reuse it further?
Thank you in advance for answers.
--
View this message in context: http://drools.46999.n3.nabble.com/KnowledgeBase-caching-tp4029276.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
java.lang.VerifyError: Bad type on operand stack
by lvtenorio
Hello,
I am writing a rules file and unit tests to test each one of them. I am
getting this error during the execution
java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
ConditionEvaluator81806ffb7242407db6e6d8f829f4fd4d.evaluate(Lorg/drools/core/common/InternalFactHandle;Lorg/drools/core/common/InternalWorkingMemory;Lorg/dr
ools/core/reteoo/LeftTuple;)Z @12: ireturn
Reason:
Type 'java/lang/Boolean' (current frame, stack[0]) is not assignable to
integer
Current Frame:
bci: @12
flags: { }
locals: { 'ConditionEvaluator81806ffb7242407db6e6d8f829f4fd4d',
'org/drools/core/common/InternalFactHandle',
'org/drools/core/common/InternalWorkingMemory',
'org/drools/core/reteoo/LeftTuple' }
stack: { 'java/lang/Boolean' }
Bytecode:
0000000: 2bb9 001b 0100 c000 1db6 0021 ac
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
at java.lang.Class.getConstructor0(Class.java:2803)
at java.lang.Class.getConstructor(Class.java:1718)
at
org.drools.core.rule.builder.dialect.asm.ClassGenerator.newInstance(ClassGenerator.java:197)
at
org.drools.core.rule.constraint.ASMConditionEvaluatorJitter.jitEvaluator(ASMConditionEvaluatorJitter.java:55)
at
org.drools.core.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:289)
at
org.drools.core.rule.constraint.MvelConstraint.access$200(MvelConstraint.java:53)
at
org.drools.core.rule.constraint.MvelConstraint$ConditionJitter.run(MvelConstraint.java:266)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
The tests don't stop running and keep working. Here is my pom in case it
helps
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>DroolsTest</groupId>
<artifactId>DroolsTest</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>2.1.8-01</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>6.1.0.Beta1</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>6.1.0.Beta1</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>knowledge-api</artifactId>
<version>6.1.0.Beta1</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.6</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
</dependency>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-1.6</artifactId>
<version>1.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
<configuration>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
<printSummary>true</printSummary>
<reportFormat>plain</reportFormat>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.9</version>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.17</version>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</reporting>
</project>
I am using IntelliJ IDEA13.0.2
--
View this message in context: http://drools.46999.n3.nabble.com/java-lang-VerifyError-Bad-type-on-opera...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
Free Form DRL through BRL in guided decision table
by Joe White
Does the workbench extended entry guided decision table support this kind of syntax:
ServiceLineStatusInfo( claimStatusCodes contains "$param" )
Where $param is replaced with the value of the column? When I add that through New Column->Add a Condition BRL Fragment->Free Form DRL all I get is a checkbox column. Is there a way to set that up so that it allows entry and does the substitution?
I know the line above could be built easily in other ways. It is just an example to illustrate. I have some more complex logical constructs that I'd like to do in straight DRL fragments if possible.
Thanks,
Joe
12 years
KnowledgeAgentImpl registeredResourceMap memory issue
by Cwen
We are seeing this HashMap (KnowledgeAgentImpl.registeredResourceMap) keeps
growing when a pkg is updated. It looks like creating more
CompositeClassLoader and not removing the old rule references. So it causes
KnowledgeAgentImpl use large memory. We are using 5.5.0.final.I am attaching
an image from memory analyzer to show how the HashMap holds up multiple
CompositeClassLoader and they are using about 230MB of memory. It increases
when the pkg gets updated with about 150 rules.
--
View this message in context: http://drools.46999.n3.nabble.com/KnowledgeAgentImpl-registeredResourceMa...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
Drools causes switch(enum e) to break?
by Leonard93
So I have a really weird problem and I think it could be relate-able to
Drools, or maybe not but maybe some people here have seen it before.
I have a simple enum called 'RuleTypes' which is defined in its own file.
I have somewhere in my class a switch statement where I use the enum like
this:
(The method is not finished, but its enough to show the problem)
public IResult EvaluateRule(Object obj, RuleType type)
{
//TODO
switch(type)
{
case Discount :
TripRequest lr = (TripRequest) obj;
_Session.execute(lr);
return lr.getResult();
case Content:
break;
case None:
break;
default:
break;
}
return null;
}
But I get an error saying 'Cannot switch on a value of type RuleType. Only
convertible int values or enum variables are permitted'. While RuleType an
enum is 100% sure.
Yet if I make a new project (with no drools libraries), make the same
RuleType enum in its own file and have an empty class doing:
public Test(RuleType type)
{
switch(type)
{
case Discount :
break;
case Content:
break;
case None:
break;
default:
break;
}
}
There are no compiler errors. Anyone know here what could possibly happen?
The only thing I could find was a possible Eclipse bug but that one had a
fix that does not work for me (
https://bugs.eclipse.org/bugs/show_bug.cgi?id=413368 ).
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-causes-switch-enum-e-to-break-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years