Re: [rules-users] Problem sharing declarative model between two packages

2012-10-31 Thread Al
I'll do that.  Thanks for the help!



--
View this message in context: 
http://drools.46999.n3.nabble.com/Problem-sharing-declarative-model-between-two-packages-tp4020628p4020641.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Problem sharing declarative model between two packages

2012-10-31 Thread Al
Thanks for the suggestion.  I actually used a Guvnor Declarative Model
originally, but I described the example using DRL because that seemed easier
to communicate.  At this point, I've tried both approaches with no success.

I will put together a repository export and create a new issue in JIRA.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Problem-sharing-declarative-model-between-two-packages-tp4020628p4020640.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Drools 5.5.0.CR1 is using a broken cdi-api version

2012-10-31 Thread Cristiano Gavião
Hello,

I'm using Tycho to create a dependency P2 repository (OSGi environment) 
containing JBPM 5.4.0.CR1 and DROOLS 5.5.0.CR1.

I got some problem to properly setup the dependencies for the cdi-api.

The bundle knowledge-internal-api has a dependency to cdi-api (version 
1.0-SP4), but this version is tied to this:

org.jboss.spec.javax.interceptor
  jboss-interceptors-api_1.1_spec
  1.0.0.Beta1

And this 1.0.0.Beta1 version of org.jboss.spec.javax.interceptor was not 
well osgified. it doesn't have a Bundle-SymbolicName !

I could handle this problem using a newer version of it:

 
org.jboss.spec.javax.interceptor
jboss-interceptors-api_1.1_spec
 1.0.1.Final
 

I won't use cdi anyway, but it could help others that decide to use jbpm 
with eclipse.

regards,

Cristiano

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Problem sharing declarative model between two packages

2012-10-31 Thread Michael Anstis
You could try using Guvnor Declarative Models rather than importing DRL.

Otherwise, it is a bug\feature request (I'm not sure we have any code in
place at present to support this).

Please raise a JIRA.

On 31 October 2012 22:18, Al  wrote:

> There were no imports for MyType in the Guvnor package configuration for p1
> or p2.
>
> I tried adding an import of p2.MyType in the p1 package configuration.
>  When
> I built the package, Guvnor generated an error: Error importing :
> 'p2.MyType'.
>
> I also tried adding an import for p1.MyType in the p2 package
> configuration,
> with similar results.
>
> Is there some other way I should be configuring the imports?
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Problem-sharing-declarative-model-between-two-packages-tp4020628p4020637.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Problem sharing declarative model between two packages

2012-10-31 Thread Al
There were no imports for MyType in the Guvnor package configuration for p1
or p2.

I tried adding an import of p2.MyType in the p1 package configuration.  When
I built the package, Guvnor generated an error: Error importing :
'p2.MyType'.

I also tried adding an import for p1.MyType in the p2 package configuration,
with similar results.

Is there some other way I should be configuring the imports?



--
View this message in context: 
http://drools.46999.n3.nabble.com/Problem-sharing-declarative-model-between-two-packages-tp4020628p4020637.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Problem sharing declarative model between two packages

2012-10-31 Thread Davide Sottara
Please open a GUVNOR Jira as Michael suggested.. putting the declaration in
the two packages
would lead to two different classes, p1.MyEvent and p2.MyEvent
The Guvnor team will then double-check
Thanks
Davide



--
View this message in context: 
http://drools.46999.n3.nabble.com/Problem-sharing-declarative-model-between-two-packages-tp4020628p4020636.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Problem sharing declarative model between two packages

2012-10-31 Thread Al
If I create three DRL files as you described and then import them into
Guvnor, it creates three separate Guvnor packages (datamodel, p1, p2).  If I
want to reference MyEvent from the rule in p1, I need to import
datamodel.MyEvent.  Unfortunately, Guvnor doesn't allow me to import
declared types from a different Guvnor package.

So, unless I'm misunderstanding your suggestion, I would end up having to
copy the declarative model for datamodel.MyEvent into the p1 and p2 packages
and I would be back in my original predicament.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Problem-sharing-declarative-model-between-two-packages-tp4020628p4020635.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] How to retrieving LHS or RHS from the rule.

2012-10-31 Thread bhochhi
Guys,

