cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with autodeploy feature and 5.9

aparraga
Champ in-the-making
Champ in-the-making
I did not noticed this error in 5.8, but in 5.9:

When I launched my development environment against a production database backup in 5.8 (and my environment in 5.9), the database was upgraded to 5.9 because I have activated the databaseSchemaUpdate property, BUT it crashes with a NULL Pointer Exception at this point:

java.lang.NullPointerException
   at org.activiti.engine.impl.cmd.DeployCmd.deploymentsDiffer(DeployCmd.java:72)
   at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:50)
   at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:30)

I have the deploymentResources for autodeploy new diagrams (amazing feature):
    <property name="deploymentResources" value="classpath:diagrams/*.bpmn20.xml" />        

So, the cause of the null pointer exception is that the DeployCmd at this point:

      ResourceEntity savedResource = savedResources.get(resourceName);
      if(!savedResource.isGenerated()) {

savedResource is null, reason is because the keys of the savedResources collection are different than the keys in the resources collection. The keys seems to be compounds by the paths + names of the bpmn files, and because paths are different in production and in my dev environment, it crashes.

When I was using the 5.8 with the backup of production 5.8 database, I do not remember this error.

So, I'm trying to figure out the reason, could anybody help me on that?

Thank you.
10 REPLIES 10

trademak
Star Contributor
Star Contributor
Hi,

We changed this logic in version 5.9, so that's probably the cause of this.
The idea is that a process will not be redeployed without it being changed, this logic was not implemented correctly before 5.9.
Can you raise a JIRA with a test case?

Thanks,

jrussell_smyth
Champ in-the-making
Champ in-the-making
I have added to the jira here http://jira.codehaus.org/browse/ACT-1150

This is not a minor issue. Adding a new bpmn to the auto deploy will cause any future deployments/starts to fail. The missing logic in the deploymentsDiffer function is clear, the fix is very small but without it autodeployment is unusable.

aparraga
Champ in-the-making
Champ in-the-making
I already fixed the issue by changing the DeployCmd::deploymentsDiffer method as following:


protected boolean deploymentsDiffer(DeploymentEntity deployment,
         DeploymentEntity saved) {
  Map<String, ResourceEntity> resources = deployment.getResources();
  Map<String, ResourceEntity> savedResources = saved.getResources();

  for (String resourceName : resources.keySet()) {
   String diagramName = resourceName.replaceAll(".+\\/", "");
   boolean isNewDiagram = true; //by default
   for (String pathToDiagram : savedResources.keySet()) {
    if (pathToDiagram.indexOf(diagramName) >= 0) {
     isNewDiagram = false;
     ResourceEntity savedResource = savedResources
             .get(pathToDiagram);
     if (!savedResource.isGenerated()) {
      ResourceEntity resource = resources.get(resourceName);

      byte[] bytes = resource.getBytes();
      byte[] savedBytes = savedResource.getBytes();
      if (!Arrays.equals(bytes, savedBytes)) {
       return true;
      }
     }
    }
   }
   if(isNewDiagram) {
    return true;
   }
  }
  return false;
}

I mean, I don't compare the path to the diagrams, just the filenames. I know that this is not the best general purpose solution, but for our concrete use case is enough.

Anyway, in our case the bug was due to the paths to the diagrams.

heymjo
Champ on-the-rise
Champ on-the-rise
Is it feasible to get a 5.9.1 for this fix ?

trademak
Star Contributor
Star Contributor
Hi,

I committed a fix for this issue to trunk. It was a really stupid bug, I'm sorry for that.
It will be part of Activiti 5.10, but you can always build a version yourself with the trunk code.

Best regards,

heymjo
Champ on-the-rise
Champ on-the-rise
you can't seriously expect us to build from trunk and use the result in production 🙂

It would be very helpful if you could link here the commit or diff that fixes this bug. I tried extracting it from the svn logs but there have been several commits on BpmnDeployer since the release so i'm not quite sure.

trademak
Star Contributor
Star Contributor
Hi,

I only said you can build a distribution from trunk, I'm not expecting anyone to use that in production.
On the other hand, we have a good continuous QA environment, so it's not that stupid.
Here's the diff:

https://fisheye.codehaus.org/browse/activiti/activiti/trunk/modules/activiti-engine/src/main/java/or...

Best regards,

heymjo
Champ on-the-rise
Champ on-the-rise
ok thanks, found the diff. We'll be forking off 5.9 and apply this locally until 5.10 is released.

robin1
Champ in-the-making
Champ in-the-making
I'm building a new application using Activiti and encountered the same problem.

If you have an existing database you need to keep, this won't help you but as a temporary fix every time I change the resources I've been wiping out my Activiti database tables.

delete from ACT_RU_JOB;
delete from ACT_RU_VARIABLE;
delete from ACT_GE_BYTEARRAY;
delete from ACT_HI_ACTINST;
delete from ACT_RE_DEPLOYMENT;
delete from ACT_HI_TASKINST;
delete from ACT_HI_PROCINST;
delete from ACT_RU_VARIABLE;
delete from ACT_RU_IDENTITYLINK;
delete from ACT_RU_TASK;
delete from ACT_RU_EXECUTION;
delete from ACT_RE_PROCDEF;
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.