Topic
2 replies Latest Post - ‏2012-10-08T13:10:49Z by SystemAdmin
SystemAdmin
SystemAdmin
76 Posts
ACCEPTED ANSWER

Pinned topic Error on createDocument via OpenCMIS for document above a few Kb in size

‏2012-09-11T15:53:06Z |
Hi,
I am trying to develop a web application (to be deployed on WAS 7) that connects to Filenet P8 (5.0) via CMIS.
My web application is developed using Apache Chemistry Open CMIS 0.7.0.

This is the code snippet that creates the session:

SessionFactory factory = SessionFactoryImpl.newInstance(); HashMap<String, String> params = 

new HashMap<String, String>();   params.put(SessionParameter.USER, 
"username"); params.put(SessionParameter.PASSWORD, 
"password");   params.put(SessionParameter.ATOMPUB_URL, 
"http://server:port/fncmis/resources/Service"); params.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); params.put(SessionParameter.REPOSITORY_ID, 
"ObjectStoreName"); Session session = factory.createSession(params);


And this is the snippet that creates the document:

Map<String, Object> properties = 

new HashMap<String, Object>(); properties.put(PropertyIds.OBJECT_TYPE_ID, type.getId()); properties.put(PropertyIds.BASE_TYPE_ID, type.getBaseTypeId()); properties.put(PropertyIds.NAME, fileName);   InputStream stream = 

new ByteArrayInputStream(content); ContentStream contentStream = 

new ContentStreamImpl(fileName, BigInteger.valueOf(content.length), mimeType, stream);   Folder folder = (Folder)session.getObjectByPath(path); Document newDoc = folder.createDocument(properties, contentStream, VersioningState.MAJOR);


If I run this code from a standalone Java project, everything works perfectly, regardless of the size of the file to be uploaded.
When I include this code in a servlet and I deploy it on WAS, however, it only works for very small files (in the order of a few kb), whereas for bigger files I get the following CmisBaseException:


com.ibm.ecm.cmis.app.exceptions.CMISRuntimeException: CIL1517: The service cannot be completed because the XML input cannot be deserialized. Explanation: Either no input was provided or the input is not a well-formed XML document. Action: Provide a valid CMIS Atom entry. For more information about Atom entries, see the OASIS CMIS API specification. at com.ibm.ecm.cmis.app.cmis.Content.DoPostForContentType_CreateNewOrMove(Content.java:423) at com.ibm.ecm.cmis.app.cmis.ContentFlat.post(ContentFlat.java:115) at com.ibm.ecm.cmis.app.servlet.CMISServlet.doPost(CMISServlet.java:189) at javax.servlet.http.HttpServlet.service(HttpServlet.java:738) at com.ibm.ecm.cmis.app.servlet.ParamMappingServlet.service(ParamMappingServlet.java:246) at com.ibm.ecm.cmis.app.servlet.CMISServlet.service(CMISServlet.java:501) at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1655) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1595) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131) at com.ibm.ecm.integration.common.compression.CompressionFilter.doFilter(CompressionFilter.java:49) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116) at com.ibm.ecm.integration.common.nls.servlet.LocaleFilter.doFilter(LocaleFilter.java:60) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116) at com.ibm.ecm.integration.common.messageTrace.servlet.MessageTraceFilter.doFilter(MessageTraceFilter.java:84) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116) at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:895) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:932) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:500) at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178) at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864) at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:183) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384) at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)


I have run out of ides on what it could be... Can anyone shed a light on this, please?
Updated on 2012-10-08T13:10:49Z at 2012-10-08T13:10:49Z by SystemAdmin
  • jay.brown
    jay.brown
    41 Posts
    ACCEPTED ANSWER

    Re: Error on createDocument via OpenCMIS for document above a few Kb in size

    ‏2012-09-11T18:01:28Z  in response to SystemAdmin
    Could you obtain a http trace of the conversation between your servlet and the CMIS service for the failing POST? If we can see what it is sending that is invalid we should be able to narrow this down a bit.
  • SystemAdmin
    SystemAdmin
    76 Posts
    ACCEPTED ANSWER

    Re: Error on createDocument via OpenCMIS for document above a few Kb in size

    ‏2012-10-08T13:10:49Z  in response to SystemAdmin
    Thanks for your reply, Jay.

    Apparently the issue was caused by the set of files I was trying to upload being corrupted... They opened up fine in viewers, but somehow they couldn't be packaged correctly in an atompub message to be sent over CMIS...