cancel
Showing results for 
Search instead for 
Did you mean: 

InvalidNodeRefException of a node already deleted

ngiolet
Champ in-the-making
Champ in-the-making
I have developed a Java Web application which use Alfresco APIs for menaging content.
Assuming that the application use Alfresco database I have the following problem.

When I create a new document from the application which I developed, the document itself is correctly founded after login in Alfresco.
Instead when I delete a document directly from Alfresco and navigate to the page, of my web application, corresponding to the space where the file resides, I get the following message:Node does not exist: workspace://SpacesStore/…(node ID).
In addition the log file of my application shows org.alfresco.service.cmr.repository.InvalidNodeRefException.
It is as if for my application the document still exists. :shock:
I need to republish my application.
I search documents in this way:

ServiceDescriptorRegistry alfrescoServiceRegistry;      
alfrescoServiceRegistry.getSearchService().query(storeRef, SearchService.LANGUAGE_LUCENE, queryPath);

I hope I was clear.
Thanks in advance for the help.
Regards,
ngiolet
6 REPLIES 6

patil
Champ on-the-rise
Champ on-the-rise
Hi ,

I guess you are not creating the document in the correct way,
Can you publish hyour code for creating the node.

Thanks,
Patil
Cignex Technologies
Bangalore

mrogers
Star Contributor
Star Contributor
There's a steady effort going on to decouple the lucene transactions from the rest of the alfresco transaction since it damages performance and scaleability.    However this has the consequence that for a short time you can find a node in lucene that has been deleted in the DB.

You can of course ignore this node and this is what should happen with the "Invalid Node Exception".

If you have a repeatable test case (in alfresco code rather than your code) then please raise it in JIRA.

corstad
Champ in-the-making
Champ in-the-making
mrogers:

We are having a similar problem with the Lucene returning nodes that have been deleted using NodeService's deleteNode method.

Our scenario:
Transaction 1 creates a temporary node and makes an additional association(s) (using createAssociation) to a third  node (or possibly several other nodes).
Transaction 2 makes changes to child nodes of the third node, removes the additional association created in transaction 1 and determines if the temporary node can be deleted by determining if any of the additional associations still exist. If the temporary node can be deleted, it is at the end of transaction 2.

Now after the temporary node has been deleted, it still is returned by Lucene queries and when our code attempts to retrieve properties from the node an InvalidNodeRefException is thrown.

Since the application has the potential to create several thousand of these temporary nodes per day, how can we exclude these from being included in Lucene indexes or how can we force Lucene to recognize the node no longer exists?

We are using community edition 3.4.c

Thanks,

Cully Orstad

mrogers
Star Contributor
Star Contributor
You don't say where your transaction boundaries are with regard to reading the deleted node.

If you are still in the same transaction that does the delete then lucene will still find it because the delete has not yet been committed, however it will not make sense to try and read the properties,   the node service will detect that you are trying to read a deleted node.   If you are in the next transaction (T3) then there may be a small window while the indexer does its stuff.

The stack trace would give some information about what is going on.

corstad
Champ in-the-making
Champ in-the-making
The query that is returning the references to invalid nodes is in a third transaction. It has been three days since I deleted the node and it still appears in the query results. Something isn't working correctly.

Any ideas?

Stack Trace from running application:

ERROR AbstractRuntime Exception from executeScript - redirecting to status template error: 02280001 Node does not exist: workspace://SpacesStore/a9226400-f7af-474c-adb2-83efa8d95309
org.springframework.extensions.webscripts.WebScriptException: 02280001 Node does not exist: workspace://SpacesStore/a9226400-f7af-474c-adb2-83efa8d95309
   at com.merrillcorp.datasite.response.ExceptionResponseBuilder.buildExceptionResponse(ExceptionResponseBuilder.java:93)
   at com.merrillcorp.datasite.webscript.WebScriptValidator.execute(WebScriptValidator.java:87)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:336)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:466)
   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:304)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)
   at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   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:58)
   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.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
   at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:864)
   at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
   at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1665)
   at java.lang.Thread.run(Thread.java:662)