Is there anyway we can list out of LHS and RHS from the rule? I know we can
get rulename and all metaattributes of a rules from its knowledgebase but
didn't see anyway to get LHS and RHS.

Thanks in Advance.



--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-retrieving-LHS-or-RHS-from-the-rule-tp4020634.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Problem sharing declarative model between two packages

2012-10-31 Thread Michael Anstis
It could be the imports - I'd definitely recommend setting them on the
package configuration in Guvnor.

However it's possibly (more likely) a bug in Guvnor as the "Global Area"
doesn't "have" a package and hence I suspect there are no imports to
specify.

Please try and report back - if it still fails I suggest raising a JIRA
(for GUVNOR, https://issues.jboss.org/browse/GUVNOR) and attach a
repository demonstrating the issue.

With kind regards,

Mike

On 31 October 2012 20:42, Davide Sottara  wrote:

> Oh right, I should have read more carefully :)
> Drools is package-oriented, so in technical DRL you should do:
>
> --
> package datamodel;
>
> declare MyEvent
> end
>
> --
>
> package p1;
> import datamodel.MyEvent
> rule r1 when MyEvent() then .. end
>
> --
>
> package p1;
> import datamodel.MyEvent
> rule r2 when MyEvent() then .. end
>
>
> Someone from the guvnor team might clarify whether imports need to be
> implicit or explicit :)
>
> Best
> Davide
>
> p.s. if no package is specified, Drools assumes "defaultpkg" as package
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Problem-sharing-declarative-model-between-two-packages-tp4020628p4020632.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Problem sharing declarative model between two packages

2012-10-31 Thread Davide Sottara
Oh right, I should have read more carefully :)
Drools is package-oriented, so in technical DRL you should do:

--
package datamodel;

declare MyEvent
end

--

package p1;
import datamodel.MyEvent
rule r1 when MyEvent() then .. end

--

package p1;
import datamodel.MyEvent
rule r2 when MyEvent() then .. end


Someone from the guvnor team might clarify whether imports need to be
implicit or explicit :)

Best
Davide

p.s. if no package is specified, Drools assumes "defaultpkg" as package



--
View this message in context: 
http://drools.46999.n3.nabble.com/Problem-sharing-declarative-model-between-two-packages-tp4020628p4020632.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Rule Template doesn't show up in Test Scenario

2012-10-31 Thread rockford
Hi,

I am using Drools 5.4.0 Guvnor. I created a Rule Template and I would to
test it with a Test Scenario. However, when I try to show the rules to fire
in the test, the newly created (and saved) Rule Template doesn't show up in
the rule list. Newly created "ordinary" rules show up properly in the list,
but not a Rule Template.  Has anyone tried this and got it to work?

Ken



--
View this message in context: 
http://drools.46999.n3.nabble.com/Rule-Template-doesn-t-show-up-in-Test-Scenario-tp4020631.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Problem sharing declarative model between two packages

2012-10-31 Thread Al
Thanks for the quick reply, Davide!

It does look somewhat similar, but I am using a single KnowledgeBase, there
are no Exceptions being thrown, and I don't think there is anything I can do
with sharing ClassLoaders to workaround the problem. 

I am loading both packages into my KnowledgeBase, creating a Session and
executing the rules.  The only problem I have is that the declared type,
MyType, is created as an instance of p1.MyType, and the "find it" rule in
package p2 seems to be looking for an instance of p2.MyType.

I suppose this is how things are supposed to work, but I was hoping someone
could suggest a different way to share a declarative model across packages
that wouldn't suffer this problem.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Problem-sharing-declarative-model-between-two-packages-tp4020628p4020630.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Problem sharing declarative model between two packages

2012-10-31 Thread Davide Sottara
Might your issue be related to this discussion?

https://issues.jboss.org/browse/JBRULES-3669




--
View this message in context: 
http://drools.46999.n3.nabble.com/Problem-sharing-declarative-model-between-two-packages-tp4020628p4020629.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Problem sharing declarative model between two packages

2012-10-31 Thread Al
I would like to be able to share a declarative model between two packages. 
When I attempt to do this by creating my model in Guvnor's Global Area and
then importing it into each package, I find that instances of the declared
types that are created by rules in one package are not recognized by rules
in the other package.

For example, suppose I create a model in the global area with a declared
type:

declare MyType
  field1: String
end

I then import this model into packages "p1" and "p2".  I add the following
rule into package "p1":

