GetContentChanges returns "Unauthorized"

GetContentChanges returns "Unauthorized"

我通过 DotCMIS+HTTPS 从 Alfresco 4.2.0 获取 ChangeLog 更改,如下所示:

string lastTokenOnClient = "1857698"; // actually updated using last token
boolean includeProperties = false;
int maxNumItems = 100;

session.GetContentChanges(lastTokenOnClient, includeProperties, maxNumItems);

虽然它通常有效,但有时它会开始出现此错误(客户端):

CmisSync.Lib.Cmis.BaseException: Unauthorized ---> DotCMIS.Exceptions.CmisRuntimeException: Unauthorized
at DotCMIS.Binding.AtomPub.AbstractAtomPubService.Read(UrlBuilder url) in C:\Users\win7pro32bit\Documents\GitHub\CmisSync\Extras\OpenDataSpaceDotCMIS\DotCMIS\binding\atompub\atompub.cs:line 439
at DotCMIS.Binding.AtomPub.DiscoveryService.GetContentChanges(String repositoryId, String& changeLogToken, Nullable`1 includeProperties, String filter, Nullable`1 includePolicyIds, Nullable`1 includeAcl, Nullable`1 maxItems, IExtensionsData extension) in C:\Users\win7pro32bit\Documents\GitHub\CmisSync\Extras\OpenDataSpaceDotCMIS\DotCMIS\binding\atompub\atompub.cs:line 2708
at DotCMIS.Client.Impl.Session.GetContentChanges(String changeLogToken, Boolean includeProperties, Int64 maxNumItems, IOperationContext context) in C:\Users\win7pro32bit\Documents\GitHub\CmisSync\Extras\OpenDataSpaceDotCMIS\DotCMIS\client\client-impl.cs:line 766
at DotCMIS.Client.Impl.Session.GetContentChanges(String changeLogToken, Boolean includeProperties, Int64 maxNumItems) in C:\Users\win7pro32bit\Documents\GitHub\CmisSync\Extras\OpenDataSpaceDotCMIS\DotCMIS\client\client-impl.cs:line 758

并且这个错误出现在 Alfresco 一侧:

ERROR [extensions.webscripts.AbstractRuntime] [http-apr-8080-exec-12]
 Exception from executeScript - redirecting to status template error: 01276459
 Web Script org/alfresco/cmis/changes.get requires admin authentication;
 however, a non-admin has attempted access.
org.springframework.extensions.webscripts.WebScriptException: 01276459 Web Script org/alfresco/cmis/changes.get requires admin authentication; however, a non-admin has attempted access.
    at org.alfresco.repo.web.scripts.RepositoryContainer.execute(RepositoryContainer.java:337)
    at org.alfresco.repo.web.scripts.RepositoryContainer.execute(RepositoryContainer.java:312)
    at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:447)
    at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:354)
    at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:376)
    at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
    at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)

几分钟后我没看到对 GetContentChanges 的调用如何成功,但随后在同一会话中开始返回 Unauthorized

我是不是做错了什么?

问题是使用了旧的 CMIS URL http://[host]:[port]/alfresco/cmisatom

解决方案:

将配置中的 URL 替换为新的 CMIS URL http://[host]:[port]/alfresco/api/-default-/public/cmis/versions/1.0/atom 解决了问题。