Cmis 方法 getAllVersions 异常:CmisNotSupportedException:此对象的存储库不支持操作

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

我当然对此很绝望,我希望有人知道我的 CMIS 服务器实现中缺少什么,或者服务器端出了什么问题。

我已经使用 Apache chemistry-opencmis 实现了我的 Cmis 服务器,这些是 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>

当我尝试从客户端调用 getAllVersions 方法(我已经在服务器端实现)时,一切似乎都不太有效,得到这个异常:CmisNotSupportedException:存储库不支持此对象的操作!

我使用以下代码测试了它,针对现有文档:

Session session = getSession();

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


doc.getAllVersions();

获取上述异常。 关于 DocumentTypeDefinitionImpl 我将 setIsVersionable 设置为 true:

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

用提到的测试调试客户端,问题是永远不会到达服务器方法 getAllVersions 之前抛出客户端提到的异常,它试图得到这个 link http://localhost:8081/cmis/atom/default/versions?id=dddfd49f-ab13-435d-b65c-7e18d3bfbed3 从其 links 缓存(它是一个地图)中使用此键 version-history,但是这个密钥不在他们 link 的缓存中,这是 class 我指的

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

这只是代码:

@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);
        }

loadLink 方法返回 null,因此它启动上述异常,因为他没有找到上述 link.

即使我通过浏览器 Chrome 调用 link http://localhost:8081/cmis/atom/default/versions?id=dddfd49f-ab13-435d-b65c-7e18d3bfbed3,它也会正确到达 getAllVersions 方法在服务器端,工作正常。

我得到的异常是这样的:

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.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.access0(EventQueue.java:97)
    at java.awt.EventQueue.run(EventQueue.java:709)
    at java.awt.EventQueue.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.run(EventQueue.java:733)
    at java.awt.EventQueue.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!

尽管文档被标记为可版本化,但服务器未向 versions 资源提供 link。

ObjectInfo对象中设置版本系列ID。那应该添加缺失的 link.