AnsweredAssumed Answered

Issue with documents added via Share/Webdav

Question asked by lukasv on Apr 17, 2012
Latest reply on Apr 19, 2012 by lukasv
I am having trouble getting a document out of the Alfresco repository.  I am using Apache Chemistry OpenCMIS v0.6.0 against Alfresco Community 4.0d (4003) schema 5025,WAR-only, using solr.

I have three files in the repository, all of them in the path "Company Home/Sites/roiweb-file-share/Test Folder 2/", which has the "Versionable" aspect.
  • Test Text Document.txt
    • Added via CMIS

    • ObjectId: workspace: //SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9
  • Test Share Document.txt
    • Added via Alfresco Share

    • ObjectId: workspace: //SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620
  • Test WebDav Document.txt
    • Added via WebDav

    • ObjectId: workspace: //SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e
Using OpenCMIS connected to http://alfserver:8080/alfresco/service/cmis (this is deprecated, right?), all files come back fine.

Using OpenCMIS connected to http://alfserver:8080/alfresco/cmisatom, only the file added via CMIS is returned. I get "object not found" errors for the others.

I have written a simple test to demonstrate the problem.  Here is the test code in it's entirety:


public class AlfrescoTest {
   private String alfrescoUser = "svcROIWeb";
   private String alfrescoPassword = "*******";
   private String alfrescoRoot = "/Sites/roiweb-file-share";
   

   private Session getSession(String connectionString) {
      Session session = null;
      
      // default factory implementation
      SessionFactory factory = SessionFactoryImpl.newInstance();
      Map<String, String> parameters = new HashMap<String, String>();

      // user credentials
      parameters.put(SessionParameter.USER, alfrescoUser);
      parameters.put(SessionParameter.PASSWORD, alfrescoPassword);

      // connection settings
      System.out.println("ATOMPUB_URL = "+connectionString);
      parameters.put(SessionParameter.ATOMPUB_URL, connectionString);
      parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());

      // get repositories
      List<Repository> repositories = factory.getRepositories(parameters);
      session = repositories.get(0).createSession();
      
      return session;
   }
   
   @Test
   public void testGetDoc() {
      System.out.println("Testing documents added with CMIS…");
      getDoc("workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9", "http://alfserver:8080/alfresco/service/cmis");
      getDoc("workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9", "http://alfserver:8080/alfresco/cmisatom");
      
      System.out.println("Testing documents added with Alfresco Share…");
      getDoc("workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620", "http://alfserver:8080/alfresco/service/cmis");
      getDoc("workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620", "http://alfserver:8080/alfresco/cmisatom");
      
      System.out.println("Testing documents added with WebDav…");
      getDoc("workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e", "http://alfserver:8080/alfresco/service/cmis");
      getDoc("workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e", "http://alfserver:8080/alfresco/cmisatom");
   }
   
   public void getDoc(String objectId, String repoUrl) {
      try {
         Session session = getSession(repoUrl);
         
         System.out.println("Searching for document: "+objectId);
         CmisObject obj = session.getObject(objectId);
   
         if(obj instanceof Document) {
            Document doc = (Document)obj;
            printProps(doc);
         }
      } catch(CmisRuntimeException e) {
         e.printStackTrace();
         System.out.println(e.getErrorContent());
      }
      System.out.println("—————————————————");
   }
   
   private void printProps(CmisObject obj) {
      List<Property<?>> props = obj.getProperties();
      
      for(Property<?> property : props) {
         System.out.println("\t"+property.getId()+" = "+property.getValueAsString());
      }
   }
}

And here is the result of this test:


