cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco Explorer blocks properties when I change it?

spilby
Confirmed Champ
Confirmed Champ
I have a problem after using the Alfresco Explorer.

I have created a java webscript to create nodes and modify properties, into a transaction, oks? All works fine when I use the webscript. I create folders, subfolders, modify the properties, all ok.

But then, I do the following… I go to the Alfresco Explorer. Find one of the folders and edit the properties, modify something and save.

After I do this, when I use my webscript and try to change a property of one of the nodes that I changed before with the Alfresco Explorer, a exception is thrown: "ConcurrencyFailureException: Failed to update node". And I can't change or add properties on this node. Only if I restart the server I can update with my webscript the node again and all works fine another time.

First I thank that was a problem in my code, but if so, it would never works. Or it doesn't works after the restart. But no, the code works always if I don't use the Alfresco Explorer, and works again if I restart the tomcat server where alfresco runs.

Are there a problem with the Alfresco Explorer that blocks the properties of the nodes when someone change it? What might be the problem? I'm using Alfresco Enterprise v4.1.6.

Thanks!
23 REPLIES 23

marsbard
Champ in-the-making
Champ in-the-making
Can you paste the full stacktrace that you get when this error occurs? Should be in both alfresco.log and catalina.out

Of course, here is:

org.springframework.dao.ConcurrencyFailureException: Failed to update node 291346
        at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.updateNodeImpl(AbstractNodeDAOImpl.java:1875)
        at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.touchNode(AbstractNodeDAOImpl.java:1701)
        at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.setNodePropertiesImpl(AbstractNodeDAOImpl.java:2283)
        at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.addNodeProperties(AbstractNodeDAOImpl.java:2387)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.addAspectsAndProperties(DbNodeServiceImpl.java:542)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.addAspectsAndProperties(DbNodeServiceImpl.java:444)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.setProperty(DbNodeServiceImpl.java:1593)
        at sun.reflect.GeneratedMethodAccessor484.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:309)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTNodeServiceInterceptor.java:105)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at com.sun.proxy.$Proxy15.setProperty(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor484.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:215)
        at com.sun.proxy.$Proxy42.setProperty(Unknown Source)
        at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:252)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.enterprise.repo.sync.SyncPropertyInterceptor.invoke(SyncPropertyInterceptor.java:223)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:260)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at com.sun.proxy.$Proxy15.setProperty(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor484.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:309)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
        at com.sun.proxy.$Proxy15.setProperty(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor484.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:309)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.alfresco.repo.audit.DisableAuditableBehaviourInterceptor.invoke(DisableAuditableBehaviourInterceptor.java:113)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:161)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.transaction.RetryingTransactionInterceptor$1.execute(RetryingTransactionInterceptor.java:79)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:449)
        at org.alfresco.repo.transaction.RetryingTransactionInterceptor.invoke(RetryingTransactionInterceptor.java:69)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at com.sun.proxy.$Proxy15.setProperty(Unknown Source)
        at cat.aoc.alfresco.desal.service.AlfrescoService.updateCustomProperties(AlfrescoService.java:439)
        at cat.aoc.alfresco.desal.service.AlfrescoService.transactionUpdateCustomProperties(AlfrescoService.java:690)
        at cat.aoc.alfresco.desal.CarregaDocumentWebScript.insertaDocument(CarregaDocumentWebScript.java:773)
        at cat.aoc.alfresco.desal.CarregaDocumentWebScript.carregaDocument(CarregaDocumentWebScript.java:239)
        at cat.aoc.alfresco.desal.CarregaDocumentWebScript.execute(CarregaDocumentWebScript.java:127)
        at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:421)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:449)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:483)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:521)
        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:333)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:378)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
        at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at com.googlecode.psiprobe.Tomcat60AgentValve.invoke(Tomcat60AgentValve.java:30)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:227)
        at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:347)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)


From the alfresco.log. It's thrown when my code call to getNodeService().setProperty. In catalina.log the trace is the same.

