Re: [rules-users] KnowledgeAgent and Guvnor restart

2011-04-13 Thread Gerret Hansper
Thank you, Esteban,
this is working for me.
Also, with Drools 5.1.1 the KnowledgeAgent is resubscribing to Guvnor after
shutdown/restart even without the disk cache.

Best Regards,
  Gerret

--
View this message in context: 
http://drools.46999.n3.nabble.com/KnowledgeAgent-and-Guvnor-restart-tp139364p2816256.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] Can I create sub packages in Guvnor

2010-12-15 Thread Gerret Hansper

Hello,

if you have a package com.foo in Guvnor it is possible to create a new
package com.foo.bar.
Guvnor will then place the bar package beneath the foo package in the
KBaseTree.
But other than that the sub package doesn't have any relation to its parent,
which I find unfortunate, too.
I was hoping to be able to inherit e.g. the parent's model or functions in
the sub package.
My scenario is that we have a couple of KnowledgeBases that share a common
set of rules, each having further specific ones which I put into sub
packages. 
Now, whenever there is a change in a library that my common rules depend on,
I've got to update all of the packages' models which may amount to quite
some click-work in Guvnor.
Does anybody have a suggestion for an easier way to achieve this?

Regards,
Gerret 
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Can-I-create-sub-packages-in-Guvnor-tp2092247p2094324.html
Sent from the Drools - User 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] Can I create sub packages in Guvnor

2010-12-15 Thread Gerret Hansper

Hmm...
I'm currently working with 5.0 which doesn't have built-in selectors. As you
have said, I would consider this a workaround. I'm not so much in favour of
relying on a manual build and configuration process with setting the right
categories, choosing the respective selector and creating a snapshot that
uniquely identifies what has been built. When all I wanna do is simply
build the package...

Perhaps I'm thinking too much in terms of Java/Eclipse development here. I
used to build the Packages with Ant from Eclipse which worked fine until I
switched to using the KnowledgeAgent and found out that it can't compile
them. We are now using the Guvnor basically as a Package builder, not really
as a BRMS. Maybe not too surprising if there is some mismatch between
developer-centric-drl-coding and business rule authoring :-)

Cheers,
  Gerret
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Can-I-create-sub-packages-in-Guvnor-tp2092247p2097004.html
Sent from the Drools - User 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] Reference a declared FactType from another rule file?

2010-11-30 Thread Gerret Hansper
Hi all,

does anybody know whether it's possible to reference a FactType declared 
in one rule file from another one? I'm developing rules with Eclipse 
(using Drools 5.0.1) and the rules are spread over a couple of .drl 
files. It would be nice to be able to declare a FactType in one file, 
have a rule insert instances of it into working memory and have another 
rule in another file (but the same package) use it in its LHS.
I've tried various import statements but the compiler doesn't seem to be 
able to resolve the reference.

Thanks,
 Gerret



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


Re: [rules-users] Reference a declared FactType from another rule file?

2010-11-30 Thread Gerret Hansper

Thank you, Wolfgang.
Indeed, it works if I compile programmatically via Ant and make sure I'm
getting the order correct.
Unfortunately, still, the Eclipse compiler complains. I've tried splitting
rules into two source folders and placing the one with the FactType on top
of the build path, but no success.
Perhaps I should try with Drools 5.1.

Regards,
  Gerret
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Reference-a-declared-FactType-from-another-rule-file-tp1994986p1997547.html
Sent from the Drools - User 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] Persistence issue using Oracle

2010-03-12 Thread Gerret Hansper

Hi Ram,

I've been using hibernate 3.3 with an Oracle11g which auto-created the dirty
column as a NUMBER(1,0) type.

Giving it a quick try, when I map as you've sketched above and add

 property name=dirty access=field type=boolean column=dirty 
length=1/

to the sessionInfo mapping the dirty column is created as NUMBER(1,0). Using
type=true_false instead of boolean it becomes CHAR(1 BYTE).
Perhaps one of these works for you?