Testing documents added with CMIS…
ATOMPUB_URL = http://lnxvmalft01:8080/alfresco/service/cmis
Searching for document: workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9
   cmis:isLatestMajorVersion = true
   cmis:contentStreamLength = 44
   cmis:contentStreamId = store://2012/4/13/9/30/87091928-7af5-4072-bbc3-1d69b35bf796.bin
   cmis:versionSeriesCheckedOutBy = null
   cmis:objectTypeId = cmis:document
   cmis:versionSeriesCheckedOutId = null
   cmis:name = Test Text Document.txt
   cmis:contentStreamMimeType = text/plain
   cmis:versionSeriesId = workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9
   cmis:creationDate = Mon Apr 09 08:25:34 CDT 2012
   cmis:changeToken = null
   cmis:versionLabel = 12.0
   cmis:isLatestVersion = true
   cmis:isVersionSeriesCheckedOut = false
   cmis:lastModifiedBy = svcROIWeb
   cmis:createdBy = svcROIWeb
   cmis:checkinComment = Checked in via ROiWeb Portal by Lukas VanNoord
   cmis:objectId = workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9
   cmis:isImmutable = false
   cmis:isMajorVersion = true
   cmis:baseTypeId = cmis:document
   alfcmis:nodeRef = null
   cmis:contentStreamFileName = Test Text Document.txt
   cmis:lastModificationDate = Fri Apr 13 09:30:07 CDT 2012
—————————————————
ATOMPUB_URL = http://lnxvmalft01:8080/alfresco/cmisatom
Searching for document: workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9
   cmis:isLatestMajorVersion = false
   cmis:contentStreamLength = 44
   cmis:contentStreamId = store://2012/4/13/9/30/87091928-7af5-4072-bbc3-1d69b35bf796.bin
   cmis:objectTypeId = cmis:document
   cmis:versionSeriesCheckedOutBy = null
   cmis:versionSeriesCheckedOutId = null
   cmis:name = Test Text Document.txt
   cmis:contentStreamMimeType = text/plain
   cmis:versionSeriesId = workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9
   cmis:creationDate = Mon Apr 09 08:25:34 CDT 2012
   cmis:changeToken = null
   cmis:versionLabel = 1.0
   cmis:isLatestVersion = true
   cmis:isVersionSeriesCheckedOut = false
   cmis:lastModifiedBy = svcROIWeb
   cmis:createdBy = svcROIWeb
   cmis:checkinComment = Initial Version
   cmis:objectId = workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9;1.0
   cmis:isMajorVersion = true
   cmis:isImmutable = false
   alfcmis:nodeRef = workspace://SpacesStore/ce05803c-858f-43bb-bedf-8df0849a79f9
   cmis:baseTypeId = cmis:document
   cmis:lastModificationDate = Fri Apr 13 09:30:07 CDT 2012
   cmis:contentStreamFileName = Test Text Document.txt
—————————————————
Testing documents added with Alfresco Share…
ATOMPUB_URL = http://lnxvmalft01:8080/alfresco/service/cmis
Searching for document: workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620
   cmis:isLatestMajorVersion = false
   cmis:contentStreamLength = 43
   cmis:contentStreamId = store://2012/4/10/12/25/5c3dbdc1-5e1f-4387-aaad-5c5d129a3433.bin
   cmis:versionSeriesCheckedOutBy = null
   cmis:objectTypeId = cmis:document
   cmis:versionSeriesCheckedOutId = null
   cmis:name = Test Share Document.txt
   cmis:contentStreamMimeType = text/plain
   cmis:versionSeriesId = workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620
   cmis:creationDate = Tue Apr 10 12:25:40 CDT 2012
   cmis:changeToken = null
   cmis:versionLabel = 0.1
   cmis:isLatestVersion = true
   cmis:isVersionSeriesCheckedOut = false
   cmis:lastModifiedBy = svcROIWeb
   cmis:createdBy = svcROIWeb
   cmis:checkinComment = null
   cmis:objectId = workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620
   cmis:isImmutable = false
   cmis:isMajorVersion = false
   cmis:baseTypeId = cmis:document
   alfcmis:nodeRef = null
   cmis:contentStreamFileName = Test Share Document.txt
   cmis:lastModificationDate = Tue Apr 10 12:25:40 CDT 2012
