Current version does not appear to be 1st version in the list

cancel
Showing results for 
Search instead for 
Did you mean: 
sjoshee
Active Member

Current version does not appear to be 1st version in the list

When I try to update node using share UI, I have seen the following error.
Current version does not appear to be 1st version in the list
If I update node using the javascript it does not throw any error and script calls itself multiple times. Do you know what causes this problem?
I see the JIRA ticket for the issue but related with delete ([MNT-17228] CMIS: Attempt to delete non-current version throws "Unexpected: current version does not... ) but I am noticing this issue for the update.
Here is the complete stack trace.
 
2017-05-04 10:14:55,166 ERROR [org.springframework.extensions.webscripts.AbstractRuntime] [http-apr-8080-exec-1118] Exception from executeScript - redirecting to status template error: 0404679268 Failed to execute transaction-level behaviour public abstract void org.alfresco.repo.node.NodeServicePolicies$OnUpdatePropertiesPolicy.onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef,java.util.Map,java.util.Map) in transaction 2ebbeb3e-a896-43f2-8e98-7c5f9ee461cd org.alfresco.error.AlfrescoRuntimeException: 0404679268 Failed to execute transaction-level behaviour public abstract void org.alfresco.repo.node.NodeServicePolicies$OnUpdatePropertiesPolicy.onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef,java.util.Map,java.util.Map) in transaction 2ebbeb3e-a896-43f2-8e98-7c5f9ee461cd at org.alfresco.repo.policy.TransactionBehaviourQueue.execute(TransactionBehaviourQueue.java:255) at org.alfresco.repo.policy.TransactionBehaviourQueue.beforeCommit(TransactionBehaviourQueue.java:134) at org.alfresco.util.transaction.TransactionSupportUtil$TransactionSynchronizationImpl.doBeforeCommit(TransactionSupportUtil.java:535) at org.alfresco.util.transaction.TransactionSupportUtil$TransactionSynchronizationImpl.doBeforeCommit(TransactionSupportUtil.java:514) at org.alfresco.util.transaction.TransactionSupportUtil$TransactionSynchronizationImpl.beforeCommit(TransactionSupportUtil.java:479) at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95) at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:925) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:738) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:475) at org.alfresco.util.transaction.SpringAwareUserTransaction.commit(SpringAwareUserTransaction.java:482) at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:479) at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:559) at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:628) at org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:400) at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:281) 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:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:68) at sun.reflect.GeneratedMethodAccessor524.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:125) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy299.doFilter(Unknown Source) at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:82) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.alfresco.web.app.servlet.WebScriptSSOAuthenticationFilter.doFilter(WebScriptSSOAuthenticationFilter.java:114) at sun.reflect.GeneratedMethodAccessor524.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:112) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy299.doFilter(Unknown Source) at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:82) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.alfresco.web.app.servlet.WebscriptCookieAuthenticationFilter.doFilter(WebscriptCookieAuthenticationFilter.java:59) at sun.reflect.GeneratedMethodAccessor524.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:125) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy299.doFilter(Unknown Source) at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:82) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2466) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2455) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.dao.ConcurrencyFailureException: Unexpected: current version does not appear to be 1st version in the list [workspace://version2Store/fba623b4-6e0f-4c1b-aacb-5108c6afe71f, workspace://SpacesStore/42ed16c1-ed31-4820-939f-d52a5ca6e24f] at org.alfresco.repo.version.Version2ServiceImpl.getCurrentVersionImpl(Version2ServiceImpl.java:859) at org.alfresco.repo.version.Version2ServiceImpl.createVersion(Version2ServiceImpl.java:232) at org.alfresco.repo.version.Version2ServiceImpl.createVersion(Version2ServiceImpl.java:118) at org.alfresco.repo.version.VersionableAspect$2.doWork(VersionableAspect.java:517) at org.alfresco.repo.version.VersionableAspect$2.doWork(VersionableAspect.java:512) at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:548) at org.alfresco.repo.version.VersionableAspect.createVersionImpl(VersionableAspect.java:512) at org.alfresco.repo.version.VersionableAspect.onUpdateProperties(VersionableAspect.java:489) at sun.reflect.GeneratedMethodAccessor1472.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.alfresco.repo.policy.JavaBehaviour$JavaMethodInvocationHandler.invoke(JavaBehaviour.java:174) at com.sun.proxy.$Proxy54.onUpdateProperties(Unknown Source) at sun.reflect.GeneratedMethodAccessor1175.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.alfresco.repo.policy.TransactionBehaviourQueue.execute(TransactionBehaviourQueue.java:243) ... 76 more
 
6 Replies
janv
Alfresco Employee

Re: Current version does not appear to be 1st version in the list

Hi Suresh,

Can you please confirm your exact Alfresco version (you can extract snippet from startup log) ?

Ideally, you/we can narrow down the exact repeatable steps, to ensure that recent fixes to the VersionService also resolve your specific issue (or not).

IIRC, you're running Alfresco Enterprise, so please feel free to contact Alfresco Support (if you haven't done so already) to track your issue in more detail :-)

