Re: [rules-users] NPE on fact insertion if rule has sliding window

2011-10-07 Thread mike9322

laune wrote:
 
 There's a bug in the incremental build as done by the KnowledgeAgent. If
 the
 KA configuration property drools.agent.newInstance is set to false, some
 type information is not put into the new KBase.
 

I added the following comment to the JIRA related to this issue
(https://issues.jboss.org/browse/JBRULES-3145).  Cross-posting here in case
anyone else is having the issue and arrives here via Google like I did.

I am seeing the same behavior with my KA newInstance = true. I was able to
workaround it by ensuring that my event POJOs are defined in the same
package as my rules.

In other words, this DOES NOT work:
Rule package: com.example.rules
POJO package: com.example.rules.model (import statements included in DRL)

This DOES work:
Rule package: com.example.rules
POJO package: com.example.rules (no import statements required)

I did not have to move my event declaration to my DRL; they are still POJOs.
I would prefer to have my POJOs in their own package but I can live with
this workaround for now.

Mike


--
View this message in context: 
http://drools.46999.n3.nabble.com/NPE-on-fact-insertion-if-rule-has-sliding-window-tp3163261p3403934.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] NPE on fact insertion if rule has sliding window

2011-10-07 Thread Edson Tirelli
   This is fixed in master. Will be in 3.1 final release.

   Edson

2011/10/7 mike9322 michael.melton@navy.mil


 laune wrote:
 
  There's a bug in the incremental build as done by the KnowledgeAgent. If
  the
  KA configuration property drools.agent.newInstance is set to false, some
  type information is not put into the new KBase.
 

 I added the following comment to the JIRA related to this issue
 (https://issues.jboss.org/browse/JBRULES-3145).  Cross-posting here in
 case
 anyone else is having the issue and arrives here via Google like I did.

 I am seeing the same behavior with my KA newInstance = true. I was able to
 workaround it by ensuring that my event POJOs are defined in the same
 package as my rules.

 In other words, this DOES NOT work:
 Rule package: com.example.rules
 POJO package: com.example.rules.model (import statements included in DRL)

 This DOES work:
 Rule package: com.example.rules
 POJO package: com.example.rules (no import statements required)

 I did not have to move my event declaration to my DRL; they are still
 POJOs.
 I would prefer to have my POJOs in their own package but I can live with
 this workaround for now.

 Mike


 --
 View this message in context:
 http://drools.46999.n3.nabble.com/NPE-on-fact-insertion-if-rule-has-sliding-window-tp3163261p3403934.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




-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] NPE on fact insertion if rule has sliding window

2011-10-07 Thread Michael Anstis
Edson, you mean 5.3.Final?

sent on the move

On 7 Oct 2011 21:08, Edson Tirelli ed.tire...@gmail.com wrote:


This is fixed in master. Will be in 3.1 final release.

Edson

 2011/10/7 mike9322 michael.melton@navy.mil


 laune wrote:
 
  There's a bug in the incremental build as done by the KnowledgeAgent. If
  the
  KA configuration property drools.agent.newInstance is set to false, some
  type information is not put into the new KBase.
 

 I added the following comment to the JIRA related to this issue
 (https://issues.jboss.org/browse/JBRULES-3145).  Cross-posting here in
 case
 anyone else is having the issue and arrives here via Google like I did.

 I am seeing the same behavior with my KA newInstance = true. I was able
 to
 workaround it by ensuring that my event POJOs are defined in the same
 package as my rules.

 In other words, this DOES NOT work:
 Rule package: com.example.rules
 POJO package: com.example.rules.model (import statements included in DRL)

 This DOES work:
 Rule package: com.example.rules
 POJO package: com.example.rules (no import statements required)

 I did not have to move my event declaration to my DRL; they are still
 POJOs.
 I would prefer to have my POJOs in their own package but I can live with
 this workaround for now.

 Mike


 --
 View this message in context:
 http://drools.46999.n3.nabble.com/NPE-on-fact-insertion-if-rule-has-sliding-window-tp3163261p3403934.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




 --
   Edson Tirelli
   JBoss Drools Core Development
   JBoss by Red Hat @ www.jboss.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] NPE on fact insertion if rule has sliding window

2011-10-07 Thread Edson Tirelli
   Lol, I guess I need a cup of coffee.

   Yes, that was what I meant.

   Edson

2011/10/7 Michael Anstis michael.ans...@gmail.com

 Edson, you mean 5.3.Final?

 sent on the move

 On 7 Oct 2011 21:08, Edson Tirelli ed.tire...@gmail.com wrote:


This is fixed in master. Will be in 3.1 final release.

Edson

 2011/10/7 mike9322 michael.melton@navy.mil


 laune wrote:
 
  There's a bug in the incremental build as done by the KnowledgeAgent.
 If
  the
  KA configuration property drools.agent.newInstance is set to false,
 some
  type information is not put into the new KBase.
 

 I added the following comment to the JIRA related to this issue
 (https://issues.jboss.org/browse/JBRULES-3145).  Cross-posting here in
 case
 anyone else is having the issue and arrives here via Google like I did.

 I am seeing the same behavior with my KA newInstance = true. I was able
 to
 workaround it by ensuring that my event POJOs are defined in the same
 package as my rules.

 In other words, this DOES NOT work:
 Rule package: com.example.rules
 POJO package: com.example.rules.model (import statements included in DRL)

 This DOES work:
 Rule package: com.example.rules
 POJO package: com.example.rules (no import statements required)

 I did not have to move my event declaration to my DRL; they are still
 POJOs.
 I would prefer to have my POJOs in their own package but I can live with
 this workaround for now.

 Mike


 --
 View this message in context:
 http://drools.46999.n3.nabble.com/NPE-on-fact-insertion-if-rule-has-sliding-window-tp3163261p3403934.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




 --
   Edson Tirelli
   JBoss Drools Core Development
   JBoss by Red Hat @ www.jboss.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




-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] NPE on fact insertion if rule has sliding window

2011-07-14 Thread Wolfgang Laun
On 13 July 2011 17:09, John jfull...@progeny.net wrote:

 Interesting... I have no idea why the KnowledgeBuilder would compile the
 DRL
 differently than the KnowledgeAgent,


There's a bug in the incremental build as done by the KnowledgeAgent. If the
KA configuration property drools.agent.newInstance is set to false, some
type information is not put into the new KBase.
-W


 but I don't think I had this problem in
 5.1.1.  I'm up and running now with the type fully declared in DRL and I
 can
 live with that.  Thanks for looking into this.

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/NPE-on-fact-insertion-if-rule-has-sliding-window-tp3163261p3166323.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] NPE on fact insertion if rule has sliding window

