cancel
Showing results for 
Search instead for 
Did you mean: 

RenditionService node update error.

docterwatson
Champ in-the-making
Champ in-the-making
I am having some issues getting renditions to properly populate using the RenditionService. Here is what I am doing:

Creating about six renditions for an image using the renditionService, here is an example of how I am doing this.

NodeRef renderedNode = this.createRendition(node, <path to rendition folder + rendered node name>, <imageMagick command>, "myRendition");

private NodeRef createRendition(NodeRef node, String destination, String command, String rendDefName) {
      QName renditionName = QName.createQName(NAMESPACE_URI, rendDefName);
      RenditionDefinition renditionDef = renditionService.createRenditionDefinition(QName.createQName(NAMESPACE_URI, rendDefName), ImageRenderingEngine.NAME);
      renditionDef.setParameterValue(ImageRenderingEngine.PARAM_COMMAND_OPTIONS, command);
      renditionDef.setParameterValue(ImageRenderingEngine.PARAM_ALLOW_ENLARGEMENT, true);
      renditionDef.setParameterValue(ImageRenderingEngine.PARAM_AUTO_ORIENTATION, false);
      renditionDef.setParameterValue(RenditionService.PARAM_DESTINATION_PATH_TEMPLATE, destination);
      renditionDef.setExecuteAsynchronously(false);

      // Check for existing rendition for given definition
      ChildAssociationRef renNode = renditionService.getRenditionByName(node, renditionName);
      if (renNode == null) {
         logger.debug("Rendition of type " + renditionName + " does not exist, creating it now.");
         logger.debug("Imagemagick command to execute: " + (String) renditionDef.getParameterValue(ImageRenderingEngine.PARAM_COMMAND_OPTIONS));
         renNode = renditionService.render(node, renditionDef);
      }
      return renNode.getChildRef();
   }


This is great. I can generate my renditions and all is well. However, whenever I <strong>update</strong> my source image, I receive errors as follows:
(modified <> for privacy)


2013-02-20 22:09:59,348  DEBUG [repo.rendition.RenditionNodeManager] [defaultAsyncAction2] Existing rendition with name {<NAMESPACE_URI>}myRendition: workspace://SpacesStore/b93c1188-bf8c-45a8-a5b0-becb46aaf4de
2013-02-20 22:09:59,349  DEBUG [repo.rendition.RenditionNodeManager] [defaultAsyncAction2] Creating/updating rendition based on:
    sourceNode: workspace://SpacesStore/361fd807-8666-4fa4-8f6d-ddf1a244bd7d
    tempRendition: workspace://SpacesStore/e7e2721b-1853-4dd2-86ce-a87463a4da39
    parentNode: workspace://SpacesStore/0679d611-652f-414f-a6eb-03a4c9f83afb
    childNode: workspace://SpacesStore/d02aac92-5f4e-475b-834a-f94ae3fd0d15
    childName: <renditionImageName>.png
    renditionDefinition.name: {<NAMESPACE_URI>}myRendition
2013-02-20 22:09:59,349  DEBUG [repo.rendition.RenditionNodeManager] [defaultAsyncAction2] The old rendition was not in the correct location
2013-02-20 22:09:59,349  DEBUG [repo.rendition.RenditionNodeManager] [defaultAsyncAction2] The old rendition does require orphaning.
2013-02-20 22:09:59,349  DEBUG [repo.rendition.RenditionNodeManager] [defaultAsyncAction2] Orphaning old rendition node workspace://SpacesStore/b93c1188-bf8c-45a8-a5b0-becb46aaf4de
2013-02-20 22:09:59,410  ERROR [repo.action.AsynchronousActionExecutionQueueImpl] [defaultAsyncAction2] Failed to execute asynchronous action: Action[ id=cce7561e-8795-4d0b-a458-957975a747f7, node=workspace://SpacesStore/cce7561e-8795-4d0b-a458-957975a747f7 ]
org.alfresco.service.cmr.rendition.RenditionServiceException: 01200016 Cannot perform a rendition to an existing rendition node whose source is different.
   at org.alfresco.repo.rendition.RenditionNodeManager.checkDestinationNodeIsAcceptable(RenditionNodeManager.java:365)
   at org.alfresco.repo.rendition.RenditionNodeManager.getSpecifiedRenditionOrCreateNewRendition(RenditionNodeManager.java:327)
   at org.alfresco.repo.rendition.RenditionNodeManager.findOrCreateRenditionNode(RenditionNodeManager.java:157)
   at org.alfresco.repo.rendition.executer.AbstractRenderingEngine.createOrUpdateRendition(AbstractRenderingEngine.java:966)
   at org.alfresco.repo.rendition.executer.AbstractRenderingEngine.switchToFinalRenditionNode(AbstractRenderingEngine.java:881)
   at org.alfresco.repo.rendition.executer.AbstractRenderingEngine$1.doWork(AbstractRenderingEngine.java:437)
   at org.alfresco.repo.rendition.executer.AbstractRenderingEngine$1.doWork(AbstractRenderingEngine.java:408)
   at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:516)
   at org.alfresco.repo.rendition.executer.AbstractRenderingEngine.executeImpl(AbstractRenderingEngine.java:407)
   at org.alfresco.repo.rendition.executer.AbstractRenderingEngine.executeImpl(AbstractRenderingEngine.java:369)
   at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:196)
   at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:790)
   at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:701)
   at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1$1.execute(AsynchronousActionExecutionQueueImpl.java:403)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:259)
   at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1.doWork(AsynchronousActionExecutionQueueImpl.java:412)
   at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:516)
   at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper.run(AsynchronousActionExecutionQueueImpl.java:415)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:662)



I have tried simply removing the RenditionService.PARAM_DESTINATION_PATH_TEMPLATE piece and allowing the renditions to be created hidden, but I get the exact same error when I update the original image.

I have also tried setting renditionDef.setParameterValue(RenditionService.PARAM_ORPHAN_EXISTING_RENDITION, true); as I don't really care what happens to the old renditions, but the results are the same.


Any input here would be great. Thanks all.
1 REPLY 1

docterwatson
Champ in-the-making
Champ in-the-making
I figured out my issue. <strong>All rendition definitions must have a unique name!</strong> Learned my lesson, hope this helps someone else.