cancel
Showing results for 
Search instead for 
Did you mean: 

exception in jpotts CMIS API

ashok
Champ on-the-rise
Champ on-the-rise
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/chemistry/opencmis/client/api/TransientCmisObject
   at org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl.convertObject(AlfrescoObjectFactoryImpl.java:297)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:415)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getRootFolder(SessionImpl.java:490)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getRootFolder(SessionImpl.java:484)
   at com.alfresco.cloud.example.BaseJavaExample.run(BaseJavaExample.java:133)
   at com.alfresco.cloud.example.GetSitesExample.main(GetSitesExample.java:30)
Caused by: java.lang.ClassNotFoundException: org.apache.chemistry.opencmis.client.api.TransientCmisObject
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   … 6 more


Iam getting above exception when iam trying to create folder in alfrsco cloud. Please let me know if anybody can solve it
27 REPLIES 27

jpotts
World-Class Innovator
World-Class Innovator
Ashok,

Which code are you trying to execute, which version of OpenCMIS are you using, and which version of Alfresco are you running against?

Jeff

ashok
Champ on-the-rise
Champ on-the-rise
HI Jeff thank you very much for your reply,

I resolved this exception by adding some jar files. I am using your java client code(Alfresco cloud example) which is awesome. I am using alfresco cloud 3.2. And Jeff, one more thing In your example your getting list sites only, may I know how to get list of files inside document library belongs to particular site.

I am new to alfresco, I am using (https://code.google.com/p/alfresco-api-java-examples/source/browse/alfresco-cloud-example/src/main/j...) this code.

cedomir
Champ in-the-making
Champ in-the-making
Hi Ashok,
I got the same NoClassDefFoundError, which jars did you add?

Thanks, ceodmir

jpotts
World-Class Innovator
World-Class Innovator
Everything in a documentLibrary folder belongs to the site the documentLibrary folder is sitting in. So if you have a reference to the documentLibrary folder, you can walk the tree until you get to the site folder. Conversely, if you want to find the documents for a particular site, you can get the site's documentLibrary folder and then either traverse the folder hierarchy or use getDescendents or a query with IN_TREE.

Jeff

ashok
Champ on-the-rise
Champ on-the-rise
Thank you Jeff, I got list of folders inside that documentLibrary, but every time I am looping to get subfolders. is this only way to get subfolders? can't we get all subfolders in a single string(folder1/folder2/file.jpg) ?.

Thank you,
Ashok

ashok
Champ on-the-rise
Champ on-the-rise
HI Jeff, I got one doubt here, that I uploaded one pdf file into alfresco. Now I want show that file in browser from java client. Could you please explain how to do that.

Thank you,
Ashok

kaynezhang
World-Class Innovator
World-Class Innovator
You can use CMIS query language to select sub folders of your site's documentLibrary
First get your site documentLibrary folder

   AlfrescoFolder docLib = (AlfrescoFolder) session.getObjectByPath("/sites/{site short name}/documentLibrary");

Then Select all subfolders

Then select all subfolders
   String sql = "SELECT * FROM cmis:folder WHERE IN_TREE('"+docLib.getId()+"')";
   ItemIterable<QueryResult> rs = session.query(sql, false);

Then  you can get all folder properties include cmisSmiley Tongueath.

ashok
Champ on-the-rise
Champ on-the-rise
Thankyou Mr.kaynezhang

ashok
Champ on-the-rise
Champ on-the-rise
HI Jeff, I got one doubt here, that I uploaded one pdf file into alfresco. Now I want show that file in browser from java client. Could you please explain how to do that.

Thank you,
Ashok