Quantcast
Channel: Alfresco Forums - Alfresco API
Viewing all articles
Browse latest Browse all 252

CmisObjectNotFoundException: Type is unknown

$
0
0

My environment and details are:
CMIS libraries and API

http://vm-alfresco:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom

I also tried with CMIS 1.0 URL

<dependency>
<groupId>org.apache.chemistry.opencmis</groupId>
<artifactId>chemistry-opencmis-client-api</artifactId>
<version>0.13.0</version>
</dependency>
 
<dependency>
<groupId>org.apache.chemistry.opencmis</groupId>
<artifactId>chemistry-opencmis-client-impl</artifactId>
<version>0.13.0</version>
</dependency>

My code:

SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
Map<String, String> parameter =new HashMap<String, String>();
parameter.put(SessionParameter.USER,this.user);
parameter.put(SessionParameter.PASSWORD,this.password);
parameter.put(SessionParameter.ATOMPUB_URL,this.host);
parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
...List<Repository> repositories =new ArrayList<Repository>();
repositories = sessionFactory.getRepositories(parameter);
...log.info("Alfresco Repositories");
cmisRepository = repositories.get(0);
parameter.put(SessionParameter.REPOSITORY_ID, cmisRepository.getId());//SessionFactoryImpl.newInstance(); Session session = factory.getRepositories(parameter).get(0).createSession();
cmisSession = sessionFactory.createSession(parameter); 
... HashMap<String, Object> cmisDocumentProperties =new HashMap<String, Object>();
cmisDocumentProperties.put(PropertyIds.OBJECT_TYPE_ID,"cmis:document, D:salo:mlodocument, P:salo:documentProperties");
... byte[] content = document.getBData();
InputStream stream =new ByteArrayInputStream(content);
ContentStream contentStream = cmisSession.getObjectFactory().createContentStream(
document.getFileName(), Long.valueOf(content.length), document.getMimeType(), stream);
Document insertedDocument = categoryFolder.createDocument(cmisDocumentProperties, contentStream, VersioningState.MAJOR);

Exception is shown below

org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Type 'cmis:document, D:salo:lodocument, P:salo:documentProperties' is unknown!
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:484)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.read(AbstractAtomPubService.java:645)
org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getTypeDefinitionInternal(AbstractAtomPubService.java:911)
org.apache.chemistry.opencmis.client.bindings.spi.atompub.RepositoryServiceImpl.getTypeDefinition(RepositoryServiceImpl.java:94)
at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getTypeDefinition(RepositoryServiceImpl.java:148)
at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getTypeDefinition(RepositoryServiceImpl.java:127)
at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getTypeDefinition(SessionImpl.java:770)
at org.apache.chemistry.opencmis.client.runtime.repository.ObjectFactoryImpl.convertProperties(ObjectFactoryImpl.java:356)
at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:1091)
at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:77)
at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:451)
at com.services.impl.AlfrescoCMISOpenWSProxyAdapter.insert(AlfrescoCMISOpenWSProxyAdapter.java:481)

In the model, I have defined a type D:salo:lodocument extending type cmis:document. This D:salo:lodocument has a mandatory aspect defined, which is P:salo:documentProperties.

When I read a document/image from Alfresco (version 5.0.c) server, it returns all these properties good. The document also has the aspect in the secondary types.

I googled about this problem and the results pointed to few threads who had the same/similar issue. So far, none of them helped me.

Am I missing something here?

Thank you.

5.0.c

Viewing all articles
Browse latest Browse all 252

Trending Articles