AnsweredAssumed Answered

Issue with Repository connection using Apache Chemistry APIs

Question asked by mandarj on Aug 2, 2012
Latest reply on Aug 4, 2012 by mandarj
Hi,

I am trying use Apache Chemistry client APIs (0.3.0 also tried 0.7.0) to connect to repository through CMIS. I tried with below code but I am not able to establish a connection to repository. I am not sure why its not creating a session. Can somebody help me in this?

The Repository I'm trying to connect is: Alfresco 3.4.1 enterprise

   try {
      log.debug("Step-1");
      SessionFactory factory = SessionFactoryImpl.newInstance();
      log.debug("Step-2");
      Map<String, String> parameter = new HashMap<String, String>();
      log.debug("Step-3");
      parameter.put(SessionParameter.USER, "{username}");
      log.debug("Step-4");
      parameter.put(SessionParameter.PASSWORD, "{password}");
      log.debug("Step-5");
      parameter.put(SessionParameter.ATOMPUB_URL, "http://hostname:8080/alfresco/cmisatom");
      log.debug("Step-6");
      parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
      log.debug("Step-7");
      parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
      log.debug("Step-8");
      List<Repository> repositories = factory.getRepositories(parameter);
      log.debug("Step-9");
      Session session = repositories.get(0).createSession();
      log.debug("Step-10");
      log.debug("Connected to repository:" + repositories.get(0).getId());
      Folder root = session.getRootFolder();
      log.debug("Step-11");
   }
   catch(CmisBaseException Excep) {
      log.debug("Error: " + Excep.getErrorContent());
   }

It doesn't throw any exception. So, I added a logging steps as above and it looks like it gets stuck at
List<Repository> repositories = factory.getRepositories(parameter);


The logger says:

   Log:
   Step-1
   Step-2
   Step-3
   Step-4
   Step-5
   Step-6
   Step-7
   Step-8
   Error: null

Can you help me to solve this issue?

Thanks,
Mandar

Outcomes