—————————————————
ATOMPUB_URL = http://lnxvmalft01:8080/alfresco/cmisatom
Searching for document: workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620
org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: Internal Server Error
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:416)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.read(AbstractAtomPubService.java:488)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getObjectInternal(AbstractAtomPubService.java:713)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.getObject(ObjectServiceImpl.java:429)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:383)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:361)
   at AlfrescoTest.getDoc(AlfrescoTest.java:70)
   at AlfrescoTest.testGetDoc(AlfrescoTest.java:58)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
   at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
   at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
   at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
   at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
   at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
   at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
   at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
<html><head><title>Apache Tomcat/6.0.26 - Error report</title><style><!–H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}–></style> </head><body><h1>HTTP Status 500 - Object Info not found for: workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620;1.0</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Object Info not found for: workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620;1.0</u></p><p><b>description</b> <u>The server encountered an internal error (Object Info not found for: workspace://SpacesStore/f6d3c572-30ae-4755-9944-71ca25331620;1.0) that prevented it from fulfilling this request.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.26</h3></body></html>
—————————————————
Testing documents added with WebDav…
ATOMPUB_URL = http://lnxvmalft01:8080/alfresco/service/cmis
Searching for document: workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e
   cmis:isLatestMajorVersion = false
   cmis:contentStreamLength = 43
   cmis:contentStreamId = store://2012/4/17/11/17/ed038f93-893c-45b1-b727-361ce6891dc7.bin
   cmis:versionSeriesCheckedOutBy = null
   cmis:objectTypeId = cmis:document
   cmis:versionSeriesCheckedOutId = null
   cmis:name = Test WebDav Document.txt
   cmis:contentStreamMimeType = text/plain
   cmis:versionSeriesId = workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e
   cmis:creationDate = Tue Apr 17 11:17:55 CDT 2012
   cmis:changeToken = null
   cmis:versionLabel = 0.1
   cmis:isLatestVersion = true
   cmis:isVersionSeriesCheckedOut = false
   cmis:lastModifiedBy = ljvannoo
   cmis:createdBy = ljvannoo
   cmis:checkinComment = null
   cmis:objectId = workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e
   cmis:isImmutable = false
   cmis:isMajorVersion = false
   cmis:baseTypeId = cmis:document
   alfcmis:nodeRef = null
   cmis:contentStreamFileName = Test WebDav Document.txt
   cmis:lastModificationDate = Tue Apr 17 11:17:55 CDT 2012
—————————————————
ATOMPUB_URL = http://lnxvmalft01:8080/alfresco/cmisatom
Searching for document: workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e
org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: Internal Server Error
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:416)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.read(AbstractAtomPubService.java:488)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getObjectInternal(AbstractAtomPubService.java:713)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.getObject(ObjectServiceImpl.java:429)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:383)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:361)
   at AlfrescoTest.getDoc(AlfrescoTest.java:70)
   at AlfrescoTest.testGetDoc(AlfrescoTest.java:62)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
   at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
   at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
   at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
   at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
   at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
   at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
   at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
<html><head><title>Apache Tomcat/6.0.26 - Error report</title><style><!–H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}–></style> </head><body><h1>HTTP Status 500 - Object Info not found for: workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e;1.0</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Object Info not found for: workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e;1.0</u></p><p><b>description</b> <u>The server encountered an internal error (Object Info not found for: workspace://SpacesStore/67f20d6b-5e3f-4c44-a10e-74e1872eb73e;1.0) that prevented it from fulfilling this request.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.26</h3></body></html>
—————————————————

I have theory as to what my problem is…  Using the old /alfresco/service/cmis url, we recorded a bunch of objectIds in our application (external from Alfresco) and have been using them to access objects.  With the new /alfresco/cmisatom url, the objectIds have versionLabel appended to them.  It seems to me that this discrepancy between objectIds is causing problems, but I can't figure out how to get the latest Ids if Alfresco is reporting the the Id I have doesn't exist.

So, what am I doing wrong? And more importantly, how do I fix it?

Outcomes