AnsweredAssumed Answered

Fetch all secondary types from repository using CMIS getTypeDefinition

Question asked by kartech11 on Aug 31, 2018
Latest reply on Sep 3, 2018 by kartech11

I am trying to get all the type definitions (specifically aspects, so they are secondary types) from the repository.I am connecting to a locally started bootstrap jar projects that starts up alfresco on localhost:8080. 


So far connecting to this alfresco has been working fine, and I have been able to create documents, folders etc on my localhost:8080 alfresco instance. 


My code does not seem to work as I get the below error. Please can you let me know what the issue could be and how do I get all the secondary type definitions (alfersco aspects) from the repository?


Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Type '-default-' is unknown!
at org.apache.chemistry.opencmis.client.bindings.spi.browser.AbstractBrowserBindingService.convertStatusCode(


String user = "admin";
String pwd = "admin";
String serviceUrl = "http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser";
Session session = SessionManager.getInstance().createSession(new SessionContext(user, pwd, serviceUrl));
SearchService.searchDocuments(session, null);


 public static List<Document> searchDocuments(Session session, SearchTerms searchTerms) {
//        ObjectType typeDefinition = session.getTypeDefinition(session.getRepositoryInfo().getId());

        String repoId = session.getRepositoryInfo().getId();
        ObjectType typeDefinition1 = session.getTypeDefinition(repoId);

        return null;


public Session createSession(SessionContext context){
    try {
        String user = context.getUser();
        SessionFactory factory = SessionFactoryImpl.newInstance();
        Map<String, String> parameters = new HashMap<>();
        parameters.put(SessionParameter.USER, context.getUser());
        parameters.put(SessionParameter.PASSWORD, context.getPassword());
        parameters.put(SessionParameter.BROWSER_URL, context.getServiceUrl());
        parameters.put(SessionParameter.BINDING_TYPE, BindingType.BROWSER.value());
        List<Repository> repositories = factory.getRepositories(parameters);
        Session session = repositories.get(0).createSession();
        sessions.put(user, session);
        return session;
    }catch(CmisConnectionException e) {
        // The server is unreachable
    catch(CmisRuntimeException e) {
        // The user/password have probably been rejected by the server.
    return null;