cancel
Showing results for 
Search instead for 
Did you mean: 

Creating association to versionStore

calle
Champ in-the-making
Champ in-the-making
Hi
I would like to create an association to a previous version of some content. I have defined an association with target class cm:content but when the association is to be created Alfresco throws the following error on me:
org.alfresco.service.cmr.repository.InvalidNodeRefException: Node does not exist: versionStore://lightWeightVersionStore/3b776667-a412-11dd-93f6-2da6628fc5ab
         org.alfresco.repo.node.db.DbNodeServiceImpl.getNodeNotNull(DbNodeServiceImpl.java:142)
         org.alfresco.repo.node.db.DbNodeServiceImpl.createAssociation(DbNodeServiceImpl.java:1344)
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)
         org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
         org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
         org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invokeInternal(SingleEntryTransactionResourceInterceptor.java:163)
         org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invoke(SingleEntryTransactionResourceInterceptor.java:138)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
         org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
         $Proxy3.createAssociation(Unknown Source)
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)
         org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvocationHandler.invoke(StoreRedirectorProxyFactory.java:221)
         $Proxy4.createAssociation(Unknown Source)
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)
         org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
         org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
         org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:241)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
         org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:241)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
         org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:280)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
         org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:280)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
         org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
         $Proxy3.createAssociation(Unknown Source)
         se.redpill.alfresco.module.jkp.web.bean.SbaScriptProxy.createAssociations(SbaScriptProxy.java:89)
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)
         org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
         org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
         org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86)
         org.mozilla.javascript.gen.c1._c0(AlfrescoScript:52)
         org.mozilla.javascript.gen.c1.call(AlfrescoScript)
         org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
         org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
         org.mozilla.javascript.gen.c1.call(AlfrescoScript)
         org.mozilla.javascript.gen.c1.exec(AlfrescoScript)
         org.mozilla.javascript.Context.evaluateString(Context.java:1196)
         org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:527)
         org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:112)
         org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:243)
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)
         org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
         org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
         org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
         org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
         org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:245)
         org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
         org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
         org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
         $Proxy47.executeScript(Unknown Source)
         org.alfresco.web.scripts.ScriptProcessor.executeScript(ScriptProcessor.java:108)
         org.alfresco.web.scripts.AbstractWebScript.executeScript(AbstractWebScript.java:622)
         org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:117)
         org.alfresco.web.scripts.WebScriptRuntime.wrappedExecute(WebScriptRuntime.java:364)
         org.alfresco.web.scripts.WebScriptRuntime$1.execute(WebScriptRuntime.java:330)
         org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:241)
         org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:171)
         org.alfresco.web.scripts.WebScriptRuntime.transactionedExecute(WebScriptRuntime.java:341)
         org.alfresco.web.scripts.WebScriptRuntime.authenticatedExecute(WebScriptRuntime.java:284)
         org.alfresco.web.scripts.WebScriptRuntime.executeScript(WebScriptRuntime.java:150)
         org.alfresco.web.scripts.WebScriptServlet.service(WebScriptServlet.java:109)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
         org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
         org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
         org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
         org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
         org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
         org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
         org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
         org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
         org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
         java.lang.Thread.run(Thread.java:619)
      org.mozilla.javascript.WrappedException: Wrapped org.alfresco.service.cmr.repository.InvalidNodeRefException: Node does not exist: versionStore://lightWeightVersionStore/3b776667-a412-11dd-93f6-2da6628fc5ab (AlfrescoScript#52)
      org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1757)
      org.alfresco.error.AlfrescoRuntimeException: Wrapped org.alfresco.service.cmr.repository.InvalidNodeRefException: Node does not exist: versionStore://lightWeightVersionStore/3b776667-a412-11dd-93f6-2da6628fc5ab (AlfrescoScript#52)
      org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:535)
      org.alfresco.service.cmr.repository.ScriptException: Failed to execute script 'file:/opt/alfresco_2.2.0-EE/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/extension/templates/webscripts/se/redpill/alfresco/module/jkp/archive.post.js': Wrapped org.alfresco.service.cmr.repository.InvalidNodeRefException: Node does not exist: versionStore://lightWeightVersionStore/3b776667-a412-11dd-93f6-2da6628fc5ab (AlfrescoScript#52)
      org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:116)
      org.alfresco.service.cmr.repository.ScriptException: Failed to execute script 'file:/opt/alfresco_2.2.0-EE/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/extension/templates/webscripts/se/redpill/alfresco/module/jkp/archive.post.js': Failed to execute script 'file:/opt/alfresco_2.2.0-EE/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/extension/templates/webscripts/se/redpill/alfresco/module/jkp/archive.post.js': Wrapped org.alfresco.service.cmr.repository.InvalidNodeRefException: Node does not exist: versionStore://lightWeightVersionStore/3b776667-a412-11dd-93f6-2da6628fc5ab (AlfrescoScript#52)
      org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:247)

The lines where I create the association is in a the java bean SbaScriptProxy, that is accessible from my javascript webscript and looks like:
               
                //Create new associations
      for (final NodeRef nodeRef : searchResult) {
         if(nodeService.exists(nodeRef)) {
            nodeService.createAssociation(n.getNodeRef(), nodeRef, JkpTkModel.ASSOC_RELATE_BY);
         }
         else {
            logger.warn("Trying to create association to node (" + nodeRef.toString() +") that does not exists!");
         }
      }

What is interesting is that the node not found certainly does exists! I could download its content with a call to /d/a/versionStore/lightWeightVersionStore/3b776667-a412-11dd-93f6-2da6628fc5ab/510703_P01_Basmodell.pdf and I am able to get it as a result in searches. Neither does the logger.warn appear, nodeService.exists(nodeRef) does apparently exist…

Now I start to suspect that I have to create the association in a special way when the target is in the lightWeightVersionStore and not in spacesStore.

Any suggestions?
1 REPLY 1

calle
Champ in-the-making
Champ in-the-making
I think it is a bug, posted a jira ticket here;
https://issues.alfresco.com/jira/browse/JLAN-45