cancel
Showing results for 
Search instead for 
Did you mean: 

Get CmisObject from Custom model query - EXCEPTION: TransientCmisObject

pajumbo
Confirmed Champ
Confirmed Champ
Hi everyone,

I'm tring to get a CustomModel document serching it from "name"

and i'm getting the following exception:

java.lang.NoClassDefFoundError: org/apache/chemistry/opencmis/client/api/TransientCmisObject


I try with the newest CMIS versions (10, 11 ,13 )


      protected CmisObject searchDocumentByName( String fileName ){
      String queryString = "select * from kd:doc where "+PropertyIds.NAME+" = '"+fileName+"'";
       ItemIterable<QueryResult> results = getSession().query(queryString, false);
       
      CmisObject checkingDocument = null;
       for (QueryResult qResult : results) {
          String objectId = "";
          PropertyData<?> propData = qResult.getPropertyById("cmis:objectId"); // Atom Pub binding
          if (propData != null) {
             objectId = (String) propData.getFirstValue();
          } else {
             objectId = qResult.getPropertyValueByQueryName("d.cmis:objectId"); // Web Services binding
          }
          checkingDocument = getSession().getObject(getSession().createObjectId(objectId));
       }
      return checkingDocument;
   }




I'm using the Alfresco Community v5.0.0

4 REPLIES 4

mrogers
Star Contributor
Star Contributor
I suspect there is something else going on that you have not described,  chemistry removed that class a few years ago.

I've seen that error before, you may be using an obsolete incompatible version of the alfresco open cmis connector.

i'm usinge the alfresco-opencmis-extension-0.7
UPDATE:
I made the connection in this way:


            SessionFactory factory = SessionFactoryImpl.newInstance();
            Map<String, String> parameter = new HashMap<String, String>();
            // user credentials
            parameter.put(SessionParameter.USER, user);
            parameter.put(SessionParameter.PASSWORD, password);
            // connection settings
            parameter.put(SessionParameter.ATOMPUB_URL, "http://'+urlAlfresco+'/alfresco/api/-default-/public/cmis/versions/1.1/atom/");
            parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
            parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
            //if the repository id is unknown : gets the list of all available repositories and connects to the first one.
            List<Repository> repositories = factory.getRepositories(parameter);
            this.session = repositories.get(0).createSession();

mrogers
Star Contributor
Star Contributor
That's your problem then.  Try version 1.0.

Or don't use the extension at all,  its obsolete with CMIS 1.1

for now i solved adding the chemistry-opencmis-client-api-0.5.0.jar