Re: [rules-users] How to deploy drools 5.5 on weblogic in eclipse
by droolist
The trace indicates there is an attempt to connect to a DB running on your
local.
I doubt Drools is trying to connect to a DB, unless you have objects in your
rules that access DB.
It looks like you are getting this error while deploying a webservice that
happens to use Drools Expert jars.
it is possible that this is coming from your application code and not
Drools.
I see you have another post on Guvnor 5.5 and Weblogic 11. I had no success
with that either. I had a similar post and didnt get any response. so, I
doubt anybody has done that succesfully. WLS 11 is jee5 and does not support
CDI. Even with WLS 12 (jee6), I couldnt as there seems to be conflicts with
wls and weld cdi implementations. I'll watch your other post to see if
anybody responds as I am curious as well.
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-deploy-drools-5-5-on-weblogic-in...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
Cannot invoke method because of ArrayIndexOutOfBoundsException
by Bojan Janisch
Hello Guys,
sorry to bother you with this problem, but I'm out of ideas.
I'm using Drools in textmining-context and in basic I have
a function that checks 2 named entites for equality to
ensure that the entities are all different and that the rules
do work only on different named entity objects:
public static boolean isEqual(Annotation a, Annotation b){
if(a.equals(b)){
return true;
}
return false;
}
Sometimes there are conditions that need tests of more than
2 named entites. For this I've written a super method that
calls the isEqual method in a loop:
public static boolean isEqual(Annotation... a){
ArrayList<Annotation> outLoop = new ArrayList<Annotation>(Arrays.asList(a));
ArrayList<Annotation> inLoop = new ArrayList<Annotation>(Arrays.asList(a));
for (Annotation anno1 : outLoop) {
inLoop.remove(anno1);
for (Annotation anno2 : inLoop) {
if(isEqual(anno1,anno2)){
return true;
}
}
}
return false;
}
My rules could (theoretically) now call the function
eval(isEqual($ne1,$ne2)) or
eval(isEqual($ne1,$ne2,$ne3) or even
eval(isEqual($ne1,$ne2,$ne3,$ne4,$ne5)) and so on.
So there starts my problem:
Each time I'm getting an ArrayIndexOutOfBounds Exception from the second
method that looks like this:
java.lang.RuntimeException: cannot invoke method: isEqual
...
at java.lang.Thread.dispatchUncaughtException(Thread.java:1888)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 3
at org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.executeAll(MethodAccessor.java:149)
at org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.getValue(MethodAccessor.java:48)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:108)
at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:38)
...
Could someone explain me what's wrong with my code? Thanks for any help.
Greetings
JB
13 years
Working on the complete solution set on Drools Planner
by lbrito
Hi,
I am thinking about using Drools Planner for an internal project related to
order scheduling. It would in essence be a jobshop where we have 3 main
machines which are always followed on the same specific order (and we have
release dates for each task).
I thought about a solution that would shuffle the job sequences on each
machine looking for the best combination. However, the problem is that when
applying the rules on the drl to the score calculation I would need to
"pre-process" the solution in order to determine start-dates and end-dates
for all tasks/jobs.
Is there a way to access the complete solution from the drl, mash-up the
information and use it in the score calculation?
Kind Regards,
Luis
--
View this message in context: http://drools.46999.n3.nabble.com/Working-on-the-complete-solution-set-on...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
Why no auto-retraction after adding this temporal rule?
by Ladd
I'm attaching a small standalone java program to demonstrate this. The code
should be self explanatory. But in a nutshell, I'm feeding events into this
rule:
rule averageOverTime
when
$avg: Number() from accumulate (
MyEvent( key == 'someKey', $val : value ) over window:time( 200ms
),
average( $val ) )
then
System.out.println( "--- $avg in then clause is " + $avg );
end
I set up a loop to feed events in and I do see the rule fire and my averages
print out as I'd expect. I also set up a session listener to see if events
are automatically expired/retracted. And they are.
The trouble begins when I add this rule:
rule RetractionBreaker
when
$a : MyEvent( key == 'A' )
MyEvent( key == 'B', this after $a )
then
System.out.println( "--- just saw A followed by B" );
end
Whether or not I inject events with key 'A' or 'B', no events of any kind
are ever automatically retracted.
Why is that?
Thanks for helping me understand this!!
- Ladd
NoRetractionTest.java
<http://drools.46999.n3.nabble.com/file/n4022716/NoRetractionTest.java>
--
View this message in context: http://drools.46999.n3.nabble.com/Why-no-auto-retraction-after-adding-thi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
drools linkage errors
by mani koduri
Hi,
Initially I am using jboss-drool 5.0.1 version in our project and I updated
to jboss-drools 5.4.0 version in our project but I am getting linkage
errors as mentioned below.
*java.lang.LinkageError: loader (instance of
org/drools/rule/JavaDialectRuntimeData$PackageClassLoader): attempted*
*duplicate class definition for name:
"com/ds/rule/vm/fvm/ruleengine/Rule_Product_has_minimum_number_of_valid_quotes_5263d589f8864649bbb734bada7a54ed"
*
* at java.lang.ClassLoader.defineClass1(Native Method)
[rt.jar:1.6.0_30]*
* at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
[rt.jar:1.6.0_30]*
* at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
[rt.jar:1.6.0_30]*
* at
org.drools.rule.JavaDialectRuntimeData$PackageClassLoader.fastFindClass(JavaDialectRuntimeData.java:615)
[drools-core-5.4.0.Final.jar:5.4.0.Final]*
* at
org.drools.util.CompositeClassLoader$CachingLoader.load(CompositeClassLoader.java:254)
[knowledge-api-5.4.0.Final.jar:5.4.0.Final]*
* at
org.drools.util.CompositeClassLoader$CachingLoader.load(CompositeClassLoader.java:237)
[knowledge-api-5.4.0.Final.jar:5.4.0.Final]*
* at
org.drools.util.CompositeClassLoader.loadClass(CompositeClassLoader.java:88)
[knowledge-api-5.4.0.Final.jar:5.4.0.Final]*
* at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
[rt.jar:1.6.0_30]*
* at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[rt.jar:1.6.0_30]*
* at
a.b.c.Rule_person___unique___name_656ee3db19d34e689d95e2d6b2be67b6Eval0InvokerGenerated.evaluate(Unknown
Source)*
* at
a.b.c.Rule_person___unique___name_656ee3db19d34e689d95e2d6b2be67b6Eval0Invoker.evaluate(Unknown
Source)*
* at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:114)
[drools-core-5.4.0.Final.jar:5.4.0.Final]*
And each time I ran the project I am getting same error but on different
rules.
Could you please help me out how to solve this issue?
with regards,
k.chaitanya.
13 years
Question about drools-spring in a multi-treaded container (like tomcat).
by Gurvinder Narula1
Hello all,
I've been reading up about drool-spring integration and have put together a simple project that wires together a KnowledgeBase and KnowledgeSession as follows :
<drools:resource id="GroupUnit" type="DRL"
source="file:/Users/drools/drools-spring-test/src/Rules/drls/GroupUnit.drl" />
<drools:resource id="GradeUnit" type="DRL"
source="file:/Users/drools/drools-spring-test/src/Rules/drls/GradeUnit.drl"" />
<drools:resource id="EvaluateUnit" type="DRL"
source="file:/Users/drools/drools-spring-test/src/Rules/drls/EvaluateUnit.drl"" />
<drools:grid-node id="node1" />
<drools:kbase id="kbase1" node="node1">
<drools:resources>
<drools:resource ref="GroupUnit" />
<drools:resource ref="GradeUnit" />
<drools:resource ref="EvaluateUnit" />
</drools:resources>
</drools:kbase>
<drools:ksession id="ksession" type="stateful" kbase="kbase1"
node="node1" />
Then in my Controller call, I 'AutoWire' in the StatefulKnowledgeSession as follows :
@Controller
@RequestMapping( value = "foo" )
final class FooController{
@Autowired
StatefulKnowledgeSession ksession;
@RequestMapping( method = RequestMethod.GET )
@ResponseBody
public String evaluateUnit() {
Unit unit = new Unit("030", "502", "C", "9484", "45", new String[] {},
null);
if (ksession != null) {
ksession.fireAllRules();
ksession.insert(unit);
ksession.fireAllRules();
return "<UnitCategory>" + unit.getUnitCategory() + "</UnitCategory>";
}
else
return "<message> stateful session is null</message>";
}
The main question that I have is that – is this solution thread-safe ? From what I understand of spring is that beans configured without any additional qualifiers are inherently singletons. And when deployed in a multi-theaded container like tomcat, Spring assumes that the beans being severed up a thread-safe. So from I have read is that KnowledeSessions are inherently not thread safe. So putting the 2 together, I leaning towards the assessment that this above solution is NOT thread safe and that if I do want it to be thread safe I should set the StatefulKnowledgeSession to 'prototype' and not leave it as a singleton.
Please let me know if I'm missing anything in my assessment here !
Thanks in advance,
Gurvinder
This message is intended only for the individual or entity to which it is addressed. It may contain privileged, confidential information which is exempt from disclosure under applicable laws. If you are not the intended recipient, please note that you are strictly prohibited from disseminating or distributing this information (other than to the intended recipient) or copying this information. If you have received this communication in error, please notify us immediately by e-mail or by telephone at the above number. Thank you.
13 years