Created attachment 519083 [details] BrmsClient.java Description of problem: From some reason, after applying a URL Resource ChangeSet, KnowledgeAgent starts to map 'null' ReaderResources. > ka.applyChangeSet(ResourceFactory.newUrlResource(url)); > [2011-08-19 19:33:40,219:debug] KnowledgeAgent mapping resource=[UrlResource path='http://localhost:8080/jboss-brms/org.drools.guvnor.Guvnor/package/mortgages/LATEST'] to KnowledgeDefinition=[Rule name=RegexDslRule, agendaGroup=MAIN, salience=0, no-loop=false] > [2011-08-19 19:33:40,219:debug] KnowledgeAgent mapping resource=[ReaderResource resource=null encoding='null'] to KnowledgeDefinition=org.drools.rule.TypeDeclaration@4cc5aa00 Any subsequent applyChangeset() causes this exception: > Exception in thread "main" java.lang.RuntimeException: Unknown resource type: null > at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:638) > at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28) > at org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:712) > at org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:1002) > at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:785) > at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:657) > at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:190) > at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:169) Version-Release number of selected component (if applicable): This bug has been introduced somewhere between ER1 and ER2 releases. Possible workaround: set drools.agent.newInstance=false How reproducible: always Steps to Reproduce: see attached sample client code Actual results: After applying URL Resource ChangeSet, KnowledgeAgent maps 'null' ReaderResources. This causes NPE when KA attempts to build a new KB forced by a subsequent applyChangeSet() call (now with any Resource type). Expected results: After applying URL Resource ChangeSet, it should be possible to apply other ChangeSets without causing an exception, while 'drools.agent.newInstance' is set to 'true' (which is default) Additional info: See attachments for a sample client code and it's output including the exception call stack.
Created attachment 519085 [details] output.log
> [2011-08-19 19:33:40,219:debug] KnowledgeAgent mapping resource=[ReaderResource resource=null encoding='null'] to KnowledgeDefinition=org.drools.rule.TypeDeclaration@4cc5aa00 Ok, now that I can see this line in a better light, I'm thinking it might not be related to the URL Resource, but probably to the content of the rules package (type declarations). Might be related to https://issues.jboss.org/browse/JBRULES-2962?
Is this is a duplicate of these? https://bugzilla.redhat.com/show_bug.cgi?id=741219 https://bugzilla.redhat.com/show_bug.cgi?id=741287 https://bugzilla.redhat.com/show_bug.cgi?id=751319 https://bugzilla.redhat.com/show_bug.cgi?id=751326
(In reply to comment #4) > Is this is a duplicate of these? I wouldn't say it's a duplicate - maybe just a dependency. Once this bug is fixed, we'll have to verify that the other functionality (XLS, CSV...) works as well.
Edson Tirelli <ed.tirelli> updated the status of jira JBRULES-3282 to Closed
After fixing the related tickets, I created a test case for this, but was unable to reproduce the problem. My understanding is that previous fixes also fixed this ticket. The test case was committed to both to 5.3.x branch and master (5.4.Beta2) branch: https://github.com/droolsjbpm/drools/commit/6b24680265bb565e80bf7efa3d4c6bb7c5b793db https://github.com/droolsjbpm/drools/commit/99bad018b97a417b63dbd13372f8d920b1912021 If you still see any problem, please modify the test case to raise the issue and send a pull request. Thank you.
Edson Tirelli <ed.tirelli> updated the status of jira JBRULES-3358 to Resolved
Edson Tirelli <ed.tirelli> updated the status of jira JBRULES-3358 to Closed
Please verify the issue on 5.3 ER4.
Not fixed in BRMS 5.3 ER4. I was able to reproduce this issue with the case above provided by Jiri Locker. I have looked at your own test cases, but they work just with PKG files on disk. This one requires running Guvnor (corresponding version) with created and builded sample 'mortgages' package. How to reproduce: 1. Download BRMS 5.3 ER4 engine binaries and Guvnor from 5.3 ER4 (the same versions are necessary for package serialization compatibility). You can try also your master version (Guvnor and engine have to be compatible), but I cannot guarantee success of seeing the error. 2. Enable (uncomment) user admin in jboss-as/server/default/conf/props/brms-users.properties 3. Start web server with Guvnor. 4. Login and confirm creation of sample packages. 5. Go to mortgages package and build it. 6. Run attached java class above. First time knowledge agent will load mortgages package correctly. Second try will fail with an exception. I have not tried this with PKG files on disk, but just with real running Guvnor and it fails. This is not duplicate issue of https://bugzilla.redhat.com/show_bug.cgi?id=733008. As described above this should not be difficult to reproduce. If you require adding to your test suite, then tell me where to put tests which require running Guvnor.
And one last thing - your test case for PKG file uses scanning service. So use the java class BrmsClient added by Jiri Locker which doesn't use scanning service. It's possible that you've tested different scenario.
I have found an error in test case above. Method kagent.applyChangeset() is used twice, before each kagent.getKnowledgeBase(). I have tried to modify test case to use kagent.applyChangeset() just once in the start and then kagent.getKnowledgeBase() twice. It works this way. But test case throws quite misleading exception, so I think that user should be notified, that he already has changeset registered and that it's not necessary to apply it again. Otherwise he may be easily confused.
Sure, I admit that applying the same change set more than once does not make much sense. But if that happens, kagent probably shouldn't crash like this > Exception in thread "main" java.lang.RuntimeException: Unknown resource type: null I can think of two possible solutions: 1) throw IllegalStateException explaining that applying the same change set more than once is illegal 2) ignore the attempt and just log a warning message I would prefer solution #2.
I am building an arquillian test to reproduce this under org.drools.guvnor.server.files.PackageDeploymentServletIntegrationTest#testScenariosAndChangeSet
Master and 5.4 are being blocked by another, earlier issue: https://issues.jboss.org/browse/JBRULES-3457
The NPE is caused because an old and deep HACK in KnowledgeAgentImpl.autoBuildResourceMapping() which adds null Resources and the KnowledgeAgentImpl#rebuildResources method cannot cope with that. I am not convinced that the NPE wouldn't occur too if we added different resources (that needs to be tested). The hack was added for JBRULES-2082. Removing the hack didn't work reliably, so I had no choice to add a workaround in KnowledgeAgentImpl#rebuildResources to cope with the hack: https://github.com/droolsjbpm/drools/commit/3a197f70f664b4d984b4e595b125315ab7761bbc Applied on master, 5.4 and 5.3.
Update status to ON_QA. Please verify them against ER6.
Verified in BRMS 5.3.0 ER6.
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: An error occurred where the KnowledgeAgent could not build the KnowledgeBase after applying a URL resource changeset and throws RuntimeException. This was caused by fixes to previous issues and was resolved by creating an implementation class (ReaderResource) to bypass the previous fixes.
Hi Geoffrey, Could you take a look at the release note for this one and let me know if anything needs to be changed. Thanks Lee
This issue is out of date.