Caused by: org.alfresco.service.cmr.repository.InvalidNodeRefException: Node does not exist: workspace://SpacesStore/a9226400-f7af-474c-adb2-83efa8d95309
   at org.alfresco.repo.node.db.DbNodeServiceImpl.getNodePairNotNull(DbNodeServiceImpl.java:142)
   at org.alfresco.repo.node.db.DbNodeServiceImpl.hasAspect(DbNodeServiceImpl.java:902)
   at sun.reflect.GeneratedMethodAccessor218.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:307)
   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:104)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy7.hasAspect(Unknown Source)
   at sun.reflect.GeneratedMethodAccessor218.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 $Proxy8.hasAspect(Unknown Source)
   at org.alfresco.repo.node.MLPropertyInterceptor.getPivotNodeRef(MLPropertyInterceptor.java:321)
   at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:171)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:212)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:212)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy7.getProperties(Unknown Source)
   at sun.reflect.GeneratedMethodAccessor261.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:307)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
   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:44)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.audit.AuditMethodInterceptor.proceedWithAudit(AuditMethodInterceptor.java:217)
   at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:184)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:137)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy7.getProperties(Unknown Source)
   at com.merrillcorp.datasite.json.generator.AbstractJSONGenerator.initializeJSONObject(AbstractJSONGenerator.java:101)
   at com.merrillcorp.datasite.json.generator.JSONGeneratorContentImpl.generateJSON(JSONGeneratorContentImpl.java:49)
   at com.merrillcorp.datasite.webscript.content.ContentList.doWebScript(ContentList.java:120)
   at com.merrillcorp.datasite.webscript.NodeInProjectScript.doWebScript(NodeInProjectScript.java:64)
   at com.merrillcorp.datasite.webscript.ProjectScript.doWebScript(ProjectScript.java:104)
   at com.merrillcorp.datasite.webscript.WebScriptValidator$1.execute(WebScriptValidator.java:76)
   at com.merrillcorp.datasite.webscript.WebScriptValidator$1.execute(WebScriptValidator.java:72)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:381)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:253)
   at com.merrillcorp.datasite.webscript.WebScriptValidator.execute(WebScriptValidator.java:72)
   … 22 more

Stack trace from Alfresco Node Browser when clicking on the link returned by a Lucene Query:

Search Language:   lucene
Search:   PRIMARYPARENT:"workspace://SpacesStore/376e9e3e-51cb-4800-a692-771a84f32eed" AND NOT ( TYPE:"{http://www.merrill.com/datasite/docs/1.0}archiveRoot" )

javax.faces.FacesException: javax.faces.FacesException: Could not retrieve value of component with path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/admin/node-browser.jsp][Class: javax.faces.component.html.HtmlForm,Id: searchForm][Class: javax.faces.component.html.HtmlCommandLink,Id: selectPrimaryPath][Class: javax.faces.component.html.HtmlOutputText,Id: primaryPath]}
caused by:
org.apache.jasper.JasperException: javax.faces.FacesException: Could not retrieve value of component with path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/admin/node-browser.jsp][Class: javax.faces.component.html.HtmlForm,Id: searchForm][Class: javax.faces.component.html.HtmlCommandLink,Id: selectPrimaryPath][Class: javax.faces.component.html.HtmlOutputText,Id: primaryPath]}
caused by:
javax.faces.FacesException: Could not retrieve value of component with path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/admin/node-browser.jsp][Class: javax.faces.component.html.HtmlForm,Id: searchForm][Class: javax.faces.component.html.HtmlCommandLink,Id: selectPrimaryPath][Class: javax.faces.component.html.HtmlOutputText,Id: primaryPath]}
caused by:
javax.faces.el.EvaluationException: Cannot get value for expression '#{AdminNodeBrowseBean.primaryPath}'
caused by:
javax.faces.el.EvaluationException: Exception getting value of property primaryPath of base of type : org.alfresco.web.bean.admin.AdminNodeBrowseBean
caused by:
javax.faces.el.EvaluationException: Bean: org.alfresco.web.bean.admin.AdminNodeBrowseBean, property: primaryPath
caused by:
java.lang.reflect.InvocationTargetException
caused by:
org.alfresco.service.cmr.repository.InvalidNodeRefException: Node does not exist: workspace://SpacesStore/a9226400-f7af-474c-adb2-83efa8d95309

toadybear
Champ in-the-making
Champ in-the-making
We are seeing the same behavior on two different Alfresco systems. We can't afford to do a "full" index every time we see the problem.

Weird thing is that the Node Browser returns the correct UUID and the Lucene API calls do not.