5 Replies Latest reply on Aug 28, 2009 4:31 AM by Ronald van Kuijk

    DeploymentAdaptor: duplicated process deployment since commi

    Marko Friedemann Newbie


      I've found a problem with the JBoss deployment code in jBPM4.
      It has been introduced in commit 4753 which added forms support via freemarker .ftl template files.

      A change was made in the DeploymentAdaptor's deploy() method to add all resources from the given zip input stream (instead of just the specified process descriptor .jpdl.xml given in the DeploymentMetaData).

      Index: DeploymentAdaptor.java
      --- DeploymentAdaptor.java (revision 4752)
      +++ DeploymentAdaptor.java (revision 4753)
      @@ -23,6 +23,7 @@
       import java.io.File;
       import java.util.List;
      +import java.util.zip.ZipInputStream;
       import javax.naming.InitialContext;
       import javax.transaction.SystemException;
      @@ -59,7 +60,8 @@
       File deploymentFile = new File(deploymentName);
       long deploymentDbid = repositoryService.createDeployment()
      - .addResourceFromUrl(deploymentMetData.getProcessDescriptor())
      + .addResourcesFromZipInputStream(new ZipInputStream(deploymentMetData.getWatch().openStream()))
      + //.addResourceFromUrl(deploymentMetData.getProcessDescriptor())

      This was apparently done to add the .ftl templates to the deployment but has the (IMHO unintended) consequence of also adding ALL processes from the archive.

      In combination with the way the .bar is deployed in JBoss, this results in multiple deployments (DeploymentAdaptor called n times for n process descriptors in the .bar) each including all the processes (ie: a .bar with 4 .jpdl.xml files will result in 4 deployments each including all 4 processes).

      Also, I found the deployer to not really consider the timestamp of the .bar. When starting/stopping the server, it will undeploy the processes (which suspends them as indicated in jira issue JBPM-2242) but instead of reactivating them it will redeploy them which then results in another n deployments.

      I know, two issues in one post, but they are kind of related.