I am using chemistry opencmis version 0.13.0 to connect to alfresco repository.Below is the code snippet
Map<String, String> parameter = new HashMap<String, String>();
// user credentials
parameter.put(SessionParameter.USER, "admin");
parameter.put(SessionParameter.PASSWORD, "admin");
// connection settings
parameter.put(SessionParameter.ATOMPUB_URL, "http://localhost:8080/alfresco/cmisatom");
parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
// set the alfresco object factory
parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
// create session
SessionFactory factory = SessionFactoryImpl.newInstance();
Session session = factory.getRepositories(parameter).get(0).createSession();
I am able to create a session but when the do the below operation
session.getRootFolder();
I am getting the below exception
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 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:523) at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getRootFolder(SessionImpl.java:735) at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getRootFolder(SessionImpl.java:729) at cmisops.CMISConnect.main(CMISConnect.java:60) Caused by: java.lang.ClassNotFoundException: org.apache.chemistry.opencmis.client.api.TransientCmisObject at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 5 more
I am using chemistry-opencmis-client-api-0.13.0,chemistry-opencmis-client-bindings-0.13.0,chemistry-opencmis-client-impl-0.13.0,chemistry-opencmis-commons-api-0.13.0,chemistry-opencmis-commons-impl-0.13.0,alfresco-opencmis-extension-0.3
I am using Alfresco enterprise 5.0 version.
Try using this endpoint instead of the one you're using:
http://<hostname>:<port>/alfresco/api/-default-/public/cmis/versions/1.1/atom
and please refer to this page to adress any cmis binding issue in alfresco.
UPDATE : The OP solved the issue by setting a repository id in his session parameters.