rule "create it"
when
  eval(true)
then
  MyType m = new MyType();
  insert(m);
end

and I add the following rule into package "p2":

rule "find it"
when
  $m : MyType()
then
  System.out.println("found it");
end

At runtime, the "create it" rule fires and inserts a "MyType" object. 
However, the "find it" rule never fires.

If I add a WorkingMemoryEventListener and look at exactly what is being
inserted, I can see that the "create it" rule is inserting an instance of
p1.MyType.  I assume that the "find it" rule is looking for an instance of
p2.MyType and that is why it never fires.

Is there a different way to accomplish this?  Or, are declarative models
simply not intended to be shared across packages?



--
View this message in context: 
http://drools.46999.n3.nabble.com/Problem-sharing-declarative-model-between-two-packages-tp4020628.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Noob desperately needing help

2012-10-31 Thread zaphod
Mattias (and Esteban)...

Well.you guys gave me the solution to the problem, but in a wildly
indirect way.  I downloaded the source for zip4j, added a bunch of logging
so I could figure out where the code was hanging, went to replace the
existing library and.hmmm, where the heck IS the existing library?

Long story short, was not including the zip4j.jar in the app classpath. 
Added the debug version, and, surprise, surprise, it worked.

So, it turns out I should have been getting a ClassNotFound exception from
the classloader.  Not sure why drools would just stop and NOT throw a
ClassNotFound exception, but that is no longer my concern.

Thanks to everyone who participated in leading me to a solution...a typical
false-positive error.  And to Davideyou were right, not a Drools problem
at all.  It was the nut behind the keyboard (aka PEBKAC).

Paul



--
View this message in context: 
http://drools.46999.n3.nabble.com/Noob-desperately-needing-help-tp4020589p4020627.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Noob desperately needing help

2012-10-31 Thread Mattias Nilsson Grip
I was just about to suggest something similar. Use JDB or some other utility to 
get a thread dump from the JVM when it is hung. That should let you know 
exactly in what class and method the thread hangs.

You could also change your code to catch (and rethrow) Throwable instead of 
Exception to double-check that the call to ZipOutputStream is not throwing an 
Error that is secretly caught somewhere without being logged.

Regards,
Mattias 

- Original Message -
From: "Esteban Aliverti" 
To: "Rules Users List" 
Sent: Wednesday, 31 October, 2012 4:46:53 PM
Subject: Re: [rules-users] Noob desperately needing help


Did you try to debug your code to see exactly where the hung is? zip4j seems to 
be open source, you could even debug its internals to see where the problem is 
and maybe you can get a clue of what is going wrong. 


Best Regards, 


 

Esteban Aliverti 
- Blog @ http://ilesteban.wordpress.com 



On Wed, Oct 31, 2012 at 4:26 PM, zaphod < pcoo...@emspic.org > wrote: 


Wolfgang, 

Here's my dilemma...there is no exception thrown! I wouldn't even be here 
asking the question if I was getting an OOME...my problem is that the rule 
hangs, and from that point on, the entire rules engine is hung, even though 
other processing continues on that jboss node. 

Note that I'm using zip4j, as the default zip library provided in Java does 
not support password-protecting the zip file. That is a requirement of this 
process. And this is new code...it works perfectly outside the rules 
container, but not at all inside it. 

What baffles me is the process hanging...I've been writing Java code for 13 
years, and I've never seen a process just hang... 

Paul 
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] java.lang.LinkageError, but only sometimes

2012-10-31 Thread Mattias Nilsson Grip
I'm guessing now. But since the stack trace includes 
org.drools.rule.JavaDialectRuntimeData I would rather say it is related to Java 
and not to MVEL. Actually org.drools.rule.MVELDialectRuntimeData seems to have 
less class-loading logic than JavaDialectRuntimeData so if this is indeed a bug 
a workaround may be to switch from java to mvel dialect. Another workaround 
could be to "warm up" your rules by firing them from a single thread before 
exposing the knowledge base to the multi-threaded client code.

Regards,
Mattias

- Original Message -
From: "kennywest" 
To: rules-users@lists.jboss.org
Sent: Wednesday, 31 October, 2012 4:33:07 PM
Subject: Re: [rules-users] java.lang.LinkageError, but only sometimes