org.springframework.dao.ConcurrencyFailureException: Failed to update node 291346
        at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.updateNodeImpl(AbstractNodeDAOImpl.java:1875)
        at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.touchNode(AbstractNodeDAOImpl.java:1701)
        at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.setNodePropertiesImpl(AbstractNodeDAOImpl.java:2283)
        at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.addNodeProperties(AbstractNodeDAOImpl.java:2387)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.addAspectsAndProperties(DbNodeServiceImpl.java:542)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.addAspectsAndProperties(DbNodeServiceImpl.java:444)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.setProperty(DbNodeServiceImpl.java:1593)
        at sun.reflect.GeneratedMethodAccessor484.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:309)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTNodeServiceInterceptor.java:105)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at com.sun.proxy.$Proxy15.setProperty(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor484.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:215)
        at com.sun.proxy.$Proxy42.setProperty(Unknown Source)
        at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:252)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.enterprise.repo.sync.SyncPropertyInterceptor.invoke(SyncPropertyInterceptor.java:223)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:260)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at com.sun.proxy.$Proxy15.setProperty(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor484.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:309)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
        at com.sun.proxy.$Proxy15.setProperty(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor484.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:309)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.alfresco.repo.audit.DisableAuditableBehaviourInterceptor.invoke(DisableAuditableBehaviourInterceptor.java:113)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:161)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.transaction.RetryingTransactionInterceptor$1.execute(RetryingTransactionInterceptor.java:79)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:449)
        at org.alfresco.repo.transaction.RetryingTransactionInterceptor.invoke(RetryingTransactionInterceptor.java:69)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at com.sun.proxy.$Proxy15.setProperty(Unknown Source)
        at cat.aoc.alfresco.desal.service.AlfrescoService.updateCustomProperties(AlfrescoService.java:439)
        at cat.aoc.alfresco.desal.service.AlfrescoService.transactionUpdateCustomProperties(AlfrescoService.java:690)
        at cat.aoc.alfresco.desal.CarregaDocumentWebScript.insertaDocument(CarregaDocumentWebScript.java:773)
        at cat.aoc.alfresco.desal.CarregaDocumentWebScript.carregaDocument(CarregaDocumentWebScript.java:239)
        at cat.aoc.alfresco.desal.CarregaDocumentWebScript.execute(CarregaDocumentWebScript.java:127)
        at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:421)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:449)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:483)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:521)
        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:333)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:378)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
        at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at com.googlecode.psiprobe.Tomcat60AgentValve.invoke(Tomcat60AgentValve.java:30)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:227)
        at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:347)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)



   .

sanket
Champ on-the-rise
Champ on-the-rise
Also, can you share the java code that you have written in your webscript ?

spilby
Confirmed Champ
Confirmed Champ
Of course, here is the exception:

org.springframework.dao.ConcurrencyFailureException: Failed to update node 291346
at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.updateNodeImpl(AbstractNodeDAOImpl.java:1875)
at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.touchNode(AbstractNodeDAOImpl.java:1701)
at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.setNodePropertiesImpl(AbstractNodeDAOImpl.java:2283)
at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.addNodeProperties(AbstractNodeDAOImpl.java:2387)
at org.alfresco.repo.node.db.DbNodeServiceImpl.addAspectsAndProperties(DbNodeServiceImpl.java:542)
at org.alfresco.repo.node.db.DbNodeServiceImpl.addAspectsAndProperties(DbNodeServiceImpl.java:444)
at org.alfresco.repo.node.db.DbNodeServiceImpl.setProperty(DbNodeServiceImpl.java:1593)
at sun.reflect.GeneratedMethodAccessor484.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:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTNodeServiceInterceptor.java:105)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy15.setProperty(Unknown Source)
at sun.reflect.GeneratedMethodAccessor484.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:215)
at com.sun.proxy.$Proxy42.setProperty(Unknown Source)
at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:252)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.enterprise.repo.sync.SyncPropertyInterceptor.invoke(SyncPropertyInterceptor.java:223)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:260)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy15.setProperty(Unknown Source)
at sun.reflect.GeneratedMethodAccessor484.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:309)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
at com.sun.proxy.$Proxy15.setProperty(Unknown Source)
at sun.reflect.GeneratedMethodAccessor484.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:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.alfresco.repo.audit.DisableAuditableBehaviourInterceptor.invoke(DisableAuditableBehaviourInterceptor.java:113)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:161)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.transaction.RetryingTransactionInterceptor$1.execute(RetryingTransactionInterceptor.java:79)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:449)
at org.alfresco.repo.transaction.RetryingTransactionInterceptor.invoke(RetryingTransactionInterceptor.java:69)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy15.setProperty(Unknown Source)
at cat.aoc.alfresco.desal.service.AlfrescoService.updateCustomProperties(AlfrescoService.java:439)
at cat.aoc.alfresco.desal.service.AlfrescoService.transactionUpdateCustomProperties(AlfrescoService.java:690)
at cat.aoc.alfresco.desal.CarregaDocumentWebScript.insertaDocument(CarregaDocumentWebScript.java:773)
at cat.aoc.alfresco.desal.CarregaDocumentWebScript.carregaDocument(CarregaDocumentWebScript.java:239)
at cat.aoc.alfresco.desal.CarregaDocumentWebScript.execute(CarregaDocumentWebScript.java:127)
at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:421)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:449)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:483)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:521)
at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:333)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:378)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at com.googlecode.psiprobe.Tomcat60AgentValve.invoke(Tomcat60AgentValve.java:30)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:227)
at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:347)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)