2011-07-13 Thread Wolfgang Laun
I'm pretty sure that this is a bug. When compiling a DRL from a Chenge Set,
the resulting package
in the Knowledge Base does not contain declare'd types that do not contain
fields; it only contains declares with at least one field.

This results in a ClassObjectTypeConf with a typeDecl == null, and the
damage is done.

I'd say that this is a show stopper for any combination of ChangeSet / Pojo
as Event.

-W


On 12 July 2011 19:32, John jfull...@progeny.net wrote:

 Hello,

 I've been messing with this for days now and can't get to the bottom of
 this.  I'm using drools 5.2.0 Final and setting up my KnowledgeBase with a
 KnowledgeAgent which is pulling a package from guvnor (also 5.2.0 Final).
  I
 do NOT get this error if I use a KnowledgeBuilder and add the exact same
 drl
 file as a resource.

 If the DRL in guvnor has a rule that uses a sliding window, i get an NPE
 when trying to insert an object and the following stack trace:

 java.lang.NullPointerException
at

 org.drools.reteoo.ReteooFactHandleFactory.newFactHandle(ReteooFactHandleFactory.java:56)
at

 org.drools.common.AbstractFactHandleFactory.newFactHandle(AbstractFactHandleFactory.java:80)
at

 org.drools.common.AbstractFactHandleFactory.newFactHandle(AbstractFactHandleFactory.java:65)
at
 org.drools.common.NamedEntryPoint.createHandle(NamedEntryPoint.java:705)
