Search code examples
javaalfrescocmis

Could not able to find root directory (Company Home) in alfresco


I am searching "/Company Home" root directory from the repository. I did the following way CmisObject object = session.getObjectByPath(objectPath, OperationContext) where objectPath is="/Company Home/Tests-folder" but after executing above code got the following exception:

org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Object not found: /Company Home/Tests-folder at org.alfresco.opencmis.AlfrescoCmisServiceImpl.getObjectByPath(AlfrescoCmisServiceImpl.java:2077) at sun.reflect.GeneratedMethodAccessor572.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.alfresco.repo.transaction.RetryingTransactionInterceptor$1.execute(RetryingTransactionInterceptor.java:79) at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:457) at org.alfresco.repo.transaction.RetryingTransactionInterceptor.invoke(RetryingTransactionInterceptor.java:69) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.alfresco.opencmis.AlfrescoCmisStreamInterceptor.invoke(AlfrescoCmisStreamInterceptor.java:72) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.alfresco.opencmis.AlfrescoCmisServiceInterceptor.invoke(AlfrescoCmisServiceInterceptor.java:101) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.alfresco.opencmis.AlfrescoCmisExceptionInterceptor.invoke(AlfrescoCmisExceptionInterceptor.java:83) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy328.getObjectByPath(Unknown Source)

I searched in the repository using node UUID like session.getObject("2dc70dba-1cd1-4b36-84ff-ee4f17e981cb").getName(); and it returns the "Company Home" directory name. I would like to know why it is not searching directory "Company Home" using session.getObjectByPath("/Company Home/Tests-folder") method? But I can access the "/Tests-folder".


Solution

  • Company Home is the root of your repository. So if Tests-folder lives in the root, the correct way to use getObjectByPath would be session.getObjectByPath("/Tests-folder").