Home

CMIS query throws an exception

You are here

6 posts / 0 new
Last post
CMIS query throws an exception

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 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 parameter = new HashMap();
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 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)

Re: CMIS query throws an exception

Hey!

Even I am hitting the same exception. Also, the number keeps incrementing every time. :) :)

Re: CMIS query throws an exception
Re: CMIS query throws an exception

yeah, it helped me!

good to know! thx

good to know! thx:)

have you got any other ideas?

have you got any other ideas?