I am connecting to Alfresco using the below Chemistry CMIS code
final SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
// prepare connection parameters
final Map<String, String> connectionParameters = new HashMap<String, String>();
// User credentials.
connectionParameters.put(SessionParameter.USER,"******");
connectionParameters.put(SessionParameter.PASSWORD,"*****");
// Connection settings.
connectionParameters.put(SessionParameter.ATOMPUB_URL,"https://******/alfresco/api/-default-/public/cmis/versions/1.1/atom");
connectionParameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
connectionParameters.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
session = sessionFactory.getRepositories(connectionParameters).get(0).createSession();
I am using
<dependency>
<groupId>org.apache.chemistry.opencmis</groupId>
<artifactId>chemistry-opencmis-client-impl</artifactId>
<version>1.0.0</version>
</dependency>
to connect to it but getting the below error
Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisServiceUnavailableException: Service Unavailable
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:518)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.read(AbstractAtomPubService.java:701)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getRepositoriesInternal(AbstractAtomPubService.java:873)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:66)
at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:92)
at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:120)
at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:107)
at com.ge.dms.batch.TestAPP.main(TestAPP.java:71)
Please help.
The issue was due to an unstable alfresco installed in AWS. When the Alfresco was reinstalled correctly the above code work fine.