AnsweredAssumed Answered

CmisObjectNotFoundException: how to get documentLibrary folder?

Question asked by Aleksey Bykov on Oct 8, 2017
Latest reply on Oct 9, 2017 by Aleksey Bykov

I'm using Alfresco Community v5.2 and trying to create a folder on the site by using Apache Chemistry OpenCMIS API.


Let's say, the test-folder on the test site (I can create that folder in company_home). For that, I'm trying to get the root folder as follows:


private Folder getDocLibFolder(Session cmisSession) {
    String docLibPath = "...";

    // here I get the exception
    Folder docLibFolder = (Folder) cmisSession.getObjectByPath(path);

    return docLibFolder;


Paths that I tried to use:




In all cases, I get this exception (/Sites/test/test-folder - as an example here):

org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Object not found: /Sites/test/test-folder


By using the Node Browser I can see the content of the documentLibrary folder:


FROM cmis:document
WHERE CONTAINS('PATH:"/app:company_home/st:sites/cm:test/cm:documentLibrary//*"')


To get the session I'm using this method:


private Session getCmisSession() {
    SessionFactory factory = SessionFactoryImpl.newInstance();
    Map<String, String> conf = new HashMap<>();

    conf.put(SessionParameter.ATOMPUB_URL, ATOMPUB_URL);
    conf.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
    conf.put(SessionParameter.USER, USER_NAME);
    conf.put(SessionParameter.PASSWORD, PASSWORD);

    List<Repository> repositories = factory.getRepositories(conf);
    Repository cmisRepository = repositories.get(0);

    conf.put(SessionParameter.REPOSITORY_ID, cmisRepository.getId());
    cmisSession = factory.createSession(conf);

    return cmisSession;



ATOMPUB_URL == "http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom" (1.0, without 'public' too)
OBJECT_FACTORY_CLASS == "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl"


What am I doing wrong?..

I would be very grateful for the information. Thanks to all.