at
 org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:282)
at

 org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:905)
at

 org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:864)
at

 org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:255)
at john.DroolsError.runRules(DroolsError.java:48)
at john.DroolsError.main(DroolsError.java:40)

 Here is the DRL:

 1.  |   package drools
 2.  |   import simple.SimpleType
 3.  |
 4.  |
 5.  |
 6.  |
 7.  |
 8.  |
 9.  |   import simple.SimpleType;
 10. |
 11. |   declare SimpleType
 12. |   @role(event)
 13. |   end
 14. |
 15. |   rule timer
 16. |   timer (cron:5/5 * * * * ?)
 17. |   when
 18. |   $newest : Number()
 19. |   from accumulate( SimpleType ($num : number) over
 window:time(5s),
 20. |   max($num) )
 21. |   $st : SimpleType( number == $newest.intValue )
 22. |   then
 23. |   System.out.println(SimpleType:  + $st.number);
 24. |   end
 (note: the first import of simple.SimpleType comes from the package
 configuration in guvnor, the second is in the drl file itself. the file
 will
 not validate without the import explicitly listed there, saying the type is
 not declared as an event...)

 Here is the Java code:

 ResourceChangeScannerConfiguration sconf = ResourceFactory
.getResourceChangeScannerService()
.newResourceChangeScannerConfiguration();
sconf.setProperty(drools.resource.scanner.interval, 20);

  ResourceFactory.getResourceChangeScannerService().configure(sconf);

KnowledgeBaseConfiguration config = KnowledgeBaseFactory
.newKnowledgeBaseConfiguration();
config.setOption(EventProcessingOption.STREAM);

KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory
.newKnowledgeAgentConfiguration();
aconf.setProperty(drools.agent.scanDirectories, true);
aconf.setProperty(drools.agent.scanResources, true);
aconf.setProperty(drools.agent.newInstance, false);
KnowledgeBase kbase =
 KnowledgeBaseFactory.newKnowledgeBase(config);
KnowledgeAgent kagent =
 KnowledgeAgentFactory.newKnowledgeAgent(
drools agent, kbase, aconf);

String urlString =
 
 http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/drools/LATEST/ChangeSet.xml
 ;
try {
URL url = new URL(urlString);
UrlResource urlResource = (UrlResource)
 ResourceFactory
.newUrlResource(url);
urlResource.setBasicAuthentication(enabled);
urlResource.setUsername(John);
urlResource.setPassword();
kagent.applyChangeSet(urlResource);
} catch (Exception e) {
System.out.println(Caught exception:  +
 e.getMessage());
e.printStackTrace();
}

ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();


Re: [rules-users] NPE on fact insertion if rule has sliding window

2011-07-13 Thread Wolfgang Laun
If the event type is fully declared in DRL, the NPE does not occur.

What is the difference between DRL being compiled in the course of a
ChangeSet in contrast to being compiled by a KnowledgeBuilder?

-W



On 13 July 2011 15:05, Wolfgang Laun wolfgang.l...@gmail.com wrote:

 I'm pretty sure that this is a bug. When compiling a DRL from a Chenge Set,
 the resulting package
 in the Knowledge Base does not contain declare'd types that do not contain
 fields; it only contains declares with at least one field.

 This results in a ClassObjectTypeConf with a typeDecl == null, and the
 damage is done.

 I'd say that this is a show stopper for any combination of ChangeSet / Pojo
 as Event.

 -W


 On 12 July 2011 19:32, John jfull...@progeny.net wrote:

 Hello,

 I've been messing with this for days now and can't get to the bottom of
 this.  I'm using drools 5.2.0 Final and setting up my KnowledgeBase with a
 KnowledgeAgent which is pulling a package from guvnor (also 5.2.0 Final).
  I
 do NOT get this error if I use a KnowledgeBuilder and add the exact same
 drl
 file as a resource.

 If the DRL in guvnor has a rule that uses a sliding window, i get an NPE
 when trying to insert an object and the following stack trace:

 java.lang.NullPointerException
