What is it you are trying to achieve?

If the change set contains DRL items the Classes used therein will need to be on your client-side classpath (as explained in Esteban's blog). If you want to use rules authored in Guvnor and Types declared in (or uploaded to) Guvnor you should use the PKG resource type in your change-set and build the package in Guvnor. I don't believe you should need to use a custom class loader *unless* you really want only the DRL in your change-set but your model classes only in Guvnor.

On 25 January 2012 12:27, Voradov <madalin100884@yahoo.com> wrote:
Hi, Esteban, Hi srinivasasanda.

My opinion regarding the issue posted by srinivasasanda is the following:

Having the changeset filled with DRL's taken from local jBoss application
and using it in a java local running knowledge agent which has not added
into the classpath the fact models will fail, of course with that
/"java.lang.RuntimeException: KnowledgeAgent exception while trying to
deserialize KnowledgeDefinitionsPackage"./

On the other hand, when having changeset.xml set as:
/<add>
       <resource source='file:D:\rulemaster.drl' type='DRL' />
  </add>/
is working because it seems that the fact models used in defining those
packages are in the classpath.

REST protocol is used correctly in the changeset.xml.

The problem with remotely loading pkg\drl files using REST is that you
should somehow specify a custom classloader, like this:

/KnowledgeBaseConfiguration kbaseConfig =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration(null,
*customClassLoader*);
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(kbaseConfig);
//kbase with custom classloader
KnowledgeAgentConfiguration aconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
aconf.setProperty("drools.agent.useKBaseClassLoaderForCompiling", "true");
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("test
agent", kbase, aconf);
 kagent.applyChangeSet(ResourceFactory.newFileResource(changeSetFile));/

My question is: is there any possibility to create the classloader identical
to the remote classloader used by guvnor? if yes, could you please show us
exactly how to load remotelly from guvnor?

Here, at
http://ilesteban.wordpress.com/2010/06/22/knowledge-agent-custom-class-loaders/
http://ilesteban.wordpress.com/2010/06/22/knowledge-agent-custom-class-loaders/
there is described how to create a custom classloader, but it is not
specified how to create it based on the Guvnor's jar files already existing
there.


--
View this message in context: http://drools.46999.n3.nabble.com/unable-to-update-the-changes-guvnor-rules-to-application-using-changeset-tp3652824p3687543.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