Hide Forgot
securitylevel_name: Public 1. When I declare a fact as an event (in the advanced config): declare TestModel @role(event) @timestamp(event_date) @expires(5m) end and try to use this package with the rule agent I end up with a null when getting a Fact Type: KnowledgeBaseImpl kb = (KnowledgeBaseImpl) kagent.getKnowledgeBase(); FactType modelType = kb.getRuleBase().getFactType(path + ".TestModel"); modelType is null 2. When I use temporal constraints like this: $t1: TestModel( test == "2" ) from entry-point "ep" $t2: TestModel( test == "2", id != $t1.id, this after [0s,1m] $t1) from entry-point "ep" and try to use this package with the rule agent I end up with following errors: [2009:10:299 18:10:514:info] KnowledgAgent applying ChangeSet [2009:10:299 18:10:518:debug] KnowledgeAgent subscribing to resource=[UrlResource path='http://10.16.93.36:8080/jboss-brms/org.drools.guvnor.Guvnor/package/withcep/LATEST'] [2009:10:299 18:10:518:debug] ResourceChangeNotification subscribing listener=org.drools.agent.impl.KnowledgeAgentImpl@ef5502 to resource=[UrlResource path='http://10.16.93.36:8080/jboss-brms/org.drools.guvnor.Guvnor/package/withcep/LATEST'] [2009:10:299 18:10:519:debug] ResourceChangeScanner subcribing notifier=org.drools.io.impl.ResourceChangeNotifierImpl@e2dae9 to resource=[UrlResource path='http://10.16.93.36:8080/jboss-brms/org.drools.guvnor.Guvnor/package/withcep/LATEST'] [2009:10:299 18:10:520:debug] KnowledgeAgent ChangeSet requires KnowledgeBuilder [2009:10:299 18:10:520:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet [2009:10:299 18:10:521:debug] KnowledgeAgent building resource=[UrlResource path='http://10.16.93.36:8080/jboss-brms/org.drools.guvnor.Guvnor/package/withcep/LATEST'] [2009:10:299 18:10:952:debug] ResourceChangeScanner attempt to scan 1 resources [2009:10:299 18:10:338:exception] 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) at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:109) at org.jboss.qa.guvnor.agent.JBRULES2278CEP.main(JBRULES2278CEP.java:76) Caused by: java.lang.NullPointerException at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1820) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348) at org.drools.rule.DialectRuntimeRegistry.readExternal(DialectRuntimeRegistry.java:41) at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348) at org.drools.rule.Package.readExternal(Package.java:197) at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348) at org.drools.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:189) at org.drools.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:158) at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:408) ... 3 more [2009:10:299 18:10:344:info] KnowledgeAgent new KnowledgeBase now built and in use
might be related
Link: Added: This issue is related to JBRULES-2278
#1 might go away if I use an uploaded model jar instead of a declared fact model, since now I end up with two 'declare' statements: declare TestModel @role(event) @timestamp(event_date) @expires(5m) end declare TestModel id: Integer event_date: java.util.Date test: String end Will verify that...
#1 goes away when I use a model jar. The package source contains only one 'declare' statement then. When I want to use a declarative model I end up with two 'declare' statements which is bad. #2 is a bug, on the agent side I guess? I attach a repo zip to make it easier to reproduce. It shows up when I use temporal constraints like 'this after [0s,1m] $t1'. No issues with entry-points found.
Attachment: Added: repository_export.zip Attachment: Added: CEP.java
Release Notes Text: Added: test
Release Notes Text: Removed: test
Release Notes Docs Status: Added: Not Yet Documented Writer: Added: dlesage
This is not a blocker for BRMS 5.1.0, moving to future.
QE should retest with 5.3 - if the bug is still present we should open a linked GUVNOR bug.
I checked for the core cause of this bug and found out that the problem is missing domain on classpath. When you import you facts to Guvnor as a jar they are not included into resulting package. Therefore when trying to access the rules in Guvnor you have to have the necessary jar (or .class files) on classpath. This gives us two options: - document that when you import model as a jar you have to add it to the classpath of final application, - try adding jars to the package and somehow add them to the classpath in runtime. I haven't tested with Drools 5.3, but both BRMS-5.1.0.GA and BRMS-5.2.0.ER3 behave the same way.
#1 looks like a Guvnor problem. It should not be generating 2 incompatible declare statements. The engine merges compatible declare statements properly, but when it sees 2 declares for the same object type, one referencing a model in the classpath and the other generating a bean with fields, one declaring the type as an event and the other as a regular fact, it can't merge them automatically because the runtime semantics of them are completely different. #2 works as designed. If the user has the domain model in a jar, it is his responsibility to deploy that jar into the runtime environment. We can't ship it with the package as we risk classpath clashes. This should be just documented as so, as suggested by Tomas. Can someone in the Guvnor team take this over to fix #1, plz?
(In reply to comment #12) > #1 looks like a Guvnor problem. It should not be generating 2 incompatible > declare statements. The engine merges compatible declare statements properly, > but when it sees 2 declares for the same object type, one referencing a model > in the classpath and the other generating a bean with fields, one declaring the > type as an event and the other as a regular fact, it can't merge them > automatically because the runtime semantics of them are completely different. > Can someone in the Guvnor team take this over to fix #1, plz? Jervis, would someone from the Guvnor team please take a look at this? Thanks!
Michael, can you or someone from Guvnor take a look at this one, please? Thank you.
Created attachment 573789 [details] Class demonstrating the problem
Created attachment 573790 [details] Binary package
This is a problem deserializing packages. Attachment CEP2.java and withcep.pkg are files that replicate the problem without needing Guvnor. There is a specific set of requirements for the deserialization to fail:- (1) KnowledgeBuilderFactory.newKnowledgeBuilder() must not have been called in the JVM otherwise the test passes. (2) A KnowledgeBaseConfiguration containing the option EventProcessingOption.STREAM has to be provided otherwise the test passes. Edson, I could not add a new test to CepEspTest or a new class entirely as all of these tests call KnowledgeBuilderFactory.newKnowledgeBuilder() that causes the Operator.CACHE to be populated correctly by EvaluatorRegistry and hence the problem not to occur. The class CEP2 contains more information as to what the problem is.
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: Using temporal constraints with the knowledge agent results in a java.lang.RuntimeException due to a missing domain on the class path. This happens when the facts are imported as a jar file, and the workaround is to copy the jar file to the classpath of the final application.
I "fixed" this problem by making sure the evaluator registry is populated during package deserialization. This fix is specific to 5.3.x version as in versions 5.4.x and newer, the KnowledgeAgent uses the proper API for deserialization. Thanks for all the information on this bug and specially to Michael for the detailed analysis on the causes for this problem.
Verified in BRMS-5.3.1-ER1