Someone mentioned me the problem some time ago. I have a fix for it in my local repo, butI was waiting for the trunk to be stable to test it. 
The problem is that under certain circumstances, the kagent is reusing the same kbuilder to compile all the resources present in a change-set (the modifications I have force the agent to use a new kbuilder for each resource). 
The only difference between what you are reporting and the problem I'm talking about is that in my case all the rules, functions, etc were added to the kbase, but all within the same package. No matter the real package definition. Is this your case also?

Please file a bug report and let me know.

Best Regards,

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


2011/3/21 Steven Williams <stevearoonie@gmail.com>
Hi all,

I am trying to use a Knowledge Agent in 5.1.1 with a change set with a few different packages and resource types in it, and I am running into a problem where it is not adding all the packages. Looking at the code I can see that KnowledegeAgentImpl.createPackageFromResource has the following code when it loads a resource:

            if (kbuilder.getKnowledgePackages().iterator().hasNext()) {

                return (KnowledgePackageImp) kbuilder.getKnowledgePackages().iterator().next();

            }


and KnowledgeBuilderImpl.getKnowledgePackages does the following:


Package[] pkgs = pkgBuilder.getPackages();

List<KnowledgePackage> list = new ArrayList<KnowledgePackage>( pkgs.length ); 


and PackageBuilder.getPackages does the following:


        for ( PackageRegistry pkgRegistry : this.pkgRegistryMap.values() ) {

            Package pkg = pkgRegistry.getPackage();

            // add package to array

        }


pkgRegistryMap is implemented as a HashMap however so the order the packages are returned in is not guaranteed. I seem to be hitting this problem. 

This is a hard one to create a unit test for so I wanted to check that my analysis is correct before raising a bug. Perhaps using a LinkedHashMap or similar would fix it?

thanks
Steve

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