Hi,I am using Alfresco 3.2r with Tomcat 6 with JDK 1.6.I have written below code to get children of companyhome as:
StoreRef storeRef5 = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
ResultSet rs = serviceRegistry.getSearchService().query(storeRef5, SearchService.LANGUAGE_XPATH, "/app:company_home");
NodeRef companyHomeNodeRef = null;
try
{
if (rs.length() == 0)
{
throw new AlfrescoRuntimeException("Didn't find Company Home");
}
companyHomeNodeRef = rs.getNodeRef(0);
}catch (Exception e) {
logger.error("Error while getting company home "+e.getMessage());
}
List<ChildAssociationRef> children = serviceRegistry.getNodeService().getChildAssocs(companyHomeNodeRef);
for (ChildAssociationRef childAssoc : children) {
NodeRef childNodeRef = childAssoc.getChildRef();
logger.debug("childNodeRef "+" "+childNodeRef.getId()+childNodeRef.getStoreRef());
}While i am trying to invoke it, i am getting below error :net.sf.acegisecurity.AuthenticationCredentialsNotFoundException: A valid SecureContext was not provided in the RequestContext
at net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.credentialsNotFound(AbstractSecurityInterceptor.java:477)
at net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:355)
at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:77)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.alfresco.repo.audit.AuditMethodInterceptor.proceedWithAudit(AuditMethodInterceptor.java:238)
at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:205)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:153)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy27.query(Unknown Source)
at com.xxxx.alfresco.km.constraints.CommunitySearchConstraint.getAllowedValues(CommunitySearchConstraint.java:182)
at org.alfresco.cmis.dictionary.CMISBasePropertyDefinition.<init>(CMISBasePropertyDefinition.java:108)
at org.alfresco.cmis.dictionary.CMISAbstractTypeDefinition.createProperty(CMISAbstractTypeDefinition.java:126)
at org.alfresco.cmis.dictionary.CMISAbstractTypeDefinition.createProperties(CMISAbstractTypeDefinition.java:104)…..
Line no 182 says:ResultSet rs = serviceRegistry.getSearchService().query(storeRef5, SearchService.LANGUAGE_XPATH, "/app:company_home");
I can assume that it is related to service dependency injection but not getting how to resolve it.Can anybody tell me how to achieve this: maybe by making my class as managed bean & injecting searchservice in faces-config-beans.xml??? :? Is there any generic way that i can get any service without any error outside of alfresco i.e. my custom code? Any idea?Is there any change in way to get services in 3.2+?