AnsweredAssumed Answered

CmisRuntimeException: When executing query.

Question asked by dawit on Aug 27, 2014
Latest reply on Aug 28, 2014 by dawit
I am trying to invoke a query to get me all the documents in a folder but when I try yo iterate through the result, I get the following CmisRuntimeException (Internal Server Error) without any clue as to what caused it in the log. I would appreciate if I could get some help in resolving this issue.

Caused by: org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: Internal Server Error
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.DiscoveryServiceImpl.query(
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl$3.fetchPage(
   at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(
   at org.apache.chemistry.opencmis.client.runtime.util.CollectionIterator.hasNext(

Below I put the relevant code I used to execute the query: [Please note that I am forced to use Alfresco 3.4a and can not upgrade at the moment.]
In getting the session, I used
for the ATOMPUB_URL path.

    try {
         cmisSession = getCmisSession();
         // Get Content Type Definition
         String contentTypeString = "cmis:document";
         ObjectType contentType = cmisSession.getTypeDefinition(contentTypeString);
         // Get Object Id Property Definition
         PropertyDefinition<?> objectIdPropDef = contentType.getPropertyDefinitions().get(PropertyIds.OBJECT_ID);
         String objectIdQueryName = objectIdPropDef.getQueryName();
         // Define CMIS Query - Get all document IN_FOLDER
         //Please note the difference of IN_FOLDER (immediate children) vs IN_TREE (matches any object beneath the folder)
                  String cquery =
                     "SELECT " + objectIdQueryName +
                           " FROM " + contentType.getQueryName() +
                           " WHERE IN_FOLDER('" + folderId + "')";
         List<com.XXXX.model.v3.Document> docs = new ArrayList<com.XXXX.model.v3.Document>();
         OperationContext oc = new OperationContextImpl();
         // The second param of query(boolean) if set to true will search all
         // the previous versions.Alfresco does not support searching older version and only false
         // is valid (See page 340 Alfresco-3-Web-Services book               
         ItemIterable<QueryResult> results = cmisSession.query(cquery, false , oc);
         for (QueryResult qResult : results) { //THIS IS THE LINE I GET CMISRUNTIMEEXCEPTION —-
            String objectId = qResult
            Document doc = (Document) cmisSession.getObject(cmisSession
         return docs;
      } catch (CmisBaseException cmisBE) {
         throw new ApiBusinessException("Could  not retreive documents",