0

I have a new alfresco community version 5.0.a installation. I'm trying to use a java connector service to upload/download files that works correctly with a 4.2.c alfresco installation.

This connector application uses chemistry-opencmis-client-api-0.8.0.

When uploading a file using the connector, I open the connection, get the repository and also can get the repository root folder id correctly:

SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
Map<String, String> parameter = new HashMap<String, String>();

parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
parameter.put(SessionParameter.ATOMPUB_URL , url );
parameter.put(SessionParameter.USER        , user);
parameter.put(SessionParameter.PASSWORD    , pass);

if (repository_id != null)
    parameter.put(SessionParameter.REPOSITORY_ID, repository_id);

List<Repository> repos = sessionFactory.getRepositories(parameter);     
Repository repo = repos.get(0);
log.debug("REPO ID: " + repo.getId());
log.debug("REPO ROOT FOLDER ID: " + repo.getRootFolderId());        

Then I create the session:

Session session = repo.createSession();

But when I want to get the root folder object:

Folder folder = session.getRootFolder();

I get a "CmisObjectNotFoundException: Unknown repository" error:

org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Unknown repository! at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getObjectInternal(AbstractAtomPubService.java:768) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.getObject(ObjectServiceImpl.java:516) at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:403) at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:377) at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getRootFolder(SessionImpl.java:482) at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getRootFolder(SessionImpl.java:476) at com.test.ecm.EcmConnector.open(EcmConnector.java:62) at com.test.ecm.WebServiceController.post(WebServiceController.java:99) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789) at javax.servlet.http.HttpServlet.service(HttpServlet.java:751) at javax.servlet.http.HttpServlet.service(HttpServlet.java:844) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:341) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:238) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3363) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3333) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2220) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2146) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2124) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1564) at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295) at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)

What could be the cause for this error?

ednincer
  • 931
  • 8
  • 15
  • The class `com.test.ecm.EcmConnector` looks very suspicious - what other jars did you add? Any demo ones? Any custom cmis ones? – Gagravarr Jan 24 '20 at 04:09
  • See if this link helps you : https://stackoverflow.com/questions/41580963/cmisobjectnotfoundexception-when-trying-to-access-my-alfresco-repository – Sanket Mehta Jan 24 '20 at 08:00
  • @Gagravarr WebServiceController and EcmConnector are my project classes. No additional cmis jars. – ednincer Jan 24 '20 at 15:28
  • @SanketMehta Thanks, I'm using the correct url for alfresco 5: http://localhost:8080/alfresco/cmisatom. – ednincer Jan 24 '20 at 15:53

1 Answers1

0

You are using the incorrect service URL. According to the documentation, the URL for CMIS 1.0 and the ATOM binding is:

https://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.0/atom

Jeff Potts
  • 10,468
  • 17
  • 40