Thank you for your reply.
I have created the following issue:
https://issues.jboss.org/browse/JBRULES-3675

We are now running the same setup on 5.5.0.CR1 and so far, we haven't
encountered the linkage error. Could this be related to mvel?



--
View this message in context: 
http://drools.46999.n3.nabble.com/java-lang-LinkageError-but-only-sometimes-tp4020606p4020616.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] java.lang.LinkageError, but only sometimes

2012-10-31 Thread kennywest
Cried wolf too soon :( Linkage error also occurs in 5.5.0.CR1



--
View this message in context: 
http://drools.46999.n3.nabble.com/java-lang-LinkageError-but-only-sometimes-tp4020606p4020618.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] java.lang.LinkageError, but only sometimes

2012-10-31 Thread kennywest
Thank you for your reply.
I have created the following issue:
https://issues.jboss.org/browse/JBRULES-3675

We are now running the same setup on 5.5.0.CR1 and so far, we haven't
encountered the linkage error. Could this be related to mvel?



--
View this message in context: 
http://drools.46999.n3.nabble.com/java-lang-LinkageError-but-only-sometimes-tp4020606p4020616.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Noob desperately needing help

2012-10-31 Thread zaphod
Wolfgang,

Here's my dilemma...there is no exception thrown!  I wouldn't even be here
asking the question if I was getting an OOME...my problem is that the rule
hangs, and from that point on, the entire rules engine is hung, even though
other processing continues on that jboss node.

Note that I'm using zip4j, as the default zip library provided in Java does
not support password-protecting the zip file.  That is a requirement of this
process.  And this is new code...it works perfectly outside the rules
container, but not at all inside it.

What baffles me is the process hanging...I've been writing Java code for 13
years, and I've never seen a process just hang...

Paul



--
View this message in context: 
http://drools.46999.n3.nabble.com/Noob-desperately-needing-help-tp4020589p4020615.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Calling queries or collect() from functions

2012-10-31 Thread Wolfgang Laun
Yes, you can create a query and call it in a function, as you'd call
it in Java - see the Expert documentation.

Alternatively, consider using an insertLogical as in your Rule1,
putting the list into a simple wrapper class declared in DRL.

Or simply use "extends Rule1" in all the rules needing the collected
list, omitting the insert from Rule1.

I think you can omit the first pattern from Rule1.

-W


On 31/10/2012, Miguel Paraz  wrote:
> Hi,
> I have a rule like:
>
> rule "Rule1"
> when
> $fact: Fact1()
> $allFacts: ArrayList() from collect(Fact1())
>
> then
> insert(new Fact2($allFacts.size()));
> end
>
>
> I want to compute $allFacts inside a function since I will use it across
> different rules.
> This doesn't work because it is not valid Java syntax:
>
> function int size() {
> ArrayList a = ArrayList() from collect(InQueuePredicate());
> return a.size();
> }
>
> Could I put this in a named query, and call it from a function?
>
> Thanks!
> Miguel
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Calling queries or collect() from functions

2012-10-31 Thread Miguel Paraz
Hi,
I have a rule like:

rule "Rule1"
when
$fact: Fact1()
$allFacts: ArrayList() from collect(Fact1())

then
insert(new Fact2($allFacts.size()));
end


I want to compute $allFacts inside a function since I will use it across
different rules.
This doesn't work because it is not valid Java syntax:

function int size() {
ArrayList a = ArrayList() from collect(InQueuePredicate());
return a.size();
}

Could I put this in a named query, and call it from a function?

Thanks!
Miguel
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] enquiry on drools webservice

2012-10-31 Thread kurrent93
You might like to try Jboss SwitchYard. This has functionality to create
Rules Services, based on Drools.

https://docs.jboss.org/author/display/SWITCHYARD/User+Guide#UserGuide-RulesServices





--
View this message in context: 
http://drools.46999.n3.nabble.com/enquiry-on-drools-webservice-tp56673p4020612.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] java.lang.LinkageError, but only sometimes

2012-10-31 Thread Mattias Nilsson Grip
Hi Kenneth,

I have never experienced this myself, but after having a quick look at the code 
I believe this could be a multi-threading problem. In the abstract class 
java.lang.ClassLoader the method loadClass(String, boolean) is synchronized, 
but both org.drools.util.CompositeClassLoader and 
org.drools.rule.JavaDialectRuntimeData$PackageClassLoader override this method 
without the use of "synchronized".

