0 Replies Latest reply on Feb 8, 2011 3:59 AM by Jaber C. Mourad

    Deployment error on redeploy

    Jaber C. Mourad Novice

      Hi,

       

      I'm trying to redeploy some processes definitions (jbpm4.4). the documentation is not clear about that the code is hidden by calling

       

      I'm deploying process definition like that :

       

      NewDeployment deployment = repositoryService.createDeployment();
      for (Resource resource : resources) {
          logger.debug("deploying {}", resource.getFilename());
          deployment.addResourceFromInputStream(resource.getFilename(), resource.getInputStream());
          Resource imageResource = resourceHelper.getResource(resource.getURL().toString().replace(".jpdl.xml", ".png"));
          logger.trace("image file {}", imageResource.getURL().getPath());
          if (imageResource.exists()) {
             deployment.addResourceFromInputStream(imageResource.getFilename(),
                                                      imageResource.getInputStream());
          }
      }
      try {
          String deploymentId = deployment.deploy();
          logger.info("jbpm deployement done for deployementID {}", deploymentId);
      } catch (JbpmException e) {
          logger.warn("processes not deployed", e);
      }
      

       

      It works well for the first deployment...

       

      But of next deployement, it failed with an hibernate NoUniqueResultException :

       

      org.hibernate.NonUniqueResultException: query did not return a unique result: 2
              at org.hibernate.impl.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:868)
              at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:859)
              at org.jbpm.pvm.internal.query.AbstractQuery.execute(AbstractQuery.java:93)
              at org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.execute(ProcessDefinitionQueryImpl.java:67)
              at org.jbpm.pvm.internal.query.AbstractQuery.untypedUniqueResult(AbstractQuery.java:77)
              at org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.uniqueResult(ProcessDefinitionQueryImpl.java:161)
              at org.jbpm.pvm.internal.repository.ProcessDeployer.checkId(ProcessDeployer.java:163)
              at org.jbpm.pvm.internal.repository.ProcessDeployer.deploy(ProcessDeployer.java:94)
              at org.jbpm.pvm.internal.repository.DeployerManager.deploy(DeployerManager.java:46)
              at org.jbpm.pvm.internal.repository.RepositorySessionImpl.deploy(RepositorySessionImpl.java:62)
              at org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:47)
              at org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:33)
              at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
              at org.jbpm.pvm.internal.tx.SpringCommandCallback.doInTransaction(SpringCommandCallback.java:45)
              at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
              at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:49)
              at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
              at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
              at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:56)
              at org.jbpm.pvm.internal.repository.DeploymentImpl.deploy(DeploymentImpl.java:90)
              ...
      

       

      How to redeploy some already deployed processes ?

       

      Regards