From the alfresco.log. It's thrown when my code call to getNodeService().setProperty. In catalina.log the trace is the same.

spilby
Confirmed Champ
Confirmed Champ
This is the code of my webscript. Not all (is bigger), but the necessary.


public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException, WebScriptException
{

   // AUTENTICATION
    getAuthenticationService().authenticate(usuario, password);

   // PATH WHERE BEGINS TO CREATE NODES
   NodeRef nodeRef = serviceRegistry.getFileFolderService().resolveNamePath(repository.getCompanyHome(), pathInicial).getNodeRef();

   // LIST OF PROPERTIES
   Map properties = new HashMap();
   properties.put(QName.createQName(Constantes.folder, Constants.numExpedienteProperty), numExpediente);
   properties.put(QName.createQName(Constantes.folder, Constants.autorProperty), autor);
   (…)

   // CREATE THE FOLDERS OF THE PATH THAT NOT EXISTS
   boolean newFolder = false;
   StringTokenizer tokenizer = new StringTokenizer(path, "/");
   while (tokenizer.hasMoreTokens()) {
      if (!newFolder) {
         List assocs = new ArrayList();
         assocs = getNodeService().getChildAssocsByPropertyValue(nodeRef, QName.createQName(Constantes.folder, Constants.numExpedienteProperty), numExpediente);
         if (existe) {
             nodeRef = assocs.get(0).getChildRef();
         } else {
             newFolder = true;
         }
    }

    if (newFolder) {
        UserTransaction trx = serviceRegistry.getTransactionService().getNonPropagatingUserTransaction();
       try {
      trx.begin();
           nodeRef = getNodeService().createNode(nodeRef,  ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name), tipo, properties).getChildRef();
           trx.commit();
        } catch(Throwable e) {
      trx.rollback();
      logger.error("ERROR: " + e);
      throw new WebScriptException(Status.STATUS_PROPERTIES_ERROR, e.getMessage());
   }   
    }

} // while


UserTransaction trx = serviceRegistry.getTransactionService().getNonPropagatingUserTransaction();
try {
    trx.begin();
    // CREATE DOCUMENT NODE
    nodeRef = getNodeService().createNode(nodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nameDoc), tipo, properties).getChildRef();

    // DOCUMENT UPLOAD
    InputStream myInputStream = getFileAsStream(pathDoc);
    BufferedInputStream inputStream = new BufferedInputStream(myInputStream);
    writer = getContentService().getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
    writer.putContent(inputStream);
    trx.commit();
} catch(Throwable e) {
   trx.rollback();
   logger.error("ERROR: " + e);
   throw new WebScriptException(Status.STATUS_CREATE_ERROR, e.getMessage());
}

// POINTER AT THE PARENT NODE
NodeRef parent = getNodeService().getPrimaryParent(nodeRef).getParentRef();

UserTransaction trx = serviceRegistry.getTransactionService().getNonPropagatingUserTransaction();
       
try {
   trx.begin();
         
       // UPDATE PROPERTIES FROM DOWN TO UP UNTIL A CONDITION X
       while (condition) {
          Long numDocuments = (Long) getNodeService().getProperty(nodeRef, QName.createQName(Constantes.folder, Constantes.numDocuments)) + 1;
         
          // THIS IS THE LINE THAT THROWS THE CONCURRENCY EXCEPTION WHEN SETS THE NODE THAT I CHANGE BEFORE WITH THE ALFRESCO EXPLORER
          getNodeService().setProperty(nodeRef, QName.createQName(Constantes.folder, Constants.numDocumentsProperty), numDocuments);

          nodeRef = getNodeService().getPrimaryParent(nodeRef).getParentRef();
       } // while
      
       trx.commit();
   } catch(Throwable e) {
   trx.rollback();
   logger.error("transactionUpdateCustomProperties - ERROR: " + e);
   throw new WebScriptException(Status.STATUS_PROPERTIES_ERROR, e.getMessage());
   }   

}

spilby
Confirmed Champ
Confirmed Champ
I try to put here the complete exception, but the administrators needs to check it before publishing.

This is a fragment of the exception:

org.springframework.dao.ConcurrencyFailureException: Failed to update node 291346
        at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.updateNodeImpl(AbstractNodeDAOImpl.java:1875)
        at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.touchNode(AbstractNodeDAOImpl.java:1701)
        at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.setNodePropertiesImpl(AbstractNodeDAOImpl.java:2283)
        at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.addNodeProperties(AbstractNodeDAOImpl.java:2387)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.addAspectsAndProperties(DbNodeServiceImpl.java:542)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.addAspectsAndProperties(DbNodeServiceImpl.java:444)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.setProperty(DbNodeServiceImpl.java:1593)
        at sun.reflect.GeneratedMethodAccessor484.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
