3 Replies Latest reply on Oct 17, 2013 1:23 AM by kawest173713

    How to configure jbpm-console to automatically pick up changed packages in Guvnor?

    kawest173713

      I had asked a number of questions in a separate discussion topic (Delayed/Slow Loading of Processes in jbpm-console), but wanted to pull one of those questions which went unanswered into its own discussion as its a real showstopper for us if not resolved.

       

      In the jbpm user guide, there is a bullet that states the following:

       

      • Currently, the console will load the process definitions the first time the list of processes is requested in the console. At this point, automatic updating from Guvnor when the package is rebuilt is turned off by default, so you will have to either configure this or restart the application server to get the latest versions.

       

      How and where, do I configure the console to automatically pick up changes from Guvnor. Currently I have to restart the server to get those changes picked up. I can find nothing else in the jBPM user guide that addresses this.


      THX

      Keith

        • 1. Re: How to configure jbpm-console to automatically pick up changed packages in Guvnor?
          swiderski.maciej

          Keith,

           

          guvnor synchronization is enabled by default in 5.4. It uses KnowledgeAgent to perform the synchronization and rebuild internally knowledge base. Here is the code that might become useful when trying to debug it. I think that the root cause of this and slow loading of the processes is the same. Would it be possible for you to debug it and see there is the actual bottleneck that causes this delays? Especially for the first load as I believe the others are consequence of it.

           

          HTH

          • 2. Re: How to configure jbpm-console to automatically pick up changed packages in Guvnor?
            kawest173713

            Appreciate the pointer to the initial point in the code to start looking. I downloaded the DefaultKnowledgeBaseManager code, and added some println statements to it to help determine where the slow startup time is occurring. As it turns out, it spends all of its time (3 minutes and 10 seconds to be exact) in the following line of code in the buildKnowledgeAgent method:

             

            kagent.applyChangeSet(ResourceFactory.newReaderResource(guvnorUtils.createChangeSet()));

             

            I haven't had a chance to continue to dive into these classes, but at least know where its occurring. I will update this discussion with what I find out...

             

            NOTE - I have been able to determine that the code IS picking up changes to processes in guvnor. I made some changes to a simple process in the web designer from guvnor, and after building the pkg associated with the process, and then logging back into the jbpm-console, it picked up the changed process - having the extra println's showed it was executing the syncPackages method in the DefaultKnowledgeBaseManager class.

             

            THX

            Keith

            • 3. Re: How to configure jbpm-console to automatically pick up changed packages in Guvnor?
              kawest173713

              Further research on this found the following code being executed:

               

              Class                                                    Method                                  Code

              DefaultKnowledgeBaseManager         buildKnowledgeAgent     kagent.applyChangeSet(ResourceFactory.newReaderResource(guvnorUtils.createChangeSet()));

              KnowledgeAgentImpl                           getChangeSet                 changeSet = reader.read( resourceReader );

              ExtensibleXmlParser                            read                                localParser.parse(in, this);

               

              Once it hit the localParser.parse, the delay would be exactly 190 seconds every time. Doing some searching on the web for issues that cause slow SAX parsing, I ran across the following link:

               

              http://www.java-allandsundry.com/2012/04/java-and-slow-xml-parsing.html

               

              This suggested putting some code in just before the parse to ignore external references. So, I put the following code in right before the localParser.parse line as follows:

              XMLReader reader = localParser.getXMLReader();

              reader.setEntityResolver(new EntityResolver()

              {

                    public InputSource resolveEntity(String pid, String sid) throws SAXException

                 {

                         return new InputSource(new StringReader(""));

                 }

                });

               

              When i replaced the original ExtensibleXmlParser with this modified one in the drools-core jar inside of jbpm-gwt-console-server, rebuilt and restarted my JBOSS instance, logged into the jbpm-console, and selected the processes tab, and then process overview, all of my processes were displayed within a few seconds.

               

              As Maciej had alluded to in my discussion on slow loading of processes, this is related to the fact that our company doesn't allow access to the internet from applications behind our firewalls. Now seeing what the code is trying to do, is this modified code an acceptable workaround, or are there other alternatives? Waiting for over 3 minutes after startup is not an option, so hoping there might be other suggestions on how to fix this, short of this particular code.

               

              THX

              Keith