Regards,
 Gerret

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


Re: [rules-users] Persistence issue using Oracle

2010-03-12 Thread Gerret Hansper
Forgot to mention that you might need to adjust the Hibernate dialect:

property name=hibernate.dialect value=org.hibernate.dialect.OracleDialect/

Greetings,
 Gerret



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


Re: [rules-users] Persistence issue using Oracle

2010-03-02 Thread Gerret Hansper

wytten dale.wyttenbach at gmail.com writes:

 
 The tables will be created depending on how you have persistence.xml
 configured (I used hibernate.hbm2ddl.auto value 'create')
 However, I did experience a problem with the eventTypes member of
 ProcessInstanceInfo:
 'create table ProcessInstanceInfo_eventTypes' yields the error 'ORA-00972:
 identifier is too long'. 
 
 The team is aware of this but I haven't seen a fix yet.
 
 Hope this helps.
 

Regarding the ProcessInstanceInfo table you can add a hibernate mapping
like
  mapping resource=hbm.xml/
in persistence.xml
and then in hbm.xml something similar to

hibernate-mapping package=com.foo.bar
class 
name=org.drools.persistence.processinstance.ProcessInstanceEventInfo
table=PI_EVT_INFO
id name=processInstanceId access=field type=long column=pi_id/
/class
/hibernate-mapping

It's a while ago that I've been experimenting with the flow persistence but this
was the last step required to finally make it work, as far as I remember.

Regards,
Gerret




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


Re: [rules-users] Unable to see Rules Debugging info in Drools IDE

2010-03-02 Thread Gerret Hansper
H.C. canterburry at gmail.com writes:

 
 
 Hey,
 
 I am having the same problem. I have tried dubugging both as a Drools
 Application and a Drools Unit Test and in either case, I get no agenda,
 working memory or globals in the views even when I select an data item from
 Variables view in the Debug perspective. I saw some posts recommending
 switching back and forth between views and that does not seem to help.
 
 Platform and JBoss Tools drools version
 Eclipse 3.4.2 (stable and development - 5.1.0.v201002254M-H277-31764)
 Eclipse 3.5 (stable, development and latest from nightly build
 v20100022613N-H20-31746)
 
 No difference.
 
 Would very much appreciate some help.

Are you using a StatelessKnowledgeSession? Debugging views only work for
StatefulKnowledgeSessions (unfortunately).

Regards,
Gerret



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


[rules-users] Drools Ant task packages not read by KnowledgeAgent

2010-02-22 Thread Gerret Hansper
Hi all,

for deploying our rules we usually create packages in Guvnor 
and then deploy the .pkg binaries to our application where we access them 
via a change set file, e.g. as a classpath or url resource.

We have also used the Drools Ant task to create packages directly from 
the rule sources in Eclipse, cause it would be convenient for testing and 
development purposes to be able to just drop that file in place of the one
created from Guvnor.

However it seems that the KnowledgeAgent can't read the pkg format produced
from the Ant task, we get an Exception as follows:

java.lang.RuntimeException: KnowledgeAgent exception while trying to 
deserialize KnowledgeDefinitionsPackage  
 at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources
(KnowledgeAgentImpl.java:418)
 at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet
(KnowledgeAgentImpl.java:120)
 ...
Caused by: java.lang.ClassCastException: org.drools.reteoo.ReteooRuleBase
 at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources
(KnowledgeAgentImpl.java:413)

We are using the same drools-core.jar for building and running so I don't think
this is a simple class version mismatch.

Has anybody got a similar scenario working? Any clue what we might be doing 
wrong? (We are using Drools 5.0.1.)

Thanks,
Gerret


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


Re: [rules-users] Flow and Rules Together - Best practice question

2010-02-18 Thread Gerret Hansper
Hi Mike,

I have been working with Drools for only a few months now and am still rather
new to it, but we've have made the same experience, switching from rules only to
rules with flow, and I'm certain it's the right way to go.

