ArrayIndexOutOfBoundsException under high events load in drools CEP
by ters
Hi, drools users/developers. As mentioned in subject, I often faced
ArrayIndexOutOfBoundsException under high events load in drools during
marshaling.
Conditions: drools CEP (5.4.0.Final), Stream mode, fireUntilHalt mode,
during very active marshaling process (in several threads) I often have such
trace:
java.lang.ArrayIndexOutOfBoundsException: 2773
at
org.drools.marshalling.impl.ProtobufOutputMarshaller.orderFacts(ProtobufOutputMarshaller.java:592)
at
org.drools.marshalling.impl.ProtobufOutputMarshaller.writeFactHandles(ProtobufOutputMarshaller.java:533)
at
org.drools.marshalling.impl.ProtobufOutputMarshaller.serializeSession(ProtobufOutputMarshaller.java:139)
at
org.drools.marshalling.impl.ProtobufOutputMarshaller.writeSession(ProtobufOutputMarshaller.java:100)
at
org.drools.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:169)
at
org.drools.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:151)
at
com.blablabla.cep.CEPEventProcessor.marshalWorkingMemory(CEPEventProcessor.java:332)
This exception occurs really often.
I googled fresh tracked bug
https://bugzilla.redhat.com/show_bug.cgi?id=1044577. As I understand, this
bug is fixed in drool 5.3.x branch, but we using drools-core 5.4.0.Final.
So could you please help me what to do with this exeption?
Thanks in advance.
--
View this message in context: http://drools.46999.n3.nabble.com/ArrayIndexOutOfBoundsException-under-hi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
NullPointerException when calling Scan manually
by Brecht De Rooms
Dear Drools users,
I just merged all my code to Drools 6.0.1 and I am happy to see that it is
more stable. Several issues I had with 5.6.x do not present themselves in
6.0.1. I am still stuck on one bug however that occurs randomly. I wrote a
unit test in which I deploy new rules and then call scanNow. Often the
unit test succeeds, but sometimes it throws this nullpointer exception.
java.lang.NullPointerException
at
org.drools.core.rule.Package.getRulesGeneratedFromResource(Package.java:668)
at
org.drools.core.rule.Package.removeRulesGeneratedFromResource(Package.java:658)
at
org.drools.core.reteoo.ReteooRuleBase.removeObjectsGeneratedFromResource(ReteooRuleBase.java:1653)
at
org.drools.compiler.compiler.PackageBuilder.removeObjectsGeneratedFromResource(PackageBuilder.java:4150)
at
org.drools.compiler.kie.builder.impl.KieContainerImpl.updateToVersion(KieContainerImpl.java:149)
at
org.kie.scanner.KieRepositoryScannerImpl.updateKieModule(KieRepositoryScannerImpl.java:214)
at
org.kie.scanner.KieRepositoryScannerImpl.scanNow(KieRepositoryScannerImpl.java:204)
at derooms.be.engine.RuleEngine.scanNow(RuleEngine.java:111)
at
derooms.be.engine.ruleDeployment.RulesPackageWriter.deployRules(RulesPackageWriter.java:104)
at
derooms.be.engine.ruleDeployment.RulesPackageWriter.addRules(RulesPackageWriter.java:84)
at
derooms.be.engine.dynamicRuleWatcher.RuleFileHandler.handleModifiedFile(RuleFileHandler.java:50)
at
derooms.be.engine.dynamicRuleWatcher.RulesWatcherRunnable.run(RulesWatcherRunnable.java:105)
at java.lang.Thread.run(Thread.java:744)
Does anyone have an idea what the problem might be?
Kind Regards,
Brecht
-------------------------------------------------------------
Brecht De Rooms
Phd Student @ WISE
Department of Computer Science
Vrije Universiteit Brussel
Pleinlaan 2, B-1050 Brussels, Belgium
office: 10 G 731f
phone: +32 2 629 37 49
email: bderooms(a)vub.ac.be
-------------------------------------------------------------
---
Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is.
http://www.avast.com
12 years
VCRP - Distance calculation in getMilliDistance
by Marcus Uerlings
Hi
I´ve download Optaplanner a couple of months ago and found it fantastic!!
Congrats to Geoffrey!
I´m not a programmer, but a logistic consultant to a non-governmental
organization (NGO) of recycling products and like to give my "cent of
contribuition" if it applies.
1. Distance Calculation:
I´ve learned from a person that works with georeference that a good
aproximation in calculating distances from latitude and longitude is to
multiply the Euclidean result by "111.1".
This "magic number" will give the approximate distance in kilometers and
then the final soft score will show the minimum distance in "km" and not in
"fuel" (although they are related).
=====
public int getMilliDistance(Location location) {
( ... )
(latitudeDifference * latitudeDifference) +
(longitudeDifference * longitudeDifference));
return (int) (distance * 1000.0 * 111.1);
}
=====
2. Heteregenous vehicles
Many times a fleet is made of different vehicles, different sizes, capacity
and one of the most important, different mileages (in Km/litre or
litres/100 km).
How can I put it in vehicle parameters, together with capacity and took
into account in score calculation?
Doing so, the score would be calculated as minimum(Distance*mileage).
3. Real example
I fed real data into Optaplanner VCRP and plot the results in Googlemaps.
Due to one way streets, the result does not look efficient to the drivers
of the NGO.
Is there a way to use an internet routing service, like Googlemaps in
Optaplanner?
If it is possible, can someone help me coding this? :)
Regards from Brazil
Thank you in advance
Marcus Uerlings
______________________________________________
*Marcus Uerlings+11 9 4178-0544*
12 years
Unable to find pom.properties
by kmansoor
I'm experiencing a most unusual issue: file.isDirectory() is returning a
false on 'maven' as in:
\work\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dcwebcv\META-INF\maven
KieBuilderImpl.recurseToPomProperties:
public static File recurseToPomProperties(File file) {
if( file.isDirectory() ) {
for ( java.io.File child : file.listFiles() ) {
if ( child.isDirectory() ) {
File returnedFile = recurseToPomProperties( child );
if ( returnedFile != null ) {
return returnedFile;
}
} else if ( child.getName().endsWith( "pom.properties" ) ) {
return child;
}
}
}
return null;
}
I stepped through the code and found file.isDirectory() returning false. I
have verified the directory 'maven' has sub-directories following the
$groupId/$artifactId convention. The $artifactId directory does contain
pom.properties and pom.xml.
My environment:
Eclipse Kepler SR1
Drools: 6.0.1
Relevant pom.xml
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>${kie.version}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-internal</artifactId>
<version>${kie.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-spring</artifactId>
<version>${kie.version}</version>
<exclusions>
<exclusion>
<artifactId>el-api</artifactId>
<groupId>javax.el</groupId>
</exclusion>
</exclusions>
</dependency>
This same exact setup on a colleague's machine works fine, when stepping
through the above code file.isDirectory() returned a true on 'maven' and
pom.properties was found (recursively).
Any pointers will be highly appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/Unable-to-find-pom-properties-tp4028307...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
problem with drools
by Sandhya Sree
hi,
im new to drools..im trying to create a project as follows. i have a class
called Monitor which monitors a folder and creates two lists called
fileOld( which is the list of filenames in that folder at time t1) and
fileNew(which is the list of filenames in that folder at time t2). i have
another class called FileData which contains two members fileOld and
fileNew (list of strings) with getters,setters and constructor. fileOld and
fileNew from Monitor Class are passed to FileData class.
now i have to compare these two lists in a rule file and if they are not
equal i have to print the lists of files added/ deleted. how to do this in
drools.
here is my rule file:
rule "files are equal"
when
FileData(fileOld == fileNew)
then
System.out.println("files are equal");
end
rule "files not equal"
when
not FileData(fileOld == fileNew)
then
System.out.println("files are not equal");
difference(FileData.getFileOld(),FileData.getFileNew());
end
function void difference(List fileOld, List fileNew)
{
ArrayList<String> add = new ArrayList<String>(fileNew);
add.removeAll(fileOld);
System.out.println("files Added: " + add);
ArrayList<String> remove = new ArrayList<String>(fileOld);
remove.removeAll(fileNew);
System.out.println("files Removed: " + remove);
}
but this displays the following error...
Rule Compilation error : [Rule name='files not equal']
Cannot make a static reference to the non-static method getFileOld() from
the type FileData
Cannot make a static reference to the non-static method getFileNew() from
the type FileData
what can be done??
12 years
Spring and Drools
by Stephen Masters
Hi folks,
This may well be rather premature, but I have been knocking up a little example project to demo a web application built with Spring 4 and Drools 6. Notably, *not* using the Drools Spring componentry because I prefer to roll my own Spring components. It gives me a lot of freedom to make things work how I like. I mention this, as there seem to be a lot of folks on this list with problems relating to getting their Drools Spring XML config working, and I wanted to show how easy it is to roll your own. There’s really not much code involved.
To try it out:
git clone git@github.com:gratiartis/qzr.git
cd qzr
mvn clean install
cd qzr-web
mvn tomcat7:run
And open: http://localhost:9090/
It seems to work fine on OSX and Windows 7. Hopefully it works for other platforms too.
As I mention, this may be somewhat premature, because the application is very much a work in progress (likely to be refactored lots!) and doesn’t do a lot yet. It creates a KieSession attached to the HTTP session of each user, so that users can have a chatty relationship with the rules engine. There is a web page which uses JavaScript to call a REST API to get data such as “questions”, which have been inferred in the rules engine. The idea being to have a conversation whereby the rules engine asks a question and the user’s response will be inserted as a knew ‘known’ fact. The rules are fired again to determine what is now known and what additional questions should be asked.
I have plenty of vague ideas relating to future functionality, so I’ll be beavering away at it. However, if anybody has thoughts on functionality which would be worth demoing, then feel free to fire your thoughts in my direction and I’ll see what I can do. If anybody looks closely enough to spot any bugs, then feel free to mention them (I think you can raise issues on the GitHub project), although there’s a pretty good chance that they’re just incomplete functionality.
Hopefully it’s useful to someone. Enjoy!
Steve
12 years