Search code examples
javacmisopencmis

Exception with Cmis method getAllVersions: CmisNotSupportedException: Operation not supported by the repository for this object


i'm certainly desperate with this, i hope someone have some idea about what thing is missing in my server implementation of CMIS, or what is wrong in the server side.

I have implemented my Cmis server using Apache chemistry-opencmis, these are the dependencies in the pom:

<dependency>
      <groupId>org.apache.chemistry.opencmis</groupId>
      <artifactId>chemistry-opencmis-server-support</artifactId>
      <version>1.1.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.chemistry.opencmis</groupId>
      <artifactId>chemistry-opencmis-server-bindings</artifactId>
      <version>1.1.0</version>
      <exclusions>
        <exclusion> <!-- Due to GWT compiler error -->
          <groupId>asm</groupId>
          <artifactId>asm</artifactId>
        </exclusion>
      </exclusions>
 </dependency>

All seems working less when i try to call the getAllVersions method (that i have already implemented in the server side) from the client, getting this exception: CmisNotSupportedException: Operation not supported by the repository for this object!

I tested it with the following code, targeting to an existing document:

Session session = getSession();

Document doc = (Document) session.getObject("dddfd49f-ab13-435d-b65c-7e18d3bfbed3");


doc.getAllVersions();

Getting the mentioned exception. In relation with the DocumentTypeDefinitionImpl i have setIsVersionable to true:

CMIS Workbench: https://i.ibb.co/zSPCLRN/image.png

Debugging the client with the mentioned test, the problem is that never does reach the server method getAllVersions throwing the client the mentioned exception before, it tries to get this link http://localhost:8081/cmis/atom/default/versions?id=dddfd49f-ab13-435d-b65c-7e18d3bfbed3 from its links cache (it is a map) with this key version-history, but this key is not in their cache of links, this is the class i'm referring

org.apache.chemistry.opencmis.client.bindings.spi.atompub.VersioningServiceImpl

and this is just the code:

@Override
    public List<ObjectData> getAllVersions(String repositoryId, String objectId, String versionSeriesId, String filter,
            Boolean includeAllowableActions, ExtensionsData extension) {
        List<ObjectData> result = new ArrayList<ObjectData>();

        // find the link
        String link = loadLink(repositoryId, objectId, Constants.REL_VERSIONHISTORY, Constants.MEDIATYPE_FEED);

        if (link == null) {
            throwLinkException(repositoryId, objectId, Constants.REL_VERSIONHISTORY, Constants.MEDIATYPE_FEED);
        }

The method loadLink is returning null, so it launch the mentioned exception, because he does not find the mentioned link.

Even if i call the link http://localhost:8081/cmis/atom/default/versions?id=dddfd49f-ab13-435d-b65c-7e18d3bfbed3 thru the browser Chrome, it reaches correctly to the getAllVersions method in the server side, and working fine.

The exception i get is this:

org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException: Operation not supported by the repository for this object!
    at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.throwLinkException(AbstractAtomPubService.java:294)
    at org.apache.chemistry.opencmis.client.bindings.spi.atompub.VersioningServiceImpl.getAllVersions(VersioningServiceImpl.java:276)
    at org.apache.chemistry.opencmis.client.runtime.DocumentImpl.getAllVersions(DocumentImpl.java:385)
    at org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest.checkVersionHistory(AbstractSessionTest.java:1813)
    at org.apache.chemistry.opencmis.workbench.checks.ObjectComplianceCheck.run(ObjectComplianceCheck.java:55)
    at org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest.run(AbstractSessionTest.java:181)
    at org.apache.chemistry.opencmis.tck.impl.AbstractCmisTestGroup.run(AbstractCmisTestGroup.java:115)
    at org.apache.chemistry.opencmis.workbench.details.ObjectPanel$3.actionPerformed(ObjectPanel.java:346)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6539)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6304)
    at java.awt.Container.processEvent(Container.java:2239)
    at java.awt.Component.dispatchEventImpl(Component.java:4889)
    at java.awt.Container.dispatchEventImpl(Container.java:2297)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
    at java.awt.Container.dispatchEventImpl(Container.java:2283)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
    at java.awt.EventQueue$4.run(EventQueue.java:733)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
  Exception: Operation not supported by the repository for this object!

Solution

  • The server does not provide a link to the versions resource although the document is marked as versionable.

    Set the version series ID in the ObjectInfo object. That should add the missing link.