The performance implications you mention depend mainly on the way the rules are
set up, I guess. 
That is, if you have expensive RHS expressions like eval() you might indeed
profit from keeping your glucose-level condition at the beginning of the rules
which would prevent those expressions from being reevaluted, as far as I
understand. 
If you don't I can hardly imagine that activating the rules makes up a
noticeable fraction of the overall time of your process.

We here have a scenario where some rules may be activated only if the user
starting the session has got corresponding privileges. 
Since determining the priviliges is not always trivial we definitely wanted to
have that logic in one place. The first thing to do was to use inference
(http://docs.codehaus.org/display/LOGICABYSS/Policy+Encapsulation) but still
already with a few dozen rules and including other constraints the rule RHsides
became rather cluttered. Moreover it was getting increasingly complex to 
control the order in which the rules fired, maintanance being another issue. 

Using a rule flow we have achieved really good separation of concerns: A rule's
RHS mostly contains exactly those conditions that apply to its intent, none of
the cross-concerns or technicalities. (Hey, what about an AspectDrools
implementation? ;-) )
I am confident that OO lessons apply here, too: If you have a clean design and
performance problems start to show up you are much more likely to solve them
than if you have a tangled web of dependencies.

Greetings,
Gerret


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


[rules-users] KnowledgeAgent and Guvnor restart

2010-01-26 Thread Gerret Hansper
Hello,

I have got an issue with the KnowledgeAgent that seems not to survive a Guvnor 
restart. The scenario is as follows:

* We use Drools 5.0 
* On our application server we create a KnowledgeAgent 
applying a ChangeSet that points to a package binary on a separate Guvnor 
server 
like so:

SystemEventListenerFactory.setSystemEventListener(new 
SystemEventLogger()); 
ResourceFactory.getResourceChangeNotifierService().start(); 
ResourceFactory.getResourceChangeScannerService().start(); 
KnowledgeAgent agent = 
KnowledgeAgentFactory.newKnowledgeAgent(workflowName); 
agent.applyChangeSet(changeSet);

* Creating the kbase, registering globals and running sessions works fine. 
* We shut down Guvnor (or the connection goes down, this was how we spotted the 
problem) and restart it after a minute 
* We then try to run sessions from the 
same agent as above via 
kagent.getKnowledgeBase().newStatefulKnowledgeSession(); 
which returns a ksession, but then setting a global we get

  java.lang.RuntimeException: Unexpected global [log]   
  at 
  org.drools.common.AbstractWorkingMemory.setGlobal(AbstractWorkingMemory.java:5
  50) 
  at 
  org.drools.impl.StatefulKnowledgeSessionImpl.setGlobal(StatefulKnowledgeSessio
  nImpl.java:284)

From the debugger I can see that indeed the ruleBase's globals map is empty. 
The 
SystemEventLogger indicates that the KnowledgeAgent unsubscribes from its 
resource when Guvnor is down and rebuilds its kbase. Also, it stops scanning 
the 
resource and does not find it once Guvnor is up again. (See log snippet below).
 
Wouldn't it be better in these cases to keep the resource as is in memory and 
try to rescan? I figure that as long as the resource is specified in the 
changeSet it should be considered part of the kbase and not be removed if it 
cannot be found. 

For the time being, does anyone have a suggestion how to avoid these problems? 
We could catch the RuntimeException and recreate the KnowledgeAgent, but 
perhaps 
there is a better way?

Thanks, Gerret


