No inferred expiration when correlating events in Drools Fusion
by Alexandre Gattiker
Hello,
I am trying to use Drools Fusion (5.6.0 or 6.0.1) to correlate events, but
can't get the internal mechanism for expiring events to work in my rule.
I made up a simple example that detects duplicate messages over a short
time window. The rule below seems to work fine, but facts accumulate
indefinitely in the working memory. Changing window:length(1) to
window:time(10s) does not solve the issue.
declare DataEvent
@role(event)
end
rule "Detect duplicates"
when
DataEvent ( $text: text ) over window:length(1)
ArrayList( size >= 2 ) from collect( DataEvent( text == $text ) over
window:time( 10s ) )
then
System.err.println("Duplicate detected");
end
Now, if I change my condition to the following, I see that facts
automatically expire and are retracted after 10 seconds.
...when
ArrayList( size >= 10 ) from collect( DataEvent( ) over window:time(
10s ) )
then...
Many thanks in advance.
12 years, 1 month
Unable to deploy drool-workbench on tomcat 7
by Mohit Srivastava
Hi Everyone,
I tried to deploy drool-workbench on tomcat 7 . But I have encountered with
errors.
I am unable to figure out the reason, I like to get some help from you guys
.
2014-01-18 19:44:12,202 [http-bio-8081-exec-2] INFO KieModule was
added:ZipKieModule[
ReleaseId=org.drools:drools-wb-rest-defaultapprover:6.0.1.Finalfile=/usr/tomcat/apache-tomcat-7.0.50/webapps/drools-wb-6.0.1.Final-tomcat7.0/WEB-INF/lib/drools-wb-rest-defaultapprover-6.0.1.Final.jar]
2014-01-18 19:44:17,512 [http-bio-8081-exec-2] ERROR Failed to setup
Repository 'uf-playground'
java.lang.RuntimeException:
org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out:
NativeFSLock(a)/.index/write.lock
at
org.uberfire.metadata.backend.lucene.setups.DirectoryLuceneSetup.<init>(DirectoryLuceneSetup.java:78)
~[uberfire-metadata-backend-lucene-0.3.1.Final.jar:0.3.1.Final]
at
org.uberfire.metadata.backend.lucene.setups.NIOLuceneSetup.<init>(NIOLuceneSetup.java:31)
~[uberfire-metadata-backend-lucene-0.3.1.Final.jar:0.3.1.Final]
2014-01-18 19:44:17,926 [http-bio-8081-exec-2] ERROR Can't initialize
FileSystemProviders
java.util.ServiceConfigurationError:
org.uberfire.java.nio.file.spi.FileSystemProvider: Provider
org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider could not be
instantiated: org.uberfire.java.nio.IOException: java.net.BindException:
Address already in use
Thanks
--
Mohit
12 years, 1 month
Guvnor enumerations
by Stephen Masters
Hi folks,
I don't suppose anything notable changed between 5.3 and 5.5 in the way Guvnor loads data enumerations?
I have a number of enumerations similar to the following:
'MyFact.currencies' : (new com.myapp.guvnor.enums.CurrencyEnum()).isoCodes()
But I see the exception in Guvnor:
Unable to load enumeration data.
[Error: unable to invoke method: isoCodes] [Near :{... 'MyFact.': ….}] ^ [Line: 1, Column: 1]
Error type: org.mvel2.PropertyAccessException
The jar is in the lib directory, there is a method called "isoCodes()", and when I run the main class inside it then the various enumerations are returned. And yes, it did (does) work absolutely fine in 5.3 with this same configuration.
Steve
12 years, 1 month
Drools 6.0.0 Camel-server query results
by akjones33
Hi all - I'm just getting started with Drools and trying to get my first
query running through Camel-Server using XML. I had expected that a query
would return the objects found, with their attributes as XML elements but I
only get an identifier.
The query is
query "depositAccept"
dA: DepositAccept();
end
DepositAccept is defined in java as
public class DepositAccept {
private String message;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
In my XML batch execution command I have
<batch-execution lookup="ksession2">
<insert out-identifier="person1">
<samples.banking.Deposit>
<accountNumber>1</accountNumber>
<amount>1001</amount>
</samples.banking.Deposit>
</insert>
<fire-all-rules max="-1"/>
<query name="depositAccept" out-identifier="person2"/>
</batch-execution>
which gives me the response
<execution-results>
<result identifier="person1">
<samples.banking.Deposit>
<accountNumber>1</accountNumber>
<amount>1001</amount>
</samples.banking.Deposit>
</result>
<result identifier="person2">
<query-results>
<identifiers>
<identifier>dA</identifier>
</identifiers>
</query-results>
</result>
<fact-handle identifier="person1"
external-form="0:1:1485038299:1485038299:1:DEFAULT:NON_TRAIT"/>
</execution-results>
I take that to mean that "dA" exists (i.e. the query returns one object) but
I would have expected then to have the "message" attribute shown from the
DepoistAccount object that dA refers to. Is that possible ?
thanks
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-0-0-Camel-server-query-results...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
Planner with a list of planning variables
by Justin Case
Hello all,
can I use as planning variable a list of values?
Here's a test use case: planning a food recipe, where the recipe can have say maximally 5 ingredients (taken from the solution property, I guess). So far I could find in the examples and documentation, it's all about ONE planning variable in the solution, but here I'd need a LIST of such... is it actually doable this way?
I cannot do it the other way around, as an ingredient may be found in more recipes...
Many thanks,
JC
12 years, 1 month
permgen leak
by brachi
i'm using drools 5.5.0, after the rules deployment, (associate DRL's with the
KnowladBase and compile them)
my permgen grows to 500m, and also if i undeploy, the permgen doesn't
cleaned up. (only if i restart the server)
It won't help me to increase the permgen size, because the client does a lot
of heavy deployment, and can be in the maximum size by 3-4 deployments.
I tried this tomcat flags, and it does nothing:
-XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled
-XX:+CMSClassUnloadingEnabled -XX:+UseParNewGC
I tried set the flag : PermGenThreshold=0, like other people suggested in
your forums and it doesn't help.
any help? it's production issue...
--
View this message in context: http://drools.46999.n3.nabble.com/permgen-leak-tp4027038.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
Order of object creation in stateful session
by Dean Whisnant
Hi,
This may be a very basic question, but I'm using drools 5.1.1 and when I invoke a stateful session and that session ends I receive back all of the facts that were created during that session and I translate those into an EDI transaction. As an example I might have a few objects of types "2700*LX,2750* N1,2750* REF, and 2750*DTP". I know my rules fired create objects like:
LX*1
N1*75*CMSEC
REF*17*A
DTP*007*D8*20140114
LX*2
N1*75*STATUS
REF*17*AFTNM
DTP*007*D8*20140114
Each of these lines is an object of the type I mentioned above.
My task is to make sure that the different object types "stick" together when I put them in the .x12 file so that they are formatted above.
What I do internally is I keep track that I have two of each of these objects, but I don't know if there is some type of timestamp that is on them that I could keep the first LX, N1, REF, DTP together or not.
In one example I have a rule that inserts them in the order you see, yes, it literally inserts 8 objects/facts into memory. And I need to know the order they were inserted so that I can properly form a file out of them on the backend.
Here's how I grab the objects and factHandle list. Is there a method that might help me know what object was created by what rule and how I might keep facts created in a rule together?
// Get handle to all objects coming from drools
Collection<FactHandle> handleList = null;
try
{
handleList = ksession.getFactHandles();
}
catch (Exception e)
{
_log.error("kSession get Fact Handles. Error=" + e.getMessage());
}
// Build the List with the results from drools - objectOutList
Object anObject;
TranslatedObjectImpl aTranslatedObject;
FactHandle fH;
for (Iterator<FactHandle> it = handleList.iterator(); it.hasNext();)
{
fH = (FactHandle) it.next();
anObject = (Object) ksession.getObject(fH);
if (anObject instanceof String)
{
// prt("Ignoring back from drool the String object " + anObject.getClass().getCustomerLogName());
}
else if (anObject instanceof TranslatedObjectImpl)
{
aTranslatedObject = (TranslatedObjectImpl) ksession.getObject(fH);
objectOutList.add(aTranslatedObject);
if (_log.isTraceEnabled()) _log.trace("Back from drools, translated object " + anObject.getClass().getSimpleName());
}
else
{
objectOutList.add(ksession.getObject(fH));
if (_log.isTraceEnabled()) _log.trace("Back from drools, found object " + anObject.getClass().getSimpleName());
}
}
if (_log.isDebugEnabled()) _log.debug("Done with Transformer. Total number of Drools object = " + objectOutList.size());
ksession.dispose();
Any thoughts?
Thanks,
Dean
12 years, 1 month
KieBuilder.buildAll() causing exception
by waynemetcalfe
Hi Guys,
I'm a pretty recent Drools user.
I'm trying to update a project to stop using the deprecated KnowledgeBase.
I've followed examples on
http://blog.athico.com/2013/10/configuration-and-convention-based.html
<http://blog.athico.com/2013/10/configuration-and-convention-based.html> ,
but an exception is being thrown when trying to build the KieBases.
Drools version:6.0.0.Final
Java version: 1.7.0_45
Code snippet:
...
final KieServices ks = KieServices.Factory.get();
final KieRepository kr = ks.getRepository();
final KieFileSystem kfs = ks.newKieFileSystem();
//ruleScript is simply a string containing the rules
kfs.write("src/main/resources/com/company/test/rules/rules.drl",
ruleScript);
KieBuilder kb = ks.newKieBuilder(kfs);
kb.buildAll();
if (kb.getResults().hasMessages(Level.ERROR)){
configuration.getLog().error("\nSomething wrong here!\n\n");
}
final KieContainer kContainer =
ks.newKieContainer(kr.getDefaultReleaseId());
session = kContainer.newKieSession();
...
The following exception is thrown:
java.lang.instrument.IllegalClassFormatException: Error while instrumenting
class org/drools/compiler/lang/DRL6Lexer.
at
org.jacoco.agent.rt.internal_9dd1198.CoverageTransformer.transform(CoverageTransformer.java:89)
at
sun.instrument.TransformerManager.transform(TransformerManager.java:188)
at
sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:424)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at
org.drools.compiler.compiler.DRLFactory.getDRLLexer(DRLFactory.java:93)
at
org.drools.compiler.compiler.DRLFactory.buildLexer(DRLFactory.java:43)
at org.drools.compiler.compiler.DrlParser.parse(DrlParser.java:164)
at org.drools.compiler.compiler.DrlParser.parse(DrlParser.java:146)
at
org.drools.compiler.compiler.PackageBuilder.drlToPackageDescr(PackageBuilder.java:518)
at
org.drools.compiler.compiler.CompositeKnowledgeBuilderImpl$1.map(CompositeKnowledgeBuilderImpl.java:404)
at
org.drools.compiler.compiler.CompositeKnowledgeBuilderImpl.buildResource(CompositeKnowledgeBuilderImpl.java:329)
at
org.drools.compiler.compiler.CompositeKnowledgeBuilderImpl.buildPackageDescr(CompositeKnowledgeBuilderImpl.java:312)
at
org.drools.compiler.compiler.CompositeKnowledgeBuilderImpl.buildPackages(CompositeKnowledgeBuilderImpl.java:96)
at
org.drools.compiler.compiler.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:87)
at
org.drools.compiler.kie.builder.impl.AbstractKieModule.buildKnowledgePackages(AbstractKieModule.java:204)
at
org.drools.compiler.kie.builder.impl.AbstractKieProject.verify(AbstractKieProject.java:39)
at
org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieProject(KieBuilderImpl.java:309)
at
org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:187)
at
com.company.test.rules.BasicRuleEngine.start(BasicRuleEngine.java:66)
at
com.company.test.rules.TestBasicRuleEngine.listenersShouldBeNotifiedOfStartAndStop(TestBasicRuleEngine.java:88)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:254)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:149)
at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
at
org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:159)
at
org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:87)
at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)
Caused by: java.io.IOException: Error while instrumenting class
org/drools/compiler/lang/DRL6Lexer.
at
org.jacoco.agent.rt.internal_9dd1198.core.instr.Instrumenter.instrumentError(Instrumenter.java:147)
at
org.jacoco.agent.rt.internal_9dd1198.core.instr.Instrumenter.instrument(Instrumenter.java:98)
at
org.jacoco.agent.rt.internal_9dd1198.CoverageTransformer.transform(CoverageTransformer.java:87)
... 60 more
Caused by: java.lang.RuntimeException: Method code too large!
at
org.jacoco.agent.rt.internal_9dd1198.asm.MethodWriter.a(Unknown Source)
at
org.jacoco.agent.rt.internal_9dd1198.asm.ClassWriter.toByteArray(Unknown
Source)
at
org.jacoco.agent.rt.internal_9dd1198.core.instr.Instrumenter.instrument(Instrumenter.java:79)
at
org.jacoco.agent.rt.internal_9dd1198.core.instr.Instrumenter.instrument(Instrumenter.java:96)
... 61 more
Any help or info would be greatly appreciated!
--
View this message in context: http://drools.46999.n3.nabble.com/KieBuilder-buildAll-causing-exception-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month