01-18-2017 04:56 AM
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!
01-19-2017 06:07 AM
can you provide all of your catalina.out?
01-20-2017 01:10 AM
Thanks you Markus It was a silly mistake by seeing log I have seen license was expired.
01-20-2017 01:54 AM
wrong:
Map<String, String> props = new HashMap<String, String>();
correct:
Map<String, Object> props = new HashMap<String, Object>();
Explore our Alfresco products with the links below. Use labels to filter content by product module.