I would suggest you create a JIRA issue for this.

Regards,
Mattias

- Ursprungligt meddelande -
Från: "kennywest" 
Till: rules-users@lists.jboss.org
Skickat: onsdag, 31 okt 2012 12:41:29
Ämne: [rules-users] java.lang.LinkageError, but only sometimes

Dear list,

We have an application (A) deployed on JBoss 7.1.1 accepting commands (CQRS,
but only C and Q :) ). A console application (B) is sending a large volume
of commands to create entities in A. Entities in A are validated by Drools
(plain drl files, configured in spring using drools-spring). Most of the
time this works just fine. But sometimes, we get the following exception:

java.lang.LinkageError: loader (instance of 
org/drools/rule/JavaDialectRuntimeData$PackageClassLoader): attempted 
duplicate class definition for name:
"a/b/c/Rule_person_unique___name_656ee3db19d34e689d95e2d6b2be67b6"
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_gg___unique___name_656ee3db19d34e689d95e2d6b2be67b6Eval0InvokerGenerated.evaluate(Unknown
Source)
at
a.b.c.Rule_gg___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]

Any idea where this is coming from or what's causing this.

We are using:
- JBoss 7.1.1
- drools 5.4.0.Final
- jdk 1.6u30
- Windows 7 64 bit


regards,

Kenneth



--
View this message in context: 
http://drools.46999.n3.nabble.com/java-lang-LinkageError-but-only-sometimes-tp4020606.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Noob desperately needing help

2012-10-31 Thread Wolfgang Laun
I agree with Davide.

Google with >java.util.zip.Deflater native method init< returns
several interesting hits, some of which indicate that it is possible
to run into an
OOME, e.g., when heap and perm space doesn't leave enough room for
native memory allocation.

When this problem became manifest: was there a change of the OS
or JVM version? Does the error occur after some other processing
using similar procedures has been done, possibly without returning
memory allocations?

Insert a call
   new Deflater(Deflater.DEFAULT_COMPRESSION, true);
and a logger call, preceding
   ZipOutputStream outputStream = new ZipOutputStream(baos);   <---
rule hangs here
to narrow it down.

-W

On 31/10/2012, Davide Sottara  wrote:
> >From your description, it does not seem a rule engine issue... Have you
> tried
> reproducing the problem
> outside the rule engine? I.e. invoking the ZipUtil in a more "traditional"
> context?
> And does it get stuck with ANY bytearray or just with that one particular
> input?
>
>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Noob-desperately-needing-help-tp4020589p4020592.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Noob desperately needing help

2012-10-31 Thread zaphod
Davide,

Thanks for the response…I have also fired the attached code from outside a
rule, and it works perfectly (I created a hidden test menu option that
allows me to call runNeedleChestDecompressionReport()).  In fact, every
other instance of using ZipUtil works fine.  And the place where the rule is
hanging hasn’t actually gotten to the byte array yet…it’s creating internal
data structures to handle the input.

I’m grasping for straws, I know…

Paul



--
View this message in context: 
http://drools.46999.n3.nabble.com/Noob-desperately-needing-help-tp4020589p4020609.html
Sent from the Drools: User forum mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] debug

2012-10-31 Thread Mattias Nilsson Grip
Hi,

release notes for 5.4.0.Final mention that "Breakpoints in Rule RHS are not 
working with Java dialect".

Try adding this attribute to your rule and see if that makes debugging work:
dialect "mvel"
 
Regards,
Mattias

- Ursprungligt meddelande -
Från: "benq2188" 
Till: rules-users@lists.jboss.org
Skickat: onsdag, 31 okt 2012 10:58:06
Ämne: Re: [rules-users] debug

Hello,

I faced with the same problem. Breakpoints are not being hit by debugger. I
have Eclipse SDK version: 4.2.1 and went through the reference manual of
Drools and followed each step carefully.

-Installed GEF
- Downloaded drools-distribution-5.4.0.Final.zip
-Unzipped it into Eclipse main folder
-Restarted Eclipse
-Defined run time based on the latest Drools project jars included in the
plugin
itself.
-Created Drools Project
-Created new launch configuration for Drools Application.
-Put a breakpoint in the helloworld simple project on the first line of the
section "then".

