cancel
Showing results for 
Search instead for 
Did you mean: 

NoClassDefFoundError

dawit
Champ in-the-making
Champ in-the-making
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,
4 REPLIES 4

kaynezhang
World-Class Innovator
World-Class Innovator
Please try a new version apache chemistry opencmis,for example 0.11.0

dawit
Champ in-the-making
Champ in-the-making
I tried the 0.11.0 version  but that one resulted to another NoCkassDefFoundError as:

java.lang.NoClassDefFoundError: org/apache/chemistry/opencmis/commons/enums/CmisVersion
   at org.apache.chemistry.opencmis.commons.impl.CmisEnumHelper.fromValue(CmisEnumHelper.java:68)
   at org.apache.chemistry.opencmis.commons.impl.XMLWalker.readEnum(XMLWalker.java:248)
   at org.apache.chemistry.opencmis.commons.impl.XMLConverter$2.read(XMLConverter.java:1239)
   at org.apache.chemistry.opencmis.commons.impl.XMLConverter$2.read(XMLConverter.java:1227)
   at org.apache.chemistry.opencmis.commons.impl.XMLWalker.walk(XMLWalker.java:55)
   at org.apache.chemistry.opencmis.commons.impl.XMLConverter$1.read(XMLConverter.java:1177)
   at org.apache.chemistry.opencmis.commons.impl.XMLConverter$1.read(XMLConverter.java:1126)
   at org.apache.chemistry.opencmis.commons.impl.XMLWalker.walk(XMLWalker.java:55)


The maven dependancy that I used is :

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

kaynezhang
World-Class Innovator
World-Class Innovator
This class dose exist in 0.11.0 version. it is packaged in chemistry-opencmis-commons-api-0.11.0.jar. Have you removed 0.8.0 version from your classpath?

dawit
Champ in-the-making
Champ in-the-making
Thanks Kaynezhang. There was an older cmis jar in my classpath. It is working now after removing it.