cancel
Showing results for 
Search instead for 
Did you mean: 

Exception thrown while trying to grab a reference to the folder

amitabhb74
Champ in-the-making
Champ in-the-making

Hi,

As i am trying to work through the sample code as provided in alfresco-developer-series-tutorials by Jeff Potts. I am facing a problem while creating content programmatically. This is occurring at the line where i am trying to grab a reference to the folder where we want to create the content.

public Document createTestDoc(String docName, String contentType) {
        Session session = getSession();
        Folder folder = (Folder) session.getObjectByPath("/" + getFolderName());

         -----

         -----

}

In the argument expected by the sample application I have tried to pass the default folder "SomeCo" as mentioned in the tutorial as well as some named folders as I see in the Alfresco ProjectLibrary but each time following exception is getting thrown -

Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Object not found: /SomeCo
    at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:473)
    at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.read(AbstractAtomPubService.java:619)
    at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getObjectInternal(AbstractAtomPubService.java:842)
    at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.getObjectByPath(ObjectServiceImpl.java:628)
    at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObjectByPath(SessionImpl.java:554)
    at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObjectByPath(SessionImpl.java:532)
    at com.someco.cmis.examples.CMISExampleBase.createTestDoc(CMISExampleBase.java:93)
    at com.someco.cmis.examples.SomeCoCMISDataCreator.create(SomeCoCMISDataCreator.java:28)
    at com.someco.cmis.examples.SomeCoCMISDataCreator.main(SomeCoCMISDataCreator.java:24)


  

1 ACCEPTED ANSWER

When you say, under Documents, where exactly you are creating the folder? What I am saying is - click on Repository on top header and create a folder in it and test.

Hope this helps.

View answer in original post

4 REPLIES 4

romschn
Star Collaborator
Star Collaborator

For a simple and quick test, create a folder under Repository. Use it's name while running the code and see if it works for you or not.

Hope this helps.

amitabhb74
Champ in-the-making
Champ in-the-making

Thanks for replying. I have tried this by creating folder under Documents

but I have been getting same exception.

Regards

Amitabh

When you say, under Documents, where exactly you are creating the folder? What I am saying is - click on Repository on top header and create a folder in it and test.

Hope this helps.

amitabhb74
Champ in-the-making
Champ in-the-making

Many thanks for the input, this has solved my problem. Earlier I was trying

to create a folder within a document library for a sample site that I

created. However many thanks for your guidance.

Regards

Amitabh