AnsweredAssumed Answered

strange errors in share

Question asked by darionis on Jun 18, 2015
Hello,

I am using foundation API to create some groups but I noticed rather strange behavior in Share's group editor. I do something like this


step 1

authorityService.createAuthority(AuthorityType.GROUP, "top");
authorityService.createAuthority(AuthorityType.GROUP, "sub");
authorityService.addAuthority("GROUP_top", "GROUP_sub");


step 2

authorityService.deleteAuthority("GROUP_top", true); //recursive delete children


So far so good. Now when I repeat step 1, it executes just fine, but then I cant open Share's group editor because of this error:


2015-06-18 21:35:45,174  ERROR [extensions.webscripts.AbstractRuntime] [http-bio-8080-exec-64] Exception from executeScript - redirecting to status template error: 05180077 Wrapped Exception (with status template): 05182087 Error during processing of the template 'get(zones) failed on instance of org.alfresco.repo.security.authority.script.ScriptGroup. See cause exception.

The failing instruction (print stack trace for 1 more):
==> #if authority.zones?exists  [in template "org/alfresco/repository/groups/authority.lib.ftl" in macro "authorityJSON" at line 15, column 12]'. Please contact your system administrator.
org.springframework.extensions.webscripts.WebScriptException: 05180077 Wrapped Exception (with status template): 05182087 Error during processing of the template 'get(zones) failed on instance of org.alfresco.repo.security.authority.script.ScriptGroup. See cause exception.

The failing instruction (print stack trace for 1 more):
==> #if authority.zones?exists  [in template "org/alfresco/repository/groups/authority.lib.ftl" in macro "authorityJSON" at line 15, column 12]'. Please contact your system administrator.
        at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:1127)
        at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:171)
        at org.alfresco.repo.web.scripts.RepositoryContainer$3.execute(RepositoryContainer.java:482)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:457)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:551)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:619)
        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:399)
        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:280)
        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:728)
        …..
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.alfresco.service.cmr.repository.TemplateException: 05182087 Error during processing of the template 'get(zones) failed on instance of org.alfresco.repo.security.authority.script.ScriptGroup. See cause exception.

The failing instruction (print stack trace for 1 more):
==> #if authority.zones?exists  [in template "org/alfresco/repository/groups/authority.lib.ftl" in macro "authorityJSON" at line 15, column 12]'. Please contact your system administrator.
        at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:221)
        at org.springframework.extensions.webscripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:955)
        at org.springframework.extensions.webscripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:267)
        at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:147)
        … 32 more
Caused by: freemarker.template.TemplateModelException: get(zones) failed on instance of org.alfresco.repo.security.authority.script.ScriptGroup. See cause exception.

The failing instruction (print stack trace for 1 more):
==> #if authority.zones?exists  [in template "org/alfresco/repository/groups/authority.lib.ftl" in macro "authorityJSON" at line 15, column 12]
        at freemarker.ext.beans.BeanModel.get(BeanModel.java:222)
        at freemarker.core.Dot._eval(Dot.java:76)
        at freemarker.core.Expression.eval(Expression.java:111)
        …..
        at freemarker.core.Environment.process(Environment.java:243)
        at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:217)
        … 35 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedMethodAccessor1137.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1276)
        at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:912)
        at freemarker.ext.beans.BeanModel.invokeThroughDescriptor(BeanModel.java:275)
        at freemarker.ext.beans.BeanModel.get(BeanModel.java:182)
        … 60 more
Caused by: org.alfresco.service.cmr.repository.InvalidNodeRefException: Node does not exist: workspace://SpacesStore/8695ca51-de9b-4101-988b-e6ab0fdee1f8 (status:Status[id=1235changeTxnId=495bea89-d0e5-4853-911b-455b179f64ed, dbTxnId=539, deleted=true])
        at org.alfresco.repo.node.db.DbNodeServiceImpl.getNodePairNotNull(DbNodeServiceImpl.java:182)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.getParentAssocs(DbNodeServiceImpl.java:1739)
        at sun.reflect.GeneratedMethodAccessor505.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1276)
        …..
        at com.sun.proxy.$Proxy34.getParentAssocs(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor505.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1276)
        at org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvocationHandler.invoke(StoreRedirectorProxyFactory.java:224)
        at com.sun.proxy.$Proxy54.getParentAssocs(Unknown Source)
        at org.alfresco.repo.security.authority.AuthorityDAOImpl.getAuthorityZones(AuthorityDAOImpl.java:1437)
        at org.alfresco.repo.security.authority.AuthorityServiceImpl.getAuthorityZones(AuthorityServiceImpl.java:632)
        at com.sun.proxy.$Proxy77.getAuthorityZones(Unknown Source)
        at org.alfresco.repo.security.authority.script.ScriptGroup.getZones(ScriptGroup.java:711)
        … 67 more


(I shortened stack traces for brevity)


Now, Share's group editor wont open unitl i execute step 2. Then it starts working normally. It turns out that error starts to occur if I create group that has childeren with the same name, twice. It complains that "Node does not exist" but how and why?

This is line 15 in authority.lib.ftl
<#if authority.zones?exists>

and this seems to be significant:
org.alfresco.repo.security.authority.AuthorityDAOImpl.getAuthorityZones(AuthorityDAOImpl.java:1437)
I can tell this has to do somethnig with zones but when I look through node browser my GROUP_top is in zones just like it should be.


Is there something wrong with my code?


Thanks!

Outcomes