AnsweredAssumed Answered

Unable to create Session

Question asked by hari on Apr 27, 2015
Latest reply on May 1, 2015 by kaynezhang
Hi,

I was trying BaseOnPremExample example by Jeff Potts and ran into the below error. I get that exception from factory.getRepositories(parameter); of the below code. Please help !

——————————————————————————————————————-
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.chemistry.opencmis.client.bindings.CmisBindingFactory.createCmisAtomPubBinding(Ljava/util/Map;Lorg/apache/chemistry/opencmis/commons/spi/AuthenticationProvider;Lorg/apache/chemistry/opencmis/client/bindings/cache/TypeDefinitionCache;)Lorg/apache/chemistry/opencmis/commons/spi/CmisBinding;
   at org.apache.chemistry.opencmis.client.runtime.CmisBindingHelper.createAtomPubBinding(CmisBindingHelper.java:98)
   at org.apache.chemistry.opencmis.client.runtime.CmisBindingHelper.createBinding(CmisBindingHelper.java:56)
   at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:131)
   at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:111)
   at com.alfresco.api.example.BaseOnPremExample.getCmisSession(BaseOnPremExample.java:78)
   at com.alfresco.api.example.CmisRepositoryInfoExample.doExample(CmisRepositoryInfoExample.java:28)
   at com.alfresco.api.example.CmisRepositoryInfoExample.main(CmisRepositoryInfoExample.java:19)

———————————————————————————————————————

   public Session getCmisSession() {
      if (cmisSession == null) {
         // default factory implementation
         SessionFactory factory = SessionFactoryImpl.newInstance();
         Map<String, String> parameter = new HashMap<String, String>();
   
         // connection settings
         parameter.put(SessionParameter.ATOMPUB_URL, getAtomPubURL(getRequestFactory()));
         parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
         parameter.put(SessionParameter.AUTH_HTTP_BASIC, "true");
         parameter.put(SessionParameter.USER, getUsername());
         parameter.put(SessionParameter.PASSWORD, getPassword());
         parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
   
         List<Repository> repositories = factory.getRepositories(parameter);
   
         cmisSession = repositories.get(0).createSession();
      }
      return this.cmisSession;
   }

Outcomes