When I debug it as Drools Application, debugger stops in Java breakpoints
but doesn't stop in drl rule.

Also tried what Bruno suggested but it did not worked too.

Any other solutions, how can I fix it?

Thanks in advance.



--
View this message in context: 
http://drools.46999.n3.nabble.com/debug-tp3889772p4020597.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] JTA Persistence, Fact Objects and High Availability

2012-10-31 Thread Miguel Paraz
Hi,

I'm looking at the possibility of using Drools to store the working state
of my app, in the form of rules.

Can JTA Persistence store fact objects? I read that the fact objects must
be Serializable - are there other requirements or caveats?

Can JTA Persistence take care of High Availability? Even if the system goes
down in the middle of a rules computation? Assuming the database handling
the JPA is a HA system.

Thanks!
Miguel
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] java.lang.LinkageError, but only sometimes

2012-10-31 Thread kennywest
Dear list,

We have an application (A) deployed on JBoss 7.1.1 accepting commands (CQRS,
but only C and Q :) ). A console application (B) is sending a large volume
of commands to create entities in A. Entities in A are validated by Drools
(plain drl files, configured in spring using drools-spring). Most of the
time this works just fine. But sometimes, we get the following exception:

java.lang.LinkageError: loader (instance of 
org/drools/rule/JavaDialectRuntimeData$PackageClassLoader): attempted 
duplicate class definition for name:
"a/b/c/Rule_person_unique___name_656ee3db19d34e689d95e2d6b2be67b6"
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_gg___unique___name_656ee3db19d34e689d95e2d6b2be67b6Eval0InvokerGenerated.evaluate(Unknown
Source)
at
a.b.c.Rule_gg___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]

Any idea where this is coming from or what's causing this.

We are using:
- JBoss 7.1.1
- drools 5.4.0.Final
- jdk 1.6u30
- Windows 7 64 bit


regards,

Kenneth



--
View this message in context: 
http://drools.46999.n3.nabble.com/java-lang-LinkageError-but-only-sometimes-tp4020606.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Unsubscribe

2012-10-31 Thread Brenda Chodkowski


Thank you!
Brenda Chodkowski
Software Engineer

brenda.chodkow...@ctg.com
Tel: Cell: 716-696-2313 (Monday, Tuesday)  *  716-888-3681 (Wednesday, 
Thursday, Friday)
CTG * 700 Delaware Ave * Buffalo, NY 14209
www.ctg.com

[cid:image001.jpg@01CDB73A.23606B00]

The information transmitted is intended only for the person or entity to which
it is addressed and may contain confidential and/or privileged material. Any
review, retransmission, dissemination or other use of, or taking of any action
in reliance upon, this information by persons or entities other than the
intended recipient is prohibited. If you are not the intended recipient of this 
message, please contact the sender and delete this material from this computer.
<>___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] JITting error with 5.5.0.CR1

2012-10-31 Thread paulk_asert
I should have added that the script still completes successfully, it is only
the JIT optimization that is having problems and only when some threshold is
reached causing an attempt at performing the optimization - as per
descriptions I have read earlier. The problem is that I thought there was a
fix already in place for this problem if I read the earlier posts correctly
but perhaps I do not know how to enable it.


