Strange error using Drools + Spring + DecisionTable
by Charles Moulliard
Hi,
When I try to instantiate an Excel Decision Table using Drools + Spring
(kresource), I get this error :
REMARK: the file is the same as we have in Drools Unit Test (decision-table)
Error :
Caused by: java.lang.IllegalArgumentException: Your InputStream was neither
an OLE2 stream, nor an OOXML stream
at
org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:75)
at
org.drools.decisiontable.parser.xls.ExcelParser.parseFile(ExcelParser.java:75)
at
org.drools.decisiontable.SpreadsheetCompiler.compile(SpreadsheetCompiler.java:93)
at
org.drools.decisiontable.SpreadsheetCompiler.compile(SpreadsheetCompiler.java:72)
at
org.drools.decisiontable.DecisionTableProviderImpl.compileStream(DecisionTableProviderImpl.java:37)
at
org.drools.decisiontable.DecisionTableProviderImpl.loadFromInputStream(DecisionTableProviderImpl.java:20)
at
org.drools.compiler.compiler.DecisionTableFactory.loadFromInputStream(DecisionTableFactory.java:15)
at
org.drools.compiler.compiler.PackageBuilder.decisionTableToPackageDescr(PackageBuilder.java:460)
at
org.drools.compiler.compiler.PackageBuilder.addPackageFromDecisionTable(PackageBuilder.java:454)
at
org.drools.compiler.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:684)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:51)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:40)
at
org.drools.container.spring.beans.KnowledgeBaseBeanFactory.afterPropertiesSet(KnowledgeBaseBeanFactory.java:110)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
Config :
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:drools="http://drools.org/schema/drools-spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://drools.org/schema/drools-spring
http://drools.org/schema/drools-spring.xsd">
<drools:grid-node id="node1"/>
<drools:kbase id="kbase1" node="node1">
<drools:configuration>
<drools:mbeans enabled="true"/>
</drools:configuration>
<drools:resources>
<drools:resource type="DTABLE"
source="classpath:data/IntegrationExampleTest.xls"/>
</drools:resources>
</drools:kbase>
<drools:ksession id="ksession1"
type="stateless"
name="ksession1"
kbase="kbase1"
node="node1"/>
</beans>
Regards,
--
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
11 years, 7 months
Does KnowledgeRuntimeLogger work with persistence?
by dunnlow
I am using Drools 5.5 with persistence. If I create a session like:
ksession = kbase.newStatefulKnowledgeSession(null,env);
My logger works as expected:
KnowledgeRuntimeLogger klogger =
KnowledgeRuntimeLogger.newFileLogger(ksession,"run")
HOWEVER, if I create the ksession like:
ksession =
JPAKnowledgeService.newStatefulKnowledgeSession(kbase,null,env)
my klogger file (run.log) is never created.
Is this expected? Is there a way to get a runtime log using persistence?
Thanks!
--
View this message in context: http://drools.46999.n3.nabble.com/Does-KnowledgeRuntimeLogger-work-with-p...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Rule triggering problem with Drools
by JuaneGaragorri
Hi everyone,
I'm relatively new at rule development and I'm having a problem tryin' to
implement one in particular.
I need to capture some events that they've got the same AttributeA and got
more than 9 AttributeB Objects (excluding one type in particular) in one or
more events.
*Model:*
Class Event {
Long id;
AttributeA attributeA;
List<AttributeB> listAttributeB;
Date timestamp;
Long duration;
}
Class AttributeA {
Long id;
double doubleValue;
String name;
}
Class AttributeB {
Long id;
String name;
String someString;
Boolean flag;
}
class AttributeBMock {
//it doesn't have any of "one_type_of_attB"
public List<AttributeB> getTenAttributeB() {
return Arrays.asList(new AttributeB(000001L, 23.4, "random_string_1"),
new AttributeB(000006L, 38.9, "random_string_2"),
new AttributeB(000005L, 35.2, "random_string_3"),
new AttributeB(000003L, 32.5, "random_string_4"),
new AttributeB(000006L, 32.5, "random_string_5"),
new AttributeB(000007L, 23.4, "random_string_6"),
new AttributeB(0000012L, 23.4, "random_string_7"),
new AttributeB(000015L, 44.4, "random_string_8"),
new AttributeB(000010L, 87.0, "random_string_9"),
new AttributeB(000010L, 87.0, "random_string_10"));
}
}
-----------------------------------------------------------------------------------
*Test:*
public void someMethod() {
SessionPseudoClock clock = (SessionPseudoClock) ruleEngine.getClock();
clock.advanceTime(10, TimeUnit.SECONDS);
//Just with this insertion i get the ArrayOutOfBounds exception
ruleEngine.addEvent(new Purchase(123456L,new AttributeA(),
AttributeBMock.getTenAttributeB(),new Date(clock.getCurrentTime(),0L));
Assert.assertTrue("The rule hasn't been fired", Assert.assertFalse("The rule
hasn't been fired",
ruleEngine.getEventListener().getExecutedRulesNames().containsAll(EXPECTED_RULES_NAMES));
}
-------------------------------------------------------------------------------------------------------
*Rule:*
when
$event: event($attributeA : attributeA, attributeA.flag == true,
$listAttributeB : listAttributeB) from entry-point "some_entry_point"
$quantity: List() from collect($attributeB : attributeB(name !=
'one_type_of_attB') from $listAttributeB)
Number(doubleValue > 9)
from accumulate(event(attributeA == $attributeA) from entry-point
"some_entry_point",
sum($quantity.size))
then
System.out.println("Event: " + $event.id );
end
-----------------------------------------------------------------
Everytime when I fire an event that triggers the rule, the accumulate method
throws an "ArrayOutOfBounds" exception. I don't know why, the logic looks
good to me.
Can I get some help, please?
Thx. in advance
Regards
--
View this message in context: http://drools.46999.n3.nabble.com/Rule-triggering-problem-with-Drools-tp4...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Drools Fusion: Finding an event that occuring after an event but not before it
by burmanator
I am trying to track when an event object Foo with a distinguishing
identifier of Status.
I want to try and identify a list of events when a Foo event with Status 2
happens after an event with Status 1 but at the same time a Status 1 has not
happened before.
fight now I've come up with:
$foo1 : Foo($status : Status)
not(Foo(Status == $status. this before $foo1))
$foos : ArrayList (size>0) from collect ( Foo(Status != $status, this after
$foo1))
Part of the problem I am having, is that a Foo event with the same Status
can happen at the same timestamp. How do I get it to work so the rule only
triggers once for multiple events on the same timestamp?
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Fusion-Finding-an-event-that-occ...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Mapping fields of all theses facts takes too much times
by ronan.quintin
Hello / Bonjour
I recently updated my version of Drools from 3 to the 5.4 Final. My drools
integration in version 3 intend to directly insert (or more precisely
"assert") our business objects to working session. Our *b*usiness *o*bjects
had and still have some getters which directly performs SQL request.
Our current problem is that with a 5.4 declarative model we have to map all
fields from our bo model to the declarative model. But we have a lot of BO
(over 3K) which all have to be inserted to the session, so a lot of SQL
queries are performed which increases (a lot) the execution time.
That's why i wondered if there isn't any way to directy insert our BO into
the session using the Guvnor's POJO model. It's seems that guvnor refuse to
directly take our jar, but maybe there is an option which makes it accept
any jar.
Anyway i think that we can generate a jar which contains interfaces of all
BO, and then directly insert BO into the session, but i'm not sure of Drools
behaviour.
I'm perfectly aware that it's quite ugly, and if you have any other idea to
perform a "lazy loading direclty from database", i'l take it.
Regards / Cordialement
--
View this message in context: http://drools.46999.n3.nabble.com/Mapping-fields-of-all-theses-facts-take...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Deploy package across several Drools-Guvnor servers (unattended)
by ciberg2
Hi,
I have a application that will be installed in several locations, and
because of connection constraints, each location will run its own
Drools-Guvnor server with a deployed package consisting of decision tables
and BPMN processes.
I want to make possible that when some asset is changed centrally, this
change can be deployed (or replicated) across all Drools servers.
I read about KnowledgeAgent to make hot deployments, but as far as I
understood someone has to still build the package in each of the servers.
Is it possible to do what I want? If yes please give me some tips on how to
do it.
If not what can I do to solve the deployment across multiple servers
problem?
--
View this message in context: http://drools.46999.n3.nabble.com/Deploy-package-across-several-Drools-Gu...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
How to count the number of events that happened in the last X minutes and fire if is greater than Y
by Adrián Paredes
People,
I'm new at Drools Fusion and I found a problem when I'm tryin to implement
a Rule. I need to count the number of events that happened in the last X
minutes, and fire the rule if the count is greater than Y.
When I use window:time(Xm), each event slide the window, and does not help.
¿What should I do to solve my problem?
Thx in advance.
Regards.
--
*Epidata Consulting | Deploying Ideas
Ing. Adrián M. Paredes | Arquitecto Desarrollador
adrianp(a)epidataconsulting.com | Cel: (54911) 3297 1713
----------------------------------------------------------------------------------------------------------------------------
Argentina: Maipú 521 Piso 7 | Buenos Aires | Of: (5411) 5031 0060
Chile: Apoquindo 3600 Piso 7 y 9 | Las Condes - Santiago | Of: (+56) 2 495
8450
---------------------------------------------------------------------------------------------------------------------------
www.epidataconsulting.com
Linkedin <http://bit.ly/epidatalinkedin> |
Facebook<http://www.facebook.com/epidata.consulting>
| Twitter <http://twitter.com/epidata>
*
11 years, 7 months
Upgrading/Migrating from Guvnor 5.0.0 to 5.5.0
by sage.sam
We've been running drools-guvnor on JBoss EAP 5 for quite some time now.
Today I downloaded and installed JBoss EAP 6.1 and drools-guvnor 5.5. I got
both started without any real problems; so far so good.
My next step was to see if I could migrate everything from the guvnor 5.0
repository to the 5.5 repository. I used the admin export tool, saved the
export, imported into guvnor 5.5 -- all cleanly: no errors of any kind.
The screen refreshed... and less than half of my packages are present!
On a whim, I tried to create a new package, one with the same name as one of
my missing packages. Knowing package names need to be unique, I wondered if
this might jog its memory. It failed to let me create the package, logging
an exception:
RulesRepositoryException: A module name must be unique
So it would appear that my package exists somewhere in the repository, but I
can't see it. In fact, I can search for functions and rules that exist in
that package, open them, and save changes. But the package still doesn't
appear.
Anyone have any ideas on what went wrong or how to fix it?
--
View this message in context: http://drools.46999.n3.nabble.com/Upgrading-Migrating-from-Guvnor-5-0-0-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months