[rules-users] unable to update the changes (guvnor rules) to application using changeset

Voradov madalin100884 at yahoo.com
Wed Jan 25 08:06:40 EST 2012


Hi, exactly, this is the issue:
I have a remote Guvnor server, not a local one and I had tried to set up a changeset.xml with PKG type links to the remote contained packages, in order to load in a local running agent those packages.

But it was not enough.
When loading the packages, it does not know to load also the jar files, so because of this, somehow the jars should be added in the classpath. At this moment i ended by filling the classpath of my local running eclipse with all the local jars in order to create a running knowledge agent.

I can use REST protocol to get all packages, and from there to obtain the URL of the contained jars from each package and to programmatically download locally the jars in a folder and after that, for each of them to do something like this 

URL jarURL = this.getClass().getResource(SomeExternalJar.jar);
URLClassLoader ucl = new URLClassLoader(new URL[]{jarURL}, this.getClass().getClassLoader());

But my question is if I cannot somehow avoid this and make it easier. 

So, the main question is: when having a remote guvnor having set packages with rules and fact models, how can I create a local knowledge agent and to fill it with some required fact models and rules from that remote guvnor server? 

At the first glace, I had expected when filling the knowledge agent with a remote package, along with the test cases and rules, also the jar files to be loaded, but it seems not.

At this moment I cannot see any other option, than this one. I had read the entyre documentation, but i did not find something like this explained. Could you help me?  Do you have an idea about how to do this more easier than presented above?

Madalin Gavrilescu


--- On Wed, 1/25/12, manstis [via Drools] <ml-node+s46999n3687590h73 at n3.nabble.com> wrote:

From: manstis [via Drools] <ml-node+s46999n3687590h73 at n3.nabble.com>
Subject: Re: [rules-users] unable to update the changes (guvnor rules) to application using changeset
To: "Voradov" <madalin100884 at yahoo.com>
Date: Wednesday, January 25, 2012, 2:48 PM



	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 <[hidden email]> 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

[hidden email]

https://lists.jboss.org/mailman/listinfo/rules-users




_______________________________________________

rules-users mailing list

[hidden email]

https://lists.jboss.org/mailman/listinfo/rules-users

	
	

	

	
	
		If you reply to this email, your message will be added to the discussion below:
		http://drools.46999.n3.nabble.com/unable-to-update-the-changes-guvnor-rules-to-application-using-changeset-tp3652824p3687590.html
	
	
		
		To unsubscribe from unable to update the changes (guvnor rules) to application using changeset, click here.

		NAML
	

--
View this message in context: http://drools.46999.n3.nabble.com/unable-to-update-the-changes-guvnor-rules-to-application-using-changeset-tp3652824p3687625.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120125/525205da/attachment.html 


More information about the rules-users mailing list