(…)

sanket
Champ on-the-rise
Champ on-the-rise
Can you try this modified webscript code ?
Alfresco internally handles the transactions. I don't think everytime we need to begin and commit each and every transaction.
Do let me know the outcome of this code.

public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException, WebScriptException
{
// AUTENTICATION
getAuthenticationService().authenticate(usuario, password);
// PATH WHERE BEGINS TO CREATE NODES
NodeRef nodeRef = serviceRegistry.getFileFolderService().resolveNamePath(repository.getCompanyHome(), pathInicial).getNodeRef();
// LIST OF PROPERTIES
Map properties = new HashMap();
properties.put(QName.createQName(Constantes.folder, Constants.numExpedienteProperty), numExpediente);
properties.put(QName.createQName(Constantes.folder, Constants.autorProperty), autor);
(…)
// CREATE THE FOLDERS OF THE PATH THAT NOT EXISTS
boolean newFolder = false;
StringTokenizer tokenizer = new StringTokenizer(path, "/");
while (tokenizer.hasMoreTokens()) {
if (!newFolder) {
List assocs = new ArrayList();
assocs = getNodeService().getChildAssocsByPropertyValue(nodeRef, QName.createQName(Constantes.folder, Constants.numExpedienteProperty), numExpediente);
if (existe) {
nodeRef = assocs.get(0).getChildRef();
} else {
newFolder = true;
}
}
if (newFolder) {

try {

nodeRef = getNodeService().createNode(nodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name), tipo, properties).getChildRef();

} catch(WebScriptException e) {

logger.error("ERROR: " + e);
throw new WebScriptException(Status.STATUS_PROPERTIES_ERROR, e.getMessage());
}   
}
} // while

try {

// CREATE DOCUMENT NODE
nodeRef = getNodeService().createNode(nodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nameDoc), tipo, properties).getChildRef();
// DOCUMENT UPLOAD
InputStream myInputStream = getFileAsStream(pathDoc);
BufferedInputStream inputStream = new BufferedInputStream(myInputStream);
writer = getContentService().getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
writer.putContent(inputStream);

} catch(WebScriptException e) {

logger.error("ERROR: " + e);
throw new WebScriptException(Status.STATUS_CREATE_ERROR, e.getMessage());
}
// POINTER AT THE PARENT NODE
NodeRef parent = getNodeService().getPrimaryParent(nodeRef).getParentRef();


try {


// UPDATE PROPERTIES FROM DOWN TO UP UNTIL A CONDITION X
while (condition) {
Long numDocuments = (Long) getNodeService().getProperty(nodeRef, QName.createQName(Constantes.folder, Constantes.numDocuments)) + 1;

// THIS IS THE LINE THAT THROWS THE CONCURRENCY EXCEPTION WHEN SETS THE NODE THAT I CHANGE BEFORE WITH THE ALFRESCO EXPLORER
getNodeService().setProperty(nodeRef, QName.createQName(Constantes.folder, Constants.numDocumentsProperty), numDocuments);
nodeRef = getNodeService().getPrimaryParent(nodeRef).getParentRef();
} // while


} catch(WebScriptException e) {

logger.error("transactionUpdateCustomProperties - ERROR: " + e);
throw new WebScriptException(Status.STATUS_PROPERTIES_ERROR, e.getMessage());
}
}

spilby
Confirmed Champ
Confirmed Champ
At first, I had the code like you recommend me, without transactions. But I had one problem plus.

When I didn't use the transactions, the concurrency exception appeared in two cases: when I delete a node with the Alfresco Explorer, and when I change a property with the Alfresco Explorer. In both cases, the exception was thrown at the same line: when do the setProperty of the node.

An user recommends me put the transactions in the code, each time I do a createNode or addProperties, to solve this. The solution go ok on the first case. Now, with the transactions, if I delete a node with the explorer, the webscript don't give me the exception when my webscript creates the node again and modify the properties. But on the second case (the case that I explain in this thread of the forum) the problem persists.

In resume: the transactions solve one of the two problems, but not all.

This is my webscript xml, for more information:


<webscript>
  <shortname>Web script to create and upload</shortname>
  <description>Return a JSON</description>
  <url>/own/APD/createdocument</url>
  <authentication>user</authentication>
  <format default="json">argument</format>
  <family>Alfresco Java-Backed WebScripts</family>
</webscript>