AnsweredAssumed Answered

Multi Tagging causes ConcurrencyFailureException

Question asked by gsugiart on Jul 14, 2010
Hi everyone,

I am using Alfresco 3.2 Enterprise edition.

I am trying to create a new feature which will do multiple files tagging in one action. Everytime I execute my code when I selected more than one files, it gives the following exception in the background/console:
Caused by: org.springframework.dao.ConcurrencyFailureException: ContentData with ID 1456 no longer exists
        at org.alfresco.repo.domain.contentdata.AbstractContentDataDAOImpl.deleteContentData(AbstractContentDataDAOImpl.java:215)
        at org.alfresco.repo.domain.contentdata.ibatis.ContentDataDAOImpl.deleteContentDataForNode(ContentDataDAOImpl.java:246)
        at org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl.addNodePropertyImpl(HibernateNodeDaoServiceImpl.java:1467)
        at org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl.addNodeProperty(HibernateNodeDaoServiceImpl.java:1513)
        at sun.reflect.GeneratedMethodAccessor333.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)

The code works, the documents are tagged correctly, but Exception is thrown in the background. When I execute the code with only one file it does not throw any exception in the background.

The following is my code:

private void processBulkTagging(String[] nodeRefList, String tag) {
      NodeService nodeService=serviceRegistry.getNodeService();
      TaggingService tagService = serviceRegistry.getTaggingService();
      
      for(int i=0;i<nodeRefList.length;i++) {
         NodeRef nodeRef=new NodeRef(nodeRefList[i]);
         if(nodeService.getType(nodeRef).compareTo(ContentModel.TYPE_FOLDER)!=0){
            tagService.clearTags(nodeRef);
            
            tagService.addTag(nodeRef, tag);
         }
      }
   }

The following is the full exception:
org.alfresco.service.cmr.repository.ContentIOException: 06130004 Failed to set content property on stream closure:
   node: workspace://SpacesStore/ee99ec4d-aeb6-45d7-af70-79be3a92cae1
   property: {http://www.alfresco.org/model/content/1.0}tagScopeCache
   writer: ContentAccessor[ contentUrl=store://2010/7/13/16/45/f190508e-aadd-46f3-b7b1-5535235107fd.bin, mimetype=text/plain, size=29, encoding=UTF-8,
locale=en_US]
org.springframework.dao.ConcurrencyFailureException: ContentData with ID 1456 no longer exists
        at org.alfresco.repo.content.ContentServiceImpl$WriteStreamListener.contentStreamClosed(ContentServiceImpl.java:658)
        at org.alfresco.repo.content.AbstractContentAccessor$CallbackFileChannel$1.execute(AbstractContentAccessor.java:359)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:327)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:253)
        at org.alfresco.repo.content.AbstractContentAccessor$CallbackFileChannel.fireChannelClosed(AbstractContentAccessor.java:369)
        at org.alfresco.repo.content.AbstractContentAccessor$CallbackFileChannel.implCloseChannel(AbstractContentAccessor.java:338)
        at java.nio.channels.spi.AbstractInterruptibleChannel.close(AbstractInterruptibleChannel.java:97)
        at java.nio.channels.Channels$1.close(Channels.java:138)
        at java.io.FilterOutputStream.close(FilterOutputStream.java:143)
        at org.springframework.util.FileCopyUtils.copy(FileCopyUtils.java:132)
        at org.alfresco.repo.content.AbstractContentWriter.putContent(AbstractContentWriter.java:467)
        at org.alfresco.repo.tagging.UpdateTagScopesActionExecuter$1.doWork(UpdateTagScopesActionExecuter.java:191)
        at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:514)
        at org.alfresco.repo.tagging.UpdateTagScopesActionExecuter.executeImpl(UpdateTagScopesActionExecuter.java:112)
        at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:127)
        at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:711)
        at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:648)
        at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1$1.execute(AsynchronousActionExecutionQueueImpl.java:
369)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:327)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:234)
        at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1.doWork(AsynchronousActionExecutionQueueImpl.java:378
)
        at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:514)
        at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper.run(AsynchronousActionExecutionQueueImpl.java:381)
        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:619)
Caused by: org.springframework.dao.ConcurrencyFailureException: ContentData with ID 1456 no longer exists
        at org.alfresco.repo.domain.contentdata.AbstractContentDataDAOImpl.deleteContentData(AbstractContentDataDAOImpl.java:215)
        at org.alfresco.repo.domain.contentdata.ibatis.ContentDataDAOImpl.deleteContentDataForNode(ContentDataDAOImpl.java:246)
        at org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl.addNodePropertyImpl(HibernateNodeDaoServiceImpl.java:1467)
        at org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl.addNodeProperty(HibernateNodeDaoServiceImpl.java:1513)
        at sun.reflect.GeneratedMethodAccessor333.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at org.alfresco.repo.transaction.TransactionalDaoInterceptor.invoke(TransactionalDaoInterceptor.java:68)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.domain.hibernate.DirtySessionMethodInterceptor.invoke(DirtySessionMethodInterceptor.java:419)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invokeInternal(SingleEntryTransactionResourceInterceptor.java:163)
        at org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invoke(SingleEntryTransactionResourceInterceptor.java:138)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy9.addNodeProperty(Unknown Source)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.setPropertyImpl(DbNodeServiceImpl.java:1455)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.setProperty(DbNodeServiceImpl.java:1419)
        at sun.reflect.GeneratedMethodAccessor481.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTNodeServiceInterceptor.java:110)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy11.setProperty(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor481.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvocationHandler.invoke(StoreRedirectorProxyFactory.java:221)
        at $Proxy12.setProperty(Unknown Source)
        at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:255)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:266)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:266)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy11.setProperty(Unknown Source)
        at org.alfresco.repo.content.ContentServiceImpl$WriteStreamListener.contentStreamClosed(ContentServiceImpl.java:638)
        … 25 more

Any help would be greatly appreciated.

Thanks.

Outcomes