Upload document using cmis is not working

cancel
Showing results for 
Search instead for 
Did you mean: 
fouada
Active Member II

Upload document using cmis is not working

Hi All,

I am trying to upload a document using below code and it is giving runtime exception.

private static void createDocument(Folder target, String newDocName) {
Map<String, String> props = new HashMap<String, String>();
props.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
props.put(PropertyIds.NAME, newDocName);
System.out.println("This is a test document: " + newDocName);
String content = "aegif Mind Share Leader Generating New Paradigms by aegif corporation.";
byte[] buf = null;
try {
buf = content.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
ByteArrayInputStream input = new ByteArrayInputStream(buf);
ContentStream contentStream = session.getObjectFactory()
.createContentStream(newDocName, buf.length,
"text/plain; charset=UTF-8", input);
target.createDocument(props, contentStream, VersioningState.MAJOR);
}

Below Exeption is coming:-

Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: Internal Server Error
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:487)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:629)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createFolder(ObjectServiceImpl.java:158)
at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createFolder(SessionImpl.java:814)
at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createFolder(FolderImpl.java:136)
at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createFolder(FolderImpl.java:479)
at com.gl.main.SampleClient.createDocument(SampleClient.java:137)
at com.gl.main.SampleClient.main(SampleClient.java:38)

Please let me know if I any thing is not correct or any thing is missing.

Thanks in advance!

3 Replies
mrks_js1
Established Member II

Re: Upload document using cmis is not working

can you provide all of your catalina.out?

fouada
Active Member II

Re: Upload document using cmis is not working

Thanks you Markus It was a silly mistake by seeing log I have seen license was expired.

progaman
Member II

Re: Upload document using cmis is not working

wrong:

Map<String, String> props = new HashMap<String, String>();

correct:

Map<String, Object> props = new HashMap<String, Object>();