cancel
Showing results for 
Search instead for 
Did you mean: 

Deploy new .bar-File from running process

krigu
Champ in-the-making
Champ in-the-making
We've built a process that allows administrators to deploy their .bar-files. However, the process and the code below worked fine with the Actviti 5.10. Now we upgraded to 5.14 and it seems like the process doesn't get deployed any more.

The code is (a bit simplyfied):

public class DeployProcessUtil implements JavaDelegate {

   @Override
   public void execute(DelegateExecution execution) throws Exception {

      RepositoryService repo = ActivitiUtil.getRepositoryService();
      DeploymentBuilder deploymentBuilder = repo.createDeployment();

      try {
                        // getBarFile() loads the .bar-file as byte[]
         deploymentBuilder.addZipInputStream(new ZipInputStream(new ByteArrayInputStream(getBarFile()));
      } catch (Exception e) {
         throw new RuntimeException(e.getMessage());
      }

      org.activiti.engine.repository.Deployment deployment = deploymentBuilder.deploy();

                // There is only one deployed process, but there should be two
      System.out.println("Process: " + ActivitiUtil.getRepositoryService().createProcessDefinitionQuery().list());

   }
}


After the call of the deploy()-method, there is still only one process available instead of two. The above code works fine in a standalone JUnit-Testcase and worked before Activiti 5.11, so I guess the .bar-File should be ok.

So are there any suggestions what could case this problem or how to solve it?

Thanks
Krigu
7 REPLIES 7

felipe1
Champ in-the-making
Champ in-the-making
Have you tried using the same RepositoryService object both to deploy and query?

System.out.println("Process: " + repo.createProcessDefinitionQuery().list());

krigu
Champ in-the-making
Champ in-the-making
Thanks for your response.

I tried your suggestion, but still no luck.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Krigu.
Is there any exception in logs?

krigu
Champ in-the-making
Champ in-the-making
Thanks for your response Martin.


The Logs for the above code are:
<code>
15:51:46,998        DEBUG LogInterceptor:33 -                                                                                                    
15:51:46,998        DEBUG LogInterceptor:34 - — starting DeployCmd ——————————————————–
15:51:46,998        DEBUG CommandContextInterceptor:48 - Valid context found. Reusing it for the current command 'org.activiti.engine.impl.cmd.DeployCmd'
15:51:46,999        DEBUG BpmnDeployer:68 - Processing deployment null
15:51:46,999         INFO BpmnDeployer:75 - Processing resource MyProcess.bpmn20.xml
15:51:47,037        DEBUG ProcessParseHandler:77 - Parsing process Deployment
15:51:47,038        DEBUG AbstractBpmnParseHandler:94 - Parsing activity deployProcess
15:51:47,038        DEBUG AbstractBpmnParseHandler:94 - Parsing activity rechte
15:51:47,038        DEBUG AbstractBpmnParseHandler:94 - Parsing activity saveDeployment
15:51:47,039        DEBUG AbstractBpmnParseHandler:94 - Parsing activity StartDeployment
15:51:47,039        DEBUG AbstractBpmnParseHandler:94 - Parsing activity endevent1
15:51:47,064         INFO BpmnDeployer:75 - Processing resource form/UploadForm.form
15:51:47,064         INFO BpmnDeployer:75 - Processing resource form/Start.form
15:51:47,064         INFO BpmnDeployer:75 - Processing resource form/Rechte.form
15:51:47,064        DEBUG selectLatestProcessDefinitionByKey:132 - ooo Using Connection [conn2: url=jdbc:h2:mem:test_db user=SA]
15:51:47,065        DEBUG selectLatestProcessDefinitionByKey:132 - ==>  Preparing: select * from ACT_RE_PROCDEF where KEY_ = ? and VERSION_ = (select max(VERSION_) from ACT_RE_PROCDEF where KEY_ = ?)
15:51:47,065        DEBUG selectLatestProcessDefinitionByKey:132 - ==> Parameters: Deployment(String), Deployment(String)
15:51:47,066        TRACE selectLatestProcessDefinitionByKey:138 - <==    Columns: ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_, HAS_START_FORM_KEY_, SUSPENSION_STATE_
15:51:47,066        TRACE selectLatestProcessDefinitionByKey:138 - <==        Row: Deployment:1:34, 1, http://www.company.ch/, Deployment - Prozesse verwalten, Deployment, 1, 28, diagrams/MyProcess.bpmn, diagrams/MyProcess.Deployment.png, null, TRUE, 1
15:51:47,066        DEBUG selectJobsByConfiguration:132 - ooo Using Connection [conn2: url=jdbc:h2:mem:test_db user=SA]
15:51:47,067        DEBUG selectJobsByConfiguration:132 - ==>  Preparing: select * from ACT_RU_JOB where HANDLER_TYPE_ = ? and HANDLER_CFG_ = ?
15:51:47,067        DEBUG selectJobsByConfiguration:132 - ==> Parameters: timer-start-event(String), Deployment(String)
15:51:47,067        DEBUG selectEventSubscriptionsByConfiguration:132 - ooo Using Connection [conn2: url=jdbc:h2:mem:test_db user=SA]
15:51:47,068        DEBUG selectEventSubscriptionsByConfiguration:132 - ==>  Preparing: select * from ACT_RU_EVENT_SUBSCR where (EVENT_TYPE_ = ?) and (CONFIGURATION_ = ?)
15:51:47,068        DEBUG selectEventSubscriptionsByConfiguration:132 - ==> Parameters: message(String), Deployment:1:34(String)
15:51:47,068        DEBUG LogInterceptor:40 - — DeployCmd finished ——————————————————–
15:51:47,068        DEBUG LogInterceptor:41 -                                                                                                    
/Deploy!
15:51:47,069        DEBUG HistoryManager:71 - Current history level: AUDIT, level required: ACTIVITY
15:51:47,069        DEBUG HistoryManager:71 - Current history level: AUDIT, level required: FULL
15:51:47,069        DEBUG LogInterceptor:33 -                                                                                                    
15:51:47,069        DEBUG LogInterceptor:34 - — starting ProcessDefinitionQueryImpl ——————————————————–
15:51:47,069        DEBUG CommandContextInterceptor:48 - Valid context found. Reusing it for the current command 'org.activiti.engine.impl.ProcessDefinitionQueryImpl'
15:51:47,070        DEBUG selectProcessDefinitionsByQueryCriteria:132 - ooo Using Connection [conn2: url=jdbc:h2:mem:test_db user=SA]
15:51:47,070        DEBUG selectProcessDefinitionsByQueryCriteria:132 - ==>  Preparing: select RES.* from ACT_RE_PROCDEF RES order by RES.ID_ asc LIMIT ? OFFSET ?
15:51:47,071        DEBUG selectProcessDefinitionsByQueryCriteria:132 - ==> Parameters: 2147483647(Integer), 0(Integer)
15:51:47,071        TRACE selectProcessDefinitionsByQueryCriteria:138 - <==    Columns: ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_, HAS_START_FORM_KEY_, SUSPENSION_STATE_
15:51:47,071        TRACE selectProcessDefinitionsByQueryCriteria:138 - <==        Row: Deployment:1:34, 1, http://www.company.ch/, Deployment - Prozesse verwalten, Deployment, 1, 28, diagrams/MyProcess.bpmn, diagrams/MyProcess.Deployment.png, null, TRUE, 1
15:51:47,072        DEBUG LogInterceptor:40 - — ProcessDefinitionQueryImpl finished ——————————————————–
15:51:47,072        DEBUG LogInterceptor:41 -      
</code>

trademak
Star Contributor
Star Contributor
Can you add the process definitions that you are deployment. Could it be that there is an attribute isExecutable="false" in there?

Best regards,

krigu
Champ in-the-making
Champ in-the-making
After further looking into the log-files it seems that the .bar-File gets deployed properly. To problem seems to be that the Activiti-Engine executes the flush after the script task is finished. Is there a way to force a flush manually and is that good idea?

As a short term workaround I changed the process  so there is a usertask between the deploy()-call and the processdefinitionquery.

trademak
Star Contributor
Star Contributor
When you make the task async it gets flushed to the database.

Best regards,