paulk_asert wrote
> When I run this Groovy script using drools 5.5.0.CR1 with numAnimals = 8
> and numLegs = 120, it works fine. If I set numAnimals = 17 and numLegs =
> 1020 then it fails with a JITting error. I saw a bunch of Jira issues
> related to JITting issues but no open ones seemed to match exactly.
> 
> @GrabResolver('https://repository.jboss.org/nexus/content/groups/public-jboss/')
> @Grab('org.drools:knowledge-api:5.5.0.CR1')
> @Grab('org.drools:drools-compiler:5.5.0.CR1')
> @Grab('org.drools:drools-core:5.5.0.CR1')
> @Grab('com.sun.xml.bind:jaxb-xjc:2.2.5.jboss-1')
> @GrabExclude('com.github.relaxng:relaxngDatatype')
> @GrabResolver('http://repo2.maven.org/maven2/')
> @Grab('org.mvel#mvel2;2.1.2.Final')
> @Grab('org.slf4j#slf4j-simple;1.6.4')
> import groovy.transform.Immutable
> import static org.drools.KnowledgeBaseFactory.newKnowledgeBase
> import static
> org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder
> import static org.drools.builder.ResourceType.DRL
> import static org.drools.io.ResourceFactory.newReaderResource
> 
> def numAnimals = 8
> def numLegs = 120
> def kbuilder = newKnowledgeBuilder()
> def drl = '''
> dialect "mvel"
> rule "deduce animal counts"
>   when
> $crane : Crane( )
> $centipede : Centipede( )
> $tortoise : Tortoise(
>   quantity + $crane.quantity + $centipede.quantity == ''' + numAnimals
> + ''',
>   quantity * numLegs + $crane.quantity * $crane.numLegs +
> $centipede.quantity * $centipede.numLegs == ''' + numLegs + '''
> )
>   then
> System.out.println( "Cranes " + $crane.getQuantity() )
> System.out.println( "Tortoises " + $tortoise.getQuantity() )
> System.out.println( "Centipedes " + $centipede.getQuantity() )
> end
> '''
> kbuilder.add(newReaderResource(new StringReader(drl)), DRL)
> def kbase = newKnowledgeBase()
> kbase.addKnowledgePackages(kbuilder.knowledgePackages)
> def ksession = kbase.newStatefulKnowledgeSession()
> 
> (numAnimals + 1).times { n ->
>   if (numLegs.intdiv(Crane.numLegs) >= n) {
> ksession.insert(new Crane(n))
>   }
>   if (numLegs.intdiv(Tortoise.numLegs) >= n) {
> ksession.insert(new Tortoise(n))
>   }
>   if (numLegs.intdiv(Centipede.numLegs) >= n) {
> ksession.insert(new Centipede(n))
>   }
> }
> 
> ksession.fireAllRules()
> ksession.dispose()
> 
> @Immutable
> class Crane {
>   static int numLegs = 2
>   int quantity
> }
> 
> @Immutable
> class Tortoise {
>   static int numLegs = 4
>   int quantity
> }
> 
> @Immutable
> class Centipede {
>   static int numLegs = 100
>   int quantity
> }
> 
> Here is the error message:
> 
> Exception in thread "Thread-1" java.lang.RuntimeException: Exception
> jitting: quantity + $crane.quantity + $centipede.quantity == 17 &&
> quantity * numLegs + $crane.quantity * $crane.numLegs +
> $centipede.quantity * $centipede.numLegs == 1020
>   at
> org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:275)
>   at
> org.drools.rule.constraint.MvelConstraint.access$200(MvelConstraint.java:51)
>   at
> org.drools.rule.constraint.MvelConstraint$ConditionJitter.run(MvelConstraint.java:250)
>   at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>   at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>   at java.lang.Thread.run(Thread.java:722)
> Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Error
> writing method evaluate
>   at
> org.drools.rule.builder.dialect.asm.ClassGenerator.newInstance(ClassGenerator.java:200)
>   at
> org.drools.rule.constraint.ASMConditionEvaluatorJitter.jitEvaluator(ASMConditionEvaluatorJitter.java:53)
>   at
> org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:273)
>   ... 5 more
> Caused by: java.lang.RuntimeException: Error writing method evaluate
>   at
> org.drools.rule.builder.dialect.asm.ClassGenerator$MethodDescr.write(ClassGenerator.java:881)
>   at
> org.drools.rule.builder.dialect.asm.ClassGenerator.generateBytecode(ClassGenerator.java:128)
>   at
> org.drools.rule.builder.dialect.asm.ClassGenerator.generateClass(ClassGenerator.java:144)
>   at
> org.drools.rule.builder.dialect.asm.ClassGenerator.newInstance(ClassGenerator.java:198)
>   ... 7 more
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
>   at org.mvel2.asm.Frame.merge(Frame.java:1373)
>   at org.mvel2.asm.Frame.merge(Frame.java:1329)
>   at org.mvel2.asm.MethodWriter.visitMaxs(MethodWriter.java:1282)
>   at
> org.drools.rule.bui

Re: [rules-users] To expose Rule created in drools expert as a webservice

2012-10-31 Thread Miguel Paraz
Hi,

On Wed, Oct 31, 2012 at 6:15 PM, amit  wrote:

> I am starting with Drools expert My usecase is to expose the rule written
> in Drools Expert as webservice. This webservice can be consumed by some
> external application. My question: Is this feasible. Thanks a lot in
> advance.
>

