0

I have referred few questions in stackoverflow on integrating drools app with guvnor and still not clear on this. I have standalone drools application, the rules in DRL file uses custom java classes that are part of my application. For Guvnor integration, I have uploaded the DRL file under appropriate package and uploaded required class files as an individual model JAR. I use knowledgeAgent in standalone application and changeset xml pointing to package URL which guvnor exposes as suggested in this post and below exception is thrown

java.lang.RuntimeException: KnowledgeAgent exception while trying to deserialize KnowledgeDefinitionsPackage
at org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:796) at org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:1103) at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:844) at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:684) at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:207) at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:186) Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost.com/guvnor-5.5.0.Final-tomcat-6.0/org.drools.guvnor.Guvnor/package/com/LATEST at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at org.drools.io.impl.UrlResource.grabStream(UrlResource.java:210) at org.drools.io.impl.UrlResource.getInputStream(UrlResource.java:146) at org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:759) ... 8 more

Can someone help me with step by step activities involved in integrating Drools application with Guvnor?

Thanks in advance!

Community
  • 1
  • 1
vaish
  • 5
  • 8
  • Couple of questions. Have you built your package successfully? What do you see if you go to the following in your web browser? http://localhost.com/guvnor-5.5.0.Final-tomcat-6.0/org.drools.guvnor.Guvnor/package/com/LATEST – Steve Oct 30 '14 at 15:42
  • @Steve There were issues while building the package in guvnor and I removed all unwanted code in DRL and now the package is built successfully. When executing the standalone application pointing to http://localhost:8080/guvnor-5.5.0.Final-tomcat-6.0/rest/packages/com.myfirstapp/source, the application runs fine and it does nothing on my custom objects. – vaish Oct 31 '14 at 07:08
  • Sounds like a good start. If you need help with the app doing nothing, you'll need to show code inserting facts and the DRL. You may find some of the following to be useful tools: https://github.com/gratiartis/sctrcd-payment-validation-web/blob/master/src/main/java/com/sctrcd/drools/util/TrackingAgendaEventListener.java and https://github.com/gratiartis/sctrcd-payment-validation-web/blob/master/src/main/java/com/sctrcd/drools/util/TrackingWorkingMemoryEventListener.java ... which can be handy for logging what is in working memory and your rule activations. – Steve Oct 31 '14 at 08:46
  • @Steve I have already enabled the log using the code : KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession); and it tracks the execution details. I see only 2 activities are getting executed "OBJECT ASSERTED" & "ACTIVATION CREATED" for all my rules. I badly need to understand how it works.. The DRL in guvnor will refer to java objects uploaded in guvnor. From standalone application if i point to guvnor DRL and run application, how will the pojo attributes will get updated in standalone program after the rules get executed (basically 2 diff JVM right)? – vaish Oct 31 '14 at 10:47
  • Sounds like the basics are working. 'object asserted' means that a fact has been inserted into the session. 'activation created' means that one of your rules fired. All the Java objects are local to your application (one JVM! They don't exist in Guvnor - Guvnor just needs them to be able to compile rules), so you can just modify their properties directly. Similarly, you can invoke static methods. – Steve Oct 31 '14 at 13:30
  • @Steve Thanks for the explanation. I insert the custom pojo objects into knowledge session through standalone application. After the insertion i m invoking fireAllrules() method and printing the pojo's. I see the custom objects are not getting updated by the rules available in guvnor. Please help me in resolving this issue. – vaish Nov 03 '14 at 08:47
  • It sounds like there are bugs in your DRL if your rules are not firing as expected. Create a new question, showing code for how you insert and fire your rules and showing the DRL for those rules. – Steve Nov 03 '14 at 09:49
  • @Steve I figured out the issue. I have defined ruleflow-group for each rule specified process flow diagram. But I failed to change jBPM xml configuration which requires the subdomain of guvnor i use. Thanks for your support. In case of any more issues, I will raise new question :) – vaish Nov 04 '14 at 07:45

0 Answers0