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

sepgs2004
Star Contributor
Star Contributor
Alfresco 5.0.d 64 bit open source version

Libraries in maven pom:

<dependency>
<groupId>org.apache.chemistry.opencmis</groupId>
<artifactId>chemistry-opencmis-client-api</artifactId>
<version>0.13.0</version>
</dependency>

<dependency>
<groupId>org.apache.chemistry.opencmis</groupId>
<artifactId>chemistry-opencmis-client-impl</artifactId>
<version>0.13.0</version>
</dependency>

<dependency>
<groupId>org.alfresco.cmis.client</groupId>
<artifactId>alfresco-opencmis-extension</artifactId>
<version>0.3</version>
</dependency>


Code:

SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
          
Map<String, String> parameter = new HashMap<String, String>();
parameter.put(SessionParameter.USER, config.getUserName());
parameter.put(SessionParameter.PASSWORD, config.getPassword());
parameter.put(SessionParameter.ATOMPUB_URL, config.getHost());
parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");

List<Repository> repositories = new ArrayList<Repository>();
repositories = sessionFactory.getRepositories(parameter);
cmisRepository = repositories.get(0);

parameter.put(SessionParameter.REPOSITORY_ID, cmisRepository.getId());
cmisSession = sessionFactory.createSession(parameter);
siteObject = cmisSession.getObjectByPath("/Sites/mysite");


Error:
<strong>
Caused by: java.lang.NoClassDefFoundError: org/apache/chemistry/opencmis/client/api/TransientCmisObject
   at org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl.convertObject(AlfrescoObjectFactoryImpl.java:297) [alfresco-opencmis-extension-0.3.jar:]
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObjectByPath(SessionImpl.java:560) [chemistry-opencmis-client-impl-0.13.0.jar:0.13.0]
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObjectByPath(SessionImpl.java:534) [chemistry-opencmis-client-impl-0.13.0.jar:0.13.0]
   at com.sa.v4.dms.services.impl.AlfrescoCMISOpenWSProxyAdapter.initialize(AlfrescoCMISOpenWSProxyAdapter.java:116) [mlodocEJB.jar:]
   at com.sa.v4.dms.services.DmsServicesAdapterFactory.getDmsServicesAdapter(DmsServicesAdapterFactory.java:22) [mlodocEJB.jar:]
   at com.sa.v4.dms.DocumentRepositoryBean.ejbCreate(DocumentRepositoryBean.java:50) [mlodocEJB.jar:]
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_80]
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_80]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_80]
   at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.7.0_80]
</strong>
Gnanasekaran Sakthivel


<dependency>
   <groupId>org.alfresco.cmis.client</groupId>
   <artifactId>alfresco-opencmis-extension</artifactId>
   <version>0.2</version>
</dependency>


<strong>
Caused by: java.lang.ClassNotFoundException: org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl from [Module "deployment.mlodoc.ear:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

at org.apache.chemistry.opencmis.commons.impl.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:38)
at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createObjectFactory(SessionImpl.java:231)
</strong>
Gnanasekaran Sakthivel


<dependency>
  <groupId>org.apache.chemistry.opencmis</groupId>
  <artifactId>chemistry-opencmis-client-api</artifactId>
  <version>0.12.0</version>
</dependency>

<dependency>
<groupId>org.apache.chemistry.opencmis</groupId>
<artifactId>chemistry-opencmis-client-impl</artifactId>
<version>0.12.0</version>
</dependency>
<!–  For alfresco aspect support –>
<dependency>
  <groupId>org.alfresco.cmis.client</groupId>
  <artifactId>alfresco-opencmis-extension</artifactId>
  <version>0.3</version>
</dependency>


Exception
<strong>
Caused by: java.lang.NoClassDefFoundError: org/apache/chemistry/opencmis/client/api/TransientCmisObject
   at org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl.convertObject(AlfrescoObjectFactoryImpl.java:297) [alfresco-opencmis-extension-0.3.jar:]
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObjectByPath(SessionImpl.java:560) [chemistry-opencmis-client-impl-0.12.0.jar:0.12.0]
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObjectByPath(SessionImpl.java:534) [chemistry-opencmis-client-impl-0.12.0.jar:0.12.0]
</strong>
Gnanasekaran Sakthivel

