Exception thrown while trying to grab a reference to the folder

cancel
Showing results for 
Search instead for 
Did you mean: 
amitabhb74
Member II

Exception thrown while trying to grab a reference to the folder

Jump to solution

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 Solution

Accepted Solutions
romschn
Senior Member

Re: Exception thrown while trying to grab a reference to the folder

Jump to solution

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 solution in original post

4 Replies
romschn
Senior Member

Re: Exception thrown while trying to grab a reference to the folder

Jump to solution

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
Member II

Re: Exception thrown while trying to grab a reference to the folder

Jump to solution

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

but I have been getting same exception.

Regards

Amitabh

romschn
Senior Member

Re: Exception thrown while trying to grab a reference to the folder

Jump to solution

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 solution in original post

amitabhb74
Member II

Re: Exception thrown while trying to grab a reference to the folder

Jump to solution

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