at

 org.drools.reteoo.ReteooFactHandleFactory.newFactHandle(ReteooFactHandleFactory.java:56)
at

 org.drools.common.AbstractFactHandleFactory.newFactHandle(AbstractFactHandleFactory.java:80)
at

 org.drools.common.AbstractFactHandleFactory.newFactHandle(AbstractFactHandleFactory.java:65)
at
 org.drools.common.NamedEntryPoint.createHandle(NamedEntryPoint.java:705)
at
 org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:282)
at

 org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:905)
at

 org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:864)
at

 org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:255)
at john.DroolsError.runRules(DroolsError.java:48)
at john.DroolsError.main(DroolsError.java:40)

 Here is the DRL:

 1.  |   package drools
 2.  |   import simple.SimpleType
 3.  |
 4.  |
 5.  |
 6.  |
 7.  |
 8.  |
 9.  |   import simple.SimpleType;
 10. |
 11. |   declare SimpleType
 12. |   @role(event)
 13. |   end
 14. |
 15. |   rule timer
 16. |   timer (cron:5/5 * * * * ?)
 17. |   when
 18. |   $newest : Number()
 19. |   from accumulate( SimpleType ($num : number) over
 window:time(5s),
 20. |   max($num) )
 21. |   $st : SimpleType( number == $newest.intValue )
 22. |   then
 23. |   System.out.println(SimpleType:  + $st.number);
 24. |   end
 (note: the first import of simple.SimpleType comes from the package
 configuration in guvnor, the second is in the drl file itself. the file
 will
 not validate without the import explicitly listed there, saying the type
 is
 not declared as an event...)

 Here is the Java code:

 ResourceChangeScannerConfiguration sconf = ResourceFactory
.getResourceChangeScannerService()
.newResourceChangeScannerConfiguration();
sconf.setProperty(drools.resource.scanner.interval,
 20);

  ResourceFactory.getResourceChangeScannerService().configure(sconf);

KnowledgeBaseConfiguration config = KnowledgeBaseFactory
.newKnowledgeBaseConfiguration();
config.setOption(EventProcessingOption.STREAM);

KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory
.newKnowledgeAgentConfiguration();
aconf.setProperty(drools.agent.scanDirectories, true);
aconf.setProperty(drools.agent.scanResources, true);
aconf.setProperty(drools.agent.newInstance, false);
KnowledgeBase kbase =
 KnowledgeBaseFactory.newKnowledgeBase(config);
KnowledgeAgent kagent =
 KnowledgeAgentFactory.newKnowledgeAgent(
drools agent, kbase, aconf);

String urlString =
 
 http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/drools/LATEST/ChangeSet.xml
 ;
try {
URL url = new URL(urlString);
UrlResource urlResource = (UrlResource)
 ResourceFactory
.newUrlResource(url);
urlResource.setBasicAuthentication(enabled);
urlResource.setUsername(John);
urlResource.setPassword();
kagent.applyChangeSet(urlResource);
} catch (Exception e) {

Re: [rules-users] NPE on fact insertion if rule has sliding window

2011-07-13 Thread John
Interesting... I have no idea why the KnowledgeBuilder would compile the DRL
differently than the KnowledgeAgent, but I don't think I had this problem in
5.1.1.  I'm up and running now with the type fully declared in DRL and I can
live with that.  Thanks for looking into this.

--
View this message in context: 
http://drools.46999.n3.nabble.com/NPE-on-fact-insertion-if-rule-has-sliding-window-tp3163261p3166323.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] NPE on fact insertion if rule has sliding window

2011-07-13 Thread Wolfgang Laun
On 13 July 2011 17:09, John jfull...@progeny.net wrote:

 Interesting... I have no idea why the KnowledgeBuilder would compile the
 DRL
 differently than the KnowledgeAgent, but I don't think I had this problem
 in
 5.1.1.


Yes, it's OK in 5.1.1; I've verified this with my simplified setup using
file: rather than http:
-W



  I'm up and running now with the type fully declared in DRL and I can
 live with that.  Thanks for looking into this.

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/NPE-on-fact-insertion-if-rule-has-sliding-window-tp3163261p3166323.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