cancel
Showing results for 
Search instead for 
Did you mean: 

CMIS query throws an exception

vinitp
Champ in-the-making
Champ in-the-making
Hello,
I am trying to use CMIS query to retrieve list of documents in the repository (Alfresco enterprise 4.0.1) using the following code:

                         ItemIterable<QueryResult> results = util.getSession().query("select cmis:name from cmis:document", false);
              for(QueryResult hit: results) { 
                  for(PropertyData<?> property: hit.getProperties()) {

                      String queryName = property.getQueryName();
                      Object value = property.getFirstValue();

                      System.out.println(queryName + ": " + value);
                  }
              }

However, it throws this exception:

Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: Internal Server Error
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:452)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:570)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.DiscoveryServiceImpl.query(DiscoveryServiceImpl.java:142)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl$3.fetchPage(SessionImpl.java:557)
   at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(AbstractIterator.java:132)
   at org.apache.chemistry.opencmis.client.runtime.util.CollectionIterator.hasNext(CollectionIterator.java:48)
   at eeoc.gov.ecm.util.cmis.CmisUtil.main(CmisUtil.java:155)


Am I missing something?
Thanks,

UPDATE: While browsing this forum, I came across a posting where someone recommended to use "http://localhost:8080/alfresco/cmisatom" instead of "http://localhost:8080/alfresco/service/cmis" for ATOMPUB. This how I get a session:
                Map<String, String> parameter = new HashMap<String, String>();
      parameter.put(SessionParameter.USER, userId);
      parameter.put(SessionParameter.PASSWORD, password);
      parameter.put(SessionParameter.ATOMPUB_URL, ALFRSCO_ATOMPUB_URL);
      parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
      //parameter.put(SessionParameter.REPOSITORY_ID, REPOSITORY_ID);
      List<Repository> repositories = sessionFactory.getRepositories(parameter);
      session = repositories.get(0).createSession();

After changing the URL to "http://localhost:8080/alfresco/cmisatom" gives a different exception which  is:

Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: 092316733
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:452)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:570)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.DiscoveryServiceImpl.query(DiscoveryServiceImpl.java:142)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl$3.fetchPage(SessionImpl.java:557)
   at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(AbstractIterator.java:132)
   at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getTotalNumItems(AbstractIterator.java:70)
   at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterable.getTotalNumItems(AbstractIterable.java:94)
   at eeoc.gov.ecm.util.cmis.CmisUtil.main(CmisUtil.java:156)
7 REPLIES 7

jeffreydare
Champ in-the-making
Champ in-the-making
Hey!

Even I am hitting the same exception. Also, the number keeps incrementing every time. Smiley Happy Smiley Happy

jeffreydare
Champ in-the-making
Champ in-the-making

rubys00
Champ in-the-making
Champ in-the-making
yeah, it helped me!

jkonar
Champ in-the-making
Champ in-the-making
good to know! thxSmiley Happy

robaczka
Champ in-the-making
Champ in-the-making
have you got any other ideas?

avik84
Champ in-the-making
Champ in-the-making

https://forums.alfresco.com/en/viewtopic.php?f=45&t=45962 this link is not opening for me. Can anyone please provide the solution? 

aowian
Confirmed Champ
Confirmed Champ

Please anyone with the solution, please re-post it here.