-- SystemEventLog -- 
# Guvnor is up here 
07:58:01,881 ResourceChangeScanner attempt to scan 1 resources 
07:58:02,209 ResourceChangeScanner thread is waiting for 60 
07:58:15,067 ResourceChangeScanner attempt to scan 1 resources 
# Guvnor goes down here 
07:58:16,738 ResourceChangeScanner removed resource=[UrlResource 
path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST'] 
07:58:16,738 ResourceChangeNotification received ChangeSet notification 
07:58:16,738 ResourceChangeScanner thread is waiting for 60 
07:58:16,738  ResourceChangeNotification processing ChangeSet 
07:58:16,738 ResourceChangeNotification ChangeSet removed resource=[UrlResource 
path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST'] for 
listener=org.drools.agent.impl.knowledgeagenti...@1053d6d 
07:58:16,738 ResourceChangeNotification ChangeSet removed resource=[UrlResource 
path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST'] for 
listener=org.drools.agent.impl.knowledgeagenti...@b71c17 
07:58:16,738 KnowledgeAgent received ChangeSet changed notification 
07:58:16,738 KnowledgeAgent received ChangeSet changed notification 
07:58:16,738 KnowledgAgent applying ChangeSet 
07:58:16,738 ResourceChangeNotification thread is waiting for queue update 
07:58:16,738 KnowledgAgent applying ChangeSet 
07:58:16,738 KnowledgeAgent unsubscribing from resource=[UrlResource 
path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST'] 
07:58:16,738 ResourceChangeNotification unsubscribing 
listener=org.drools.agent.impl.knowledgeagenti...@1053d6d to 
resource=[UrlResource path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST'] 
07:58:16,738 KnowledgeAgent rebuilding KnowledgeBase using ChangeSet 
07:58:16,738 KnowledgeAgent unsubscribing from resource=[UrlResource 
path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST'] 
07:58:16,738 ResourceChangeNotification unsubscribing 
listener=org.drools.agent.impl.knowledgeagenti...@b71c17 to 
resource=[UrlResource path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST'] 
07:58:16,738 
KnowledgeAgent rebuilding KnowledgeBase using ChangeSet 
07:58:16,738 KnowledgeAgent new KnowledgeBase now built and in use 
07:58:16,738 KnowledgeAgent new KnowledgeBase now built and in use 
07:59:02,202 ResourceChangeScanner attempt to scan 0 resources 
07:59:02,202 ResourceChangeScanner thread is waiting for 60 
# Guvnor back up here 
07:59:16,731 ResourceChangeScanner attempt to scan 0 resources 
07:59:16,731 ResourceChangeScanner thread is waiting for 60


___
rules-users mailing list
rules-users@lists.jboss.org

[rules-users] KnowledgeAgent and Guvnor restart

2010-01-26 Thread Gerret Hansper
Hello,

I have got an issue with the KnowledgeAgent that seems not to survive a Guvnor 
restart. The scenario is as follows:

* We use Drools 5.0 
* On our application server we create a KnowledgeAgent 
applying a ChangeSet that points to a package binary on a separate Guvnor 
server 
like so:

SystemEventListenerFactory.setSystemEventListener(new 
SystemEventLogger()); 
ResourceFactory.getResourceChangeNotifierService().start(); 
ResourceFactory.getResourceChangeScannerService().start(); 
KnowledgeAgent agent = 
KnowledgeAgentFactory.newKnowledgeAgent(workflowName); 
agent.applyChangeSet(changeSet);

* Creating the kbase, registering globals and running sessions works fine. 
* We shut down Guvnor (or the connection goes down, this was how we spotted the 
problem) and restart it after a minute 
* We then try to run sessions from the 
same agent as above via 
kagent.getKnowledgeBase().newStatefulKnowledgeSession(); 
which returns a ksession, but then setting a global we get

  java.lang.RuntimeException: Unexpected global [log]   
  at 
  org.drools.common.AbstractWorkingMemory.setGlobal(AbstractWorkingMemory.java:5
  50) 
  at 
  org.drools.impl.StatefulKnowledgeSessionImpl.setGlobal(StatefulKnowledgeSessio
  nImpl.java:284)

From the debugger I can see that indeed the ruleBase's globals map is empty. 
The 
SystemEventLogger indicates that the KnowledgeAgent unsubscribes from its 
resource when Guvnor is down and rebuilds its kbase. Also, it stops scanning 
the 
resource and does not find it once Guvnor is up again. (See log snippet below).
 
Wouldn't it be better in these cases to keep the resource as is in memory and 
try to rescan? I figure that as long as the resource is specified in the 
changeSet it should be considered part of the kbase and not be removed if it 
cannot be found. 

For the time being, does anyone have a suggestion how to avoid these problems? 
We could catch the RuntimeException and recreate the KnowledgeAgent, but 
perhaps 
there is a better way?

Thanks, Gerret


-- SystemEventLog -- 
# Guvnor is up here 
07:58:01,881 ResourceChangeScanner attempt to scan 1 resources 
07:58:02,209 ResourceChangeScanner thread is waiting for 60 
07:58:15,067 ResourceChangeScanner attempt to scan 1 resources 
# Guvnor goes down here 
07:58:16,738 ResourceChangeScanner removed resource=[UrlResource 
path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST'] 
07:58:16,738 ResourceChangeNotification received ChangeSet notification 
07:58:16,738 ResourceChangeScanner thread is waiting for 60 
07:58:16,738  ResourceChangeNotification processing ChangeSet 
07:58:16,738 ResourceChangeNotification ChangeSet removed resource=[UrlResource 
path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST'] for 
listener=org.drools.agent.impl.knowledgeagenti...@1053d6d 
07:58:16,738 ResourceChangeNotification ChangeSet removed resource=[UrlResource 
path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST'] for 
listener=org.drools.agent.impl.knowledgeagenti...@b71c17 
07:58:16,738 KnowledgeAgent received ChangeSet changed notification 
07:58:16,738 KnowledgeAgent received ChangeSet changed notification 
07:58:16,738 KnowledgAgent applying ChangeSet 
07:58:16,738 ResourceChangeNotification thread is waiting for queue update 
07:58:16,738 KnowledgAgent applying ChangeSet 
07:58:16,738 KnowledgeAgent unsubscribing from resource=[UrlResource 
path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST'] 
07:58:16,738 ResourceChangeNotification unsubscribing 
listener=org.drools.agent.impl.knowledgeagenti...@1053d6d to 
resource=[UrlResource path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST'] 
07:58:16,738 KnowledgeAgent rebuilding KnowledgeBase using ChangeSet 
07:58:16,738 KnowledgeAgent unsubscribing from resource=[UrlResource 
path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST'] 
07:58:16,738 ResourceChangeNotification unsubscribing 
listener=org.drools.agent.impl.knowledgeagenti...@b71c17 to 
resource=[UrlResource path='http://localhost:7080/drools-
guvnor/org.drools.guvnor.Guvnor/package/com.foo.bar/LATEST'] 
07:58:16,738 
KnowledgeAgent rebuilding KnowledgeBase using ChangeSet 
07:58:16,738 KnowledgeAgent new KnowledgeBase now built and in use 
07:58:16,738 KnowledgeAgent new KnowledgeBase now built and in use 
07:59:02,202 ResourceChangeScanner attempt to scan 0 resources 
07:59:02,202 ResourceChangeScanner thread is waiting for 60 
# Guvnor back up here 
07:59:16,731 ResourceChangeScanner attempt to scan 0 resources 
07:59:16,731 ResourceChangeScanner thread is waiting for 60

-- 
Nur noch bis 31.01.2010: DSL-Komplettpaket für 16,99 Euro/mtl.!*
http://portal.gmx.net/de/go/dsl02

[rules-users] Exception handling policy

2010-01-08 Thread Gerret Hansper
Hello,
I have got a question about Exception handling policy in Drools 5.0.

My issue is a case where a client application triggered rule execution on the
server, which was throwing a ConsequenceException.
The client, not having drools libs in its classpath, then had a
ClassNotFoundException.
I would therefore want to catch the ConsequenceException on the server and throw
an Exception with its cause.
I am not sure however if ConsequenceException.getCause() would always yield a
non-drools Exception or if that might be another drools type.
Also, is it always a ConsequenceException that gets thrown from a session or can
there be other Exception types?

Thanks,
Gerret

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