将大型文档上载到FileNet Content Engine

时间:2017-11-28 20:57:21

标签: filenet-p8 filenet-content-engine content-platform-engine

使用FileNet Java API版本5.1.0.3

我正在尝试将大文档上传到P8。我正在使用FileInputStream读取文件并将输入流设置为contentTransfer.setCaptureSource(file);我正在获得OOM异常(完整的堆栈跟踪)。看起来它试图在堆内存中读取整个文档,但这不是我想要的,我想将文档流式传输到P8。

代码

//Get CE Connetcion
//Create Subject
//Push Subject

//Get Domain (domain)
ObjectStore os = null;
objectStoreName = "COS" 
os = Factory.ObjectStore.fetchInstance(domain, objectStoreName, null); 


 //Get Folder
 Folder folder=null;
 folderName = ''/Sample";
folder=Factory.Folder.fetchInstance(os, folderName, null); 


 //Get the File details
InputStream file = ""; 
String fileName = "";
int fileSize = "";

// Create Document

String docClass = "dcumnet class name";
Document doc = Factory.Document.createInstance(os, docClass); 
if (file != null && fileSize > 0) {
                        ContentTransfer contentTransfer = Factory.ContentTransfer.createInstance();
                        contentTransfer.setCaptureSource(file);
                        contentElementList.add(contentTransfer);
                        doc.set_ContentElements(contentElementList);
                        contentTransfer.set_RetrievalName(fileName);                        
                        doc.set_MimeType(getMimetype(fileName));
                    }


//Check-in the doc
doc.checkin(AutoClassify.DO_NOT_AUTO_CLASSIFY,CheckinType.MAJOR_VERSION);                   
//Get and put the doc properties
String documentName =""
Properties p = doc.getProperties();
p.putValue("DocumentTitle","abcd");
p.putValue("Name","Rakesh");
p.putValue("Number","01234"); 


doc.save(RefreshMode.REFRESH)

请帮忙,如何将更大的文档作为流发送到P8?

Caused by: java.lang.OutOfMemoryError: Java heap space
    at weblogic.utils.io.UnsyncByteArrayOutputStream.resizeBuffer(UnsyncByteArrayOutputStream.java:59) ~[com.bea.core.utils_1.10.0.0.jar:1.10.0.0]
    at weblogic.utils.io.UnsyncByteArrayOutputStream.write(UnsyncByteArrayOutputStream.java:89) ~[com.bea.core.utils_1.10.0.0.jar:1.10.0.0]
    at com.filenet.apiimpl.wsi.MtomOutputStream.write(MtomOutputStream.java:39) ~[Jace.jar:dap501.003.019]
    at com.filenet.apiimpl.wsi.AttachmentHelperNst.spillAndClearAttachments(AttachmentHelperNst.java:137) ~[Jace.jar:dap501.003.019]
    at com.filenet.apiimpl.wsi.ServiceSessionNst.bCloseSoapEnvelopeAndWriteAttachments(ServiceSessionNst.java:262) ~[Jace.jar:dap501.003.019]
    at com.filenet.apiimpl.wsi.ServiceSessionNst.cReqRespPath(ServiceSessionNst.java:159) ~[Jace.jar:dap501.003.019]
    at com.filenet.apiimpl.wsi.ServiceSessionNst.executeChanges(ServiceSessionNst.java:71) ~[Jace.jar:dap501.003.019]
    at com.filenet.apiimpl.util.SessionHandle.executeChanges(SessionHandle.java:130) ~[Jace.jar:dap501.003.019]
    at com.filenet.apiimpl.core.Session.callExecuteChanges(Session.java:142) ~[Jace.jar:dap501.003.019]
    at com.filenet.apiimpl.core.Session.executeChanges(Session.java:525) ~[Jace.jar:dap501.003.019]
    at com.filenet.apiimpl.core.Session.executeChange(Session.java:816) ~[Jace.jar:dap501.003.019]
    at com.filenet.apiimpl.core.IndependentlyPersistableObjectImpl.save(IndependentlyPersistableObjectImpl.java:83) ~[Jace.jar:dap501.003.019]

1 个答案:

答案 0 :(得分:2)

您正在使用的

WSI传输能够传输任意大小的内容。它使用MTOM个附件,这些附件在HTTP上流式传输。目前尚不清楚为什么会尝试在您的情况下分配一个巨大的缓冲区。流式传输也需要一些缓冲,但不需要大缓冲区。

假设您正在使用java.io.FileInputStream并且没什么特别的,它看起来像Content Engine客户端库中的错误。您应该注意版本5.1.0.3超过4年,从那时起有几个修订包(最近一个是5.1.0.7)。