[
https://issues.jboss.org/browse/DROOLS-1158?page=com.atlassian.jira.plugi...
]
Matteo Mortari commented on DROOLS-1158:
----------------------------------------
[~tutoumeiqian] , let me first advise generally that, commenting without tagging on a
closed ticket, especially if the ticket was closed more than 2 years ago, might
pass-unnoticed involuntary. It is always best to open a new ticket, submit the new
reproducer, and eventually linking the 2 tickets together. Hope this is a helpful general
advice.
Concerning to your last comment, as you can noticed in history
https://issues.jboss.org/browse/DROOLS-1158?focusedCommentId=13266960&...
the original submission was a wrong usage of API.
Just by the look of the snippet of code you provided, it could happen first you upload DRL
content for package A which defines Rules and declare Pojo. Then it could happen you
upload DRL content for package B which defines Rules which uses Pojo from package A. Then
you "undeploy" rules of package A. Then you upload DRL content for package B
slightly modified, it would cause again a misuse of API (package B recompilation missing
reference package A).. Without a reproducer is difficult to say, but is a plausible
scenario, of a wrong usage.
The *best suggestion I can provide, is to use KJAR, and KieScanner* instead of the
approach used in the code snippet you linked, and as commented in this ticket history. You
can read more about KJAR and KieScanner in the Drools documentation. This ensures a
consistent and versioned approach at compile time, rather than relying of uncontrolled
upload of DRL file content at runtime.
If you still believe your use-case exhibit a problem with usage of public API and a valid
one, I invite you to open a new JIRA, submit a reproducer (hence not only the snippet of
code but also the different DRLs uploaded and a reproducer code which will invoke the
method in the expected order) and eventually link to this old ticket.
I hope this helps!
NullpointerException when trying to reuse KnowledgePackage into a new
KnowledgeBase
-----------------------------------------------------------------------------------
Key: DROOLS-1158
URL:
https://issues.jboss.org/browse/DROOLS-1158
Project: Drools
Issue Type: Bug
Affects Versions: 6.3.0.Final, 6.4.0.Final
Reporter: Juan Carlos Garcia
Assignee: Matteo Mortari
Attachments: drools-reusepackage.tar, screenshot-1.png
Having a set of DecisionTables which KnowledgePackages are cached in our application,
after we detect a change in any of those XLS files, we build a KnowledgePackages from it,
and then try to create a new KnowledgeBase with the new KnowledgePackages + the rest of
the cached one that that were not modified, but it fails with a NPE internally in Drools
(6.3.0 and 6.4.0)
This is not a problem for the drools version (6.0.1.Final) that we currently uses using
in production.
After debugging and putting a breakpoint into the *MvelConstraint.java:619*, it shows
that it is trying to look for a packageName which hasn't being loaded yet in the new
kbase (but belong to others XLS).
I have attached a project with a testcase that shows the problem, it has 2 DecisionTable
which i had to cut down a little bit (from our real files) and removes some sensitive
information (replacing some of text with FOO-BAR).
{code}
java.lang.NullPointerException
at
org.drools.core.rule.constraint.MvelConstraint.equals(MvelConstraint.java:619)
at org.drools.core.reteoo.AlphaNode.internalEquals(AlphaNode.java:199)
at org.drools.core.common.BaseNode.thisNodeEquals(BaseNode.java:194)
at
org.drools.core.reteoo.CompositeObjectSinkAdapter.getMatchingNode(CompositeObjectSinkAdapter.java:531)
at org.drools.core.reteoo.builder.BuildUtils.attachNode(BuildUtils.java:121)
at
org.drools.core.reteoo.builder.PatternBuilder.buildAlphaNodeChain(PatternBuilder.java:332)
at
org.drools.core.reteoo.builder.PatternBuilder.attachAlphaNodes(PatternBuilder.java:313)
at
org.drools.core.reteoo.builder.PatternBuilder.attachPattern(PatternBuilder.java:130)
at org.drools.core.reteoo.builder.PatternBuilder.build(PatternBuilder.java:78)
at
org.drools.core.reteoo.builder.GroupElementBuilder$AndBuilder.build(GroupElementBuilder.java:108)
at
org.drools.core.reteoo.builder.GroupElementBuilder.build(GroupElementBuilder.java:68)
at
org.drools.core.reteoo.builder.ReteooRuleBuilder.addSubRule(ReteooRuleBuilder.java:161)
at
org.drools.core.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder.java:133)
at org.drools.core.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:106)
at org.drools.core.impl.KnowledgeBaseImpl.addRule(KnowledgeBaseImpl.java:1567)
at org.drools.core.impl.KnowledgeBaseImpl.addRule(KnowledgeBaseImpl.java:1547)
at
org.drools.core.impl.KnowledgeBaseImpl.internalAddPackages(KnowledgeBaseImpl.java:920)
at org.drools.core.impl.KnowledgeBaseImpl.access$000(KnowledgeBaseImpl.java:117)
at org.drools.core.impl.KnowledgeBaseImpl$1.run(KnowledgeBaseImpl.java:708)
at
org.drools.core.impl.KnowledgeBaseImpl.enqueueModification(KnowledgeBaseImpl.java:716)
at
org.drools.core.impl.KnowledgeBaseImpl.addPackages(KnowledgeBaseImpl.java:705)
at
org.drools.core.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:273)
at
org.drools.impl.adapters.KnowledgeBaseAdapter.addKnowledgePackages(KnowledgeBaseAdapter.java:62)
at
bug.demo.BugReloadableDecisionTableTest.addRuleSetToKnowledgeBase(BugReloadableDecisionTableTest.java:63)
at
bug.demo.BugReloadableDecisionTableTest.testReuseKnowledgePackage(BugReloadableDecisionTableTest.java:53)
{code}
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)