I saw in some tutorial/online material, that this classSmiley Surprisedrg.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl will be helpful in accessing Aspects. Now, from the above exceptions, we see that this class is available in the following (0.3 version of this) library:

<dependency>
  <groupId>org.alfresco.cmis.client</groupId>
  <artifactId>alfresco-opencmis-extension</artifactId>
  <version>0.3</version>
</dependency>



However, using the class (AlfrescoObjectFactoryImpl), expects TransientCmisObject class. Now both 0.12 and 0.13 versions of chemistry-opencmis-client-api/chemistry-opencmis-client-impl seem to not have this class at all.

Can you recommend a way to access Aspects and the values of the aspect properties of a document?

Thank you.
Gnanasekaran Sakthivel

mrogers
Star Contributor
Star Contributor
The alfresco open cmis extension is obsolete and not needed since CMIS now contains the functionality to access "secondary types".

If you are insistent on using the alfresco-opencmis-extension then you need the version I fixed, as you have seen version 0.3 doesn't work with more recent versions of chemistry. 

I suggest you try version 1.0 instead which is available from nexus.alfresco.com

I am using chemistry-opencmis-client-api (version 0.13.0), chemistry-opencmis-client-impl (version 0.13.0). I believe 0.13.0 is the latest as of maven repository. So I believe, as we speak, this will have aspects in the secondary types.
In the admin node browser, I used the query (cmis-alfresco): SELECT * FROM cmis:document where cmis:name = 'river.JPG'
It returns an object, and clicking upon the link, I get values for all the properties of the aspect shown. I wonder what API and call the node browser uses. It is able to bring all the properties.

Following are some notable things that I see as a result of my query in the node browser…

Type   aslmo:lmodocument
Properties:
aslmo:lmo_microfiche_roll    d:text       false
aslmo:lmo_is_placeholder    d:boolean    false





I am new to Alfresco development. I would like some help. I might find some in my search online.
In my custom model, I have a type defined, then defined an aspect with few properties, and them made this aspect as a mandatory-aspect of my type.

<model>

<types>
  <type name="aslmo:lmodocument">
    <title>…</title>
    <parent>cm:content</parent>
   
    <mandatory-aspects>
      <aspect>aslmo:documentProperties</aspect>
    </mandatory-aspects>
  </type>
</types>
<aspects>
  <aspect name="aslmo:documentProperties">
    <title>…</title>
    <properties>
      <property name="…">
        <title>…</title>
        <type>…</type>
      </property>
      …
    </properties>
  <aspect>
</aspects>
</model>



My code looks as shown below; It is just a sample code, once I know how to do it, I need to develop our API:

Document object = (Document) cmisSession.getObjectByPath(path2Object);
List<Property<?>> properties = object.getProperties();
if (properties != null) {
  for (int index=0; index<properties.size(); index++) {
   Property aProperty = properties.get(index);
   log.info("\t P QueryName    [" + aProperty.getQueryName() + "]");
   log.info("\t P Value        [" + aProperty.getValueAsString() + "]");
  }
}

log.info("Secondary Types");
List<SecondaryType> secTypes = object.getSecondaryTypes();
if (secTypes != null) {
  for (int index=0; index<secTypes.size(); index++) {
   SecondaryType aspect = secTypes.get(index);
   log.info("\t ST QueryName          [" + aspect.getQueryName());
   log.info("\t ST Discription        [" + aspect.getDescription());
}
}

However, using the above code, does not bring anything for secondary types. And the properties list does not contain any from the aslmo kind.


Can you advise me towards the right direction?
Gnanasekaran Sakthivel

rajeshsr
Champ in-the-making
Champ in-the-making
For ppl with error in the title(NoClassDefFoundError: org/apache/chemistry/opencmis/client/api/TransientCmisObject), pls remove
parameter.put(SessionParameter.OBJECT_FACTORY_CLASS…
when the session is created… thanks @mrogers for the pointer…

anon26949
Star Contributor
Star Contributor

For Alfresco Community v5.2.0 examples are working... For more details refers here: http://docs.alfresco.com/5.0/pra/1/concepts/opencmis-ext-using.html