I'm starting to do this. I think it's feasible - I think there should be
official support.

This is my approach:
- Since Drools is single-threaded, it should only run on one worker thread
- It will use queues to talk to the web thread - receive objects to insert
before the rules are fired, and send objects inserted after the rules are
fired.
- to send objects, I'm using queries in the DRL file, and a live query to
listen for new objects to add to the queue for sending out

Hope this helps (and I hope it's correct!)

regards,
Miguel
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Debug rule functions ?

2012-10-31 Thread ipeshev
Hi,

the best option I've seen by now is the one mentioned by Armand Welsh - use
imported java class with methods instead of drools functions.

btw:
by now I group my classes into jars, but I've never tried to use standalone
.class files.
anyone tried this?
anything special (some settings) in order .class to be found?

(note: I use local .drl files instead of Guvnor repository to load rules
into memory)





--
View this message in context: 
http://drools.46999.n3.nabble.com/Debug-rule-functions-tp3689774p4020602.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] enquiry on drools webservice

2012-10-31 Thread amit
Hi Prem,

Do you have any update on this.

I am also trying to expose a rule as webservice

Many thanks in advance.



--
View this message in context: 
http://drools.46999.n3.nabble.com/enquiry-on-drools-webservice-tp56673p4020601.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] To expose Rule created in drools expert as a webservice

2012-10-31 Thread amit
I am starting with Drools expertMy usecase is to expose the rule written in
Drools Expert as webservice.This webservice can be consumed by some external
application.My question: Is this feasible.Thanks a lot in advance.



--
View this message in context: 
http://drools.46999.n3.nabble.com/To-expose-Rule-created-in-drools-expert-as-a-webservice-tp4020600.html
Sent from the Drools: User forum mailing list archive at Nabble.com.___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Eclipse Debugging Drl file

2012-10-31 Thread benq2188
Hello,

I faced with the same problem. Breakpoints are not being hit by debugger. I
have Eclipse SDK version: 4.2.1 and went through the reference manual of
Drools and followed each step carefully.

-Installed GEF
- Downloaded drools-distribution-5.4.0.Final.zip
-Unzipped it into Eclipse main folder
-Restarted Eclipse
-Defined run time based on the latest Drools project jars included in the
plugin
itself.
-Created Drools Project
-Created new launch configuration for Drools Application.
-Put a breakpoint in the helloworld simple project on the first line of the
section "then".

When I debug it as Drools Application, debugger stops in Java breakpoints
but doesn't stop in drl rule.

Any solutions, how can I fix it?

Thanks in advance.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Eclipse-Debugging-Drl-file-tp3870257p4020599.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Debug rule functions ?

2012-10-31 Thread benq2188
Hello,

I also followed reference manual of Drools but breakpoints are not being hit
by debugger in drl.

The steps that I went through: 

-Installed GEF
- downloaded drools-distribution-5.4.0.Final.zip
-unzipped it into Eclipse main folder
-restarted Eclipse
-defined run time  based on the latest Drools project jars included in the
plugin
itself,
-Created Drools Project
-Created new launch configuration for Drools Application.
-Put a breakpoint in the helloworld simple project on the first line of the
section "then".

When I debug it as Drools Application, debugger doesn't stop in drl rule.

Any solutions, how can I fix it?

Thanks in advance.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Debug-rule-functions-tp3689774p4020598.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] debug

2012-10-31 Thread benq2188
Hello,

I faced with the same problem. Breakpoints are not being hit by debugger. I
have Eclipse SDK version: 4.2.1 and went through the reference manual of
Drools and followed each step carefully.

-Installed GEF
- Downloaded drools-distribution-5.4.0.Final.zip
-Unzipped it into Eclipse main folder
-Restarted Eclipse
-Defined run time based on the latest Drools project jars included in the
plugin
itself.
-Created Drools Project
-Created new launch configuration for Drools Application.
-Put a breakpoint in the helloworld simple project on the first line of the
section "then".

When I debug it as Drools Application, debugger stops in Java breakpoints
but doesn't stop in drl rule.

Also tried what Bruno suggested but it did not worked too.

Any other solutions, how can I fix it?

Thanks in advance.



--
View this message in context: 
http://drools.46999.n3.nabble.com/debug-tp3889772p4020597.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users