Thanks,

Jan

sjoshee
Active Member

Re: Current version does not appear to be 1st version in the list

Thanks, Jan,

We are running Alfresco 5.0.3.

I will file a ticket with Alfresco support.

Regards

Suresh

kranthi
Active Member II

Re: Current version does not appear to be 1st version in the list

Hi Suresh,

I am also facing same issue if try to upload.

Like I had doc1.pdf with 1.0 version if I try to upload minor/major version on that file I am getting error as Caused by: org.springframework.dao.ConcurrencyFailureException: Unexpected: current version does not appear to be 1st version in the list [workspace://version2Store/d788b9aa-d6aa-44a4-b43e-6562b75d5e91, workspace://SpacesStore/d319dddd-1917-4aaf-b815-750f3ca30904]

arioh
Member II

Re: Current version does not appear to be 1st version in the list

Almost same issue - then I save node and try to create version using JS I get the same error:

Caused by: org.springframework.dao.ConcurrencyFailureException: Unexpected: current version does not appear to be 1st version in the list [workspace://version2Store/d2c78435-ef7d-45fe-8533-e353e0be04ca, workspace://SpacesStore/c109c8a7-0408-497a-ae90-4400436117ac]

UPD:

In my case exception was caused by broken node versioning. Version creationg always should be done at the end of transaction, and if you try to change node after version creating it will breake this node, and in future if you will try to create new version of the node or call getCurrentVersion() using VersionService it will return this error. To repair the node you can delete versionHistory of the node, maybe there are some other methods, but I don't know them.

Example of the wrong code in JS:

...

node.createVersion("test", false);

node.properties[...] = ...;

node.save();

...

f1mahesh
Customer

Re: Current version does not appear to be 1st version in the list


Hi,

Did anyone get any response from alfresco on this? I am also facing the same issue.

 

Regards,

Mahesh

Soprasteria
Customer

Re: Current version does not appear to be 1st version in the list

Hi !

I get the same issue and fixed it.

When I try to add another version to a node, I copy properties from newNode to destinationNode then I copy nodeContent.

On node content update Alfresco try to update node's version automatically (by default).

But when I copy all properties of newNode and paste it to destinationNode, I also copy version properties of the node. It get conflicted then when Alfresco update node version.

Example :

newNode is v1.0 - destinationNode is v1.1

When I copy properties of newNode to destinationNode, I update version to 1.0. Then Alfresco tries to update version and raised a conflict because destinationNode version is 1.1

Solution :

Keep destinationNode properties of version when updating with newNode properties.

public void updateNode(NodeRef newNode, NodeRef destNode){
        Map<QName, Serializable> props = mergeNodesProperties(newNode, destNode);
        serviceRegistry.getNodeService().setProperties(destNode, props);

        ContentWriter contentWriter = serviceRegistry.getContentService().getWriter(destNode, ContentModel.PROP_CONTENT, true);
        contentWriter.putContent(serviceRegistry.getContentService().getReader(newNode, ContentModel.PROP_CONTENT));

        serviceRegistry.getNodeService().deleteNode(newNode);
    }
    
    private Map<QName, Serializable> mergeNodesProperties(NodeRef newNodeRef, NodeRef destNodeRef) {
        Map<QName, Serializable> properties = serviceRegistry.getNodeService().getProperties(newNodeRef);
        Map<QName, Serializable> oldProperties = serviceRegistry.getNodeService().getProperties(destNodeRef);

        Map<QName, Serializable> newProperties = properties.entrySet()
                .stream()
                .filter(qNameSerializableEntry -> !qNameSerializableEntry.getKey().getLocalName().toLowerCase().contains("version"))
                .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));

        newProperties.putAll(oldProperties.entrySet()
                .stream()
                .filter(qNameSerializableEntry -> qNameSerializableEntry.getKey().getLocalName().toLowerCase().contains("version"))
                .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)));

        return newProperties;
    }

Regards,

Charles