9 Replies Latest reply on Jan 25, 2013 12:01 AM by Hendra Jaya

    JBPM4.4 application deployment/startup issue in Tomcat

    Felix Jose Newbie

      Hi All,

       

      I am using JBPM4.4 in my application. We are using tomcat for deployment. I am facing a critical issue with the application startup.

       

      When we deploy and startup the application in  tomcat thousands of JBPM log messages are happening and is all about Hibernate select statements and in my understanding it is doing select against JBPM4_DEPLOMENT table, JBPM4_LOB table  etc. As our application is a huge one, it is having lakhs of records and each record there is a JBPM process associated. So the number of records in the JBPM4_DEPLOMENT table, JBPM4_LOB table etc are very high. Because of these select statements the deployment and appliaction startup is taking half an hour to complete. The application startup time is getting increased as the number of records in the JBPM tables are increasing.

       

      So my doubt is why is these Hibernate select statements are required during the application startup? Can we omit those? If yes how can we achieve that?

       

      Please send me quick answer  for this as my project is supposed to go into production by November 15th. I am waiting for your response.

       

      Thank you for you time and answer in advance.

       

       

      Thank You and regards,

      Felix K Jose.

        • 1. Re: JBPM4.4 application deployment/startup issue in Tomcat
          Michael Wohlfart Expert

          my guess is you accidently deploy the same process definition on each restart of your tomcat server, or do you really need  a "very high" number of different process definitions in JBPM4_DEPLOYMENT, JBPM4_LOB?

          • 2. Re: JBPM4.4 application deployment/startup issue in Tomcat
            Felix Jose Newbie

            Hi Michael,

             

            Thank you for your quick reply. But I didn't understand what you have mentioned with "deploy same process definition each time".

             

            Please find WorkFlow.java code Snippet:

             

             

            /**
                 * Checks whether all the properties of the WorkFlow class are set. Also it
                 * instantiate ExecutionService and RepositoryService.
                 *
                 * @throws WorkFlowException
                 *             if processEngine were not set.
                 * @throws WorkFlowRuntimeException
                 *             if process definition files do not exists.
                 */
                public void init() throws WorkFlowException, WorkFlowRuntimeException {

             

                    if (null == processEngine) {

             

                        throw new IllegalStateException("JBPM ProcessEngine not set");

             

                    }
                    // Instantiate ExecutionService object using processEngine.
                    executionService = processEngine.getExecutionService();
                    if (null == executionService) {

             

                        throw new IllegalStateException("JBPM ExecutionService not set");

             

                    }
                    System.out.println("executionService::" + executionService);
                    // Instantiate RepositoryService object using processEngine.
                    repositoryService = processEngine.getRepositoryService();
                    if (null == repositoryService) {

             

                        throw new IllegalStateException("JBPM RepositoryService not set");

             

                    }
                    System.out.println("repositoryService::" + repositoryService);

             

                    // Instantiate TaskService object using processEngine.
                    taskService = processEngine.getTaskService();
                    if (null == taskService) {

             

                        throw new IllegalStateException("JBPM HistoryService not set");

             

                    }

             

                    System.out.println("repositoryService::" + repositoryService);

             

                    if (null == iWorkFlowDao) {

             

                        throw new IllegalStateException("WorkFlowDao object not set");

             

                    }
                    if (null == iCaseDao) {

             

                        throw new IllegalStateException("ManageCaseDao object not set");

             

                    }
                    if (null == iAssistRegionDao) {

             

                        throw new IllegalStateException("iAssistRegionDao object not set");

             

                    }
                    this.deploy();

             

                }

             

            private void deploy() throws WorkFlowException, WorkFlowRuntimeException {

             

                    try {
                        // Deploying the WorkFlow process definition.
                        String ddrDeploymentId = repositoryService.createDeployment()
                                .addResourceFromClasspath("request.jpdl.xml").deploy();
                        // Checking the deployment is success.
                        if (null == ddrDeploymentId || ddrDeploymentId.equals("")) {
                            throw new WorkFlowException(
                                    "The Work flow deployment is failed");
                        }

             

                    }

             

            Description:

            This WorkFlow.java class is a spring bean class. So whenever the appliaction startup its init() method will get called and in that we are a reference to the method deploy() and in that method we are handling the

                        repositoryService.createDeployment()
                                .addResourceFromClasspath("ddr_request.jpdl.xml").deploy()

            And my doubt is if didn't deploy this how will our workflow work?

             

            So can you please tell me what I can do instead? Please help me..

             

            Thank You and regards,

            Felix K Jose

            • 3. Re: JBPM4.4 application deployment/startup issue in Tomcat
              Michael Wohlfart Expert

              Hi Felix,

               

              you don't need to deploy the process definition on each restart of your application as long as it doesn't change, deploying the process definition once is perfectly enough. The Process definition is persisted in the database and will be there after the restart, so your workflow will work fine by using the already persisted version in the database.  You can check if a precess definition is there by using

              int count = repositoryService.createProcessDefinitionQuery().processDefinitionName(processDefinitionName).list().size();
                    

              • 4. Re: JBPM4.4 application deployment/startup issue in Tomcat
                Felix Jose Newbie

                Hi Michael,

                 

                Thank you, Thank you so much. You have solved my issue it seems.

                I will let you know the tested result on Monday once I have tested this.

                 

                Once again thanks.

                 

                With Regards,

                Felix K Jose

                • 5. Re: JBPM4.4 application deployment/startup issue in Tomcat
                  Felix Jose Newbie

                  Hi Michael,

                   

                  I have tested that and is working fine.

                   

                  I have one more doubt, Currently I am not able to hot deploy my JBPM application in Tomact. What I mean by hot deployment is deploy the application without stopping the Tomcat. When I am trying to undeploy the application without stopping the Tomcat I am getting an error saying that some of the JBPM related resources are in use cannot undeploy the application. So for undeploy and deploy the application everytime we need to stop the Tomcat and start it. This wont be possible once the application moves into production environment because there in one tomcat there might be number of applications running. So stopping tomcat wont be possible. Currently what I am doing following in the code to close JBPM resources:

                  WorkFlow.java

                   

                  /**
                       * Destroys all the instances.
                       *
                       * @throws WorkFlowException
                       * @throws WorkFlowRuntimeException
                       */
                      public void destroy() throws WorkFlowException, WorkFlowRuntimeException {
                          // destroying the JBPM resources.
                          if (null != processEngine) {
                              processEngine.close();
                          }

                   

                      }

                  This destroy() method will get called when the spring context is getting destroyed that means whenever we are undeploying the application. But this  is not helping me to do a hot deployment. Can you please let me know whatelse I need to do ? What are the other possible JBPM resources I need to close?

                   

                  With Regards,

                  Felix K Jose

                  • 6. Re: JBPM4.4 application deployment/startup issue in Tomcat
                    Felix Jose Newbie

                    Hi,

                     

                    Please help me to solve this issue.

                     

                    Thank you and regards,

                    Felix K Jose

                    • 7. Re: JBPM4.4 application deployment/startup issue in Tomcat
                      Michael Wohlfart Expert

                      maybe the threads from the jobExecutor are still running?

                      • 8. Re: JBPM4.4 application deployment/startup issue in Tomcat
                        Felix Jose Newbie

                        Hi Michael,

                         

                        Thank you for your reply.

                        How can I close those jobExecutor threads? Will it affect to continue the process in future? please give me the code snippet.

                         

                        Thank you and regards,

                        Felix K Jose

                        • 9. Re: JBPM4.4 application deployment/startup issue in Tomcat
                          Hendra Jaya Newbie

                          I have a very similar issue like Felix Jose had. JBPM tables grow so fast and my application now takes more than 10 minutes to start up.

                          Unfortunately, it's now alive and I need to find a way to housekeep them.

                           

                          Basically, I want to delete all the records in JBPM4_DEPLOYMENT and (of course) its children/grandchildren/etc.

                          Are these records safe to delete? FYI, I stop my application before doing this.

                          If this operation is safe, can I have any documentation saying that they're safe to delete? Or at least a documentation saying that "they are duplicates" so that I have a strong reason to delete them.

                           

                          By the way, they are being re-populated everytime my application starts. That's why they grow..

                          I guess "I accidentally deploy the same process definition on each restart". Still, I need a formal documentation to say it.

                           

                          Thanks