alfrescocmisopencmisdotcmis

GetContentChanges returns "Unauthorized"


I get ChangeLog changes from Alfresco 4.2.0 over DotCMIS+HTTPS like this:

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

session.GetContentChanges(lastTokenOnClient, includeProperties, maxNumItems);

While it usually works, sometimes it starts giving this error (client side):

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

And this error appears on the Alfresco side:

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$2.execute(RepositoryContainer.java:337)
    at org.alfresco.repo.web.scripts.RepositoryContainer$2.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)

I fail to see how a call to GetContentChanges would be successful for a few minutes but then start returning Unauthorized, in the same session.

Am I doing something wrong?


Solution

  • The problem was that the old CMIS URL http://[host]:[port]/alfresco/cmisatom was used.

    Solution:

    Replacing that URL in the configuration with the new CMIS URL http://[host]:[port]/alfresco/api/-default-/public/cmis/versions/1.0/atom solved the problem.