AnsweredAssumed Answered

NoClassDefFoundError

Question asked by dawit on Aug 23, 2014
Latest reply on Aug 27, 2014 by dawit
We have an older version of alfresco (3.4a) which we can not upgrade at the moment and I am trying to use CMIS (1.0) to interact with it. The problem is I get
java.lang.NoClassDefFoundError: org/apache/chemistry/opencmis/client/runtime/objecttype/SecondaryTypeImpl

When trying to get a session. I am having hard time how this class was used. Below is my maven dependancies for the related jars. 



  <dependency>
                <groupId>org.apache.chemistry.opencmis</groupId>
                <artifactId>chemistry-opencmis-client-impl</artifactId>
                <version>0.8.0</version>
        </dependency>
         <dependency>
                <groupId>org.alfresco.cmis.client</groupId>
                <artifactId>alfresco-opencmis-extension</artifactId>
                <version>0.8</version>
              
        </dependency>
… 

And the related code for getting the session is:

SessionFactory factory = SessionFactoryImpl.newInstance();
Map<String, String> parameter = new HashMap<String, String>();

        // connection settings. Alfresco 3.4a supports only cmis 1.0
//ATOMPUB_URL = ALFRESCO_API_URL + alfresco/api/-default-/public/cmis/versions/1.0/atom
//I have also tried the following for ATOMPUT_URL
//ATOMPUB_URL = ALFRESCO_API_URL + "alfresco/service/cmis";
        log.info("getCmisSession.Atopub_Url: " + ATOMPUB_URL);
        parameter.put(SessionParameter.ATOMPUB_URL, ATOMPUB_URL);
        parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
        // We're using the Alfresco extensions
        parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");

        // User Credentials
        parameter.put(SessionParameter.USER, USER_NAME);
       parameter.put(SessionParameter.PASSWORD, PASSWORD);
List<Repository> repositories = factory.getRepositories(parameter);  //This line leads to NoClassDefFoundError Error
                Repository repo1 = repositories.get(0);
                log.warn("Got the first repository available.");
                session = repo1.createSession();



I am stuck with Alfresco 3.4a and I need some advice with version's of opencmis and extensions.
Thanks,

Outcomes