首页 > 解决方案 > FileNet 异常“读取 RenditionEngineConnection 期间发生异常”

问题描述

我正在尝试使用 IBM FileNet 发布文档。

我使用了手册: https ://www.ibm.com/support/knowledgecenter/SSNW2F_5.2.0/com.ibm.p8.ce.dev.ce.doc/publish_procedures.htm

但我得到一个异常“读取 RenditionEngineConnection 期间发生异常”。

我的错误是什么?我们应该如何设置“FileNet P8 Rendition Engine”? https://www.ibm.com/support/knowledgecenter/it/SSNW2F_5.1.0/com.ibm.p8.installingre.doc/p8pic003.htm

我的源代码:

/**
 * Create {@link PublishStyleTemplate}
 *
 * @param objectStore {@link ObjectStore}
 * @param description description
 */
public void createPublishStyleTemplate(final ObjectStore objectStore, final String description) {

    PublishStyleTemplate pst = Factory.PublishStyleTemplate.createInstance(objectStore);

    pst.set_Title(description);
    pst.set_Description(description);

    StringList formats = Factory.StringList.createList();
    formats.add("text/plain");
    formats.add("application/msword");
    formats.add("application/vnd.ms-excel");
    formats.add("application/vnd.ms-powerpoint");
    formats.add("application/vnd.openxmlformat");
    formats.add("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
    formats.add("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
    formats.add("application/vnd.openxmlformats-officedocument.presentationml.presentation");
    pst.set_InputFormats(formats);

    // ProviderID must use the well-known handler name.
    String PDF_HANDLER = "PublishRequestPDFHandler";
    pst.set_ProviderID(PDF_HANDLER);
    pst.set_OutputFormat("application/pdf"); // PDF transformation

    pst.save(RefreshMode.REFRESH);
}

/**
 * Create {@link PublishTemplate}
 *
 * @param objectStore {@link ObjectStore}
 * @param publishStyleTemplate {@link PublishStyleTemplate}
 * @param description description
 */
public void createPublishTemplate(final ObjectStore objectStore, final PublishStyleTemplate publishStyleTemplate, final String description) {

    // Create a publish template object.
    PublishTemplate pt = Factory.PublishTemplate.createInstance(objectStore);

    pt.set_StyleTemplate(publishStyleTemplate);

    // Set document title for the publish template
    pt.getProperties().putValue("DocumentTitle", description);
    pt.set_Description("test_PublishTemplate");

    // Is there a cascade delete dependency between source document and publication?
    boolean isSourceDependency = true;

    // isSourceDependency is a boolean variable that specifies whether the user wants
    // to delete the publication automatically when the source is deleted. It is whichever value
    // (true or false) the user chooses.
    String VALUE_ISSOURCEDEPENDENCY = isSourceDependency ? "true" : "false";

    // Publish template content.
    String PT_CONTENT =
            "<?xml version='1.0'?>" +
                    "<publishtemplatecontent>" +
                        "<version>2.0.1</version>" +
                        "<newinstructions>" +
                            "<issourcedependent>" + VALUE_ISSOURCEDEPENDENCY + "</issourcedependent>" +
                            "<outputfolderid>" + "B0FA3471-0000-CD1D-9D5E-B1E6E5E82135" + "</outputfolderid>" +
                            "<applyproperties><from>source</from></applyproperties>" +
                            "<applysecurity><from>default</from></applysecurity>" +
                        "</newinstructions>" +
                        "<republishinstructions>" +
                            "<versionablerepublishtype>versionandkeep</versionablerepublishtype>" +
                            "<nonversionablerepublishtype>addandkeep</nonversionablerepublishtype>" +
                            "<applypropertiesfrom>destination</applypropertiesfrom>" +
                            "<applysecurityfrom>destination</applysecurityfrom>" +
                        "</republishinstructions>" +
                    "</publishtemplatecontent>";

    String[] PT_DATA = {"myNewPublishTemplate.xml", "application/x-filenet-publishtemplate", PT_CONTENT};

    // Create content elements.
    ContentElementList cel = Factory.ContentElement.createList();

    ContentTransfer ctNew = Factory.ContentTransfer.createInstance();
    ByteArrayInputStream is = new ByteArrayInputStream(PT_CONTENT.getBytes());
    ctNew.setCaptureSource(is);
    ctNew.set_RetrievalName(PT_DATA[0]);
    ctNew.set_ContentType(PT_DATA[1]);

    cel.add(ctNew);

    pt.set_ContentElements(cel);

    // Check in publish template as major version.
    pt.checkin(AutoClassify.DO_NOT_AUTO_CLASSIFY, CheckinType.MAJOR_VERSION);
    pt.save(RefreshMode.REFRESH);
}

/**
 * Create {@link PublishRequest}
 *
 * @param objectStore
 * @param document
 * @param publishTemplate
 * @return
 */
public PublishRequest createPublishRequest(
        final ObjectStore objectStore,
        final Document document,
        final PublishTemplate publishTemplate) {

    System.out.println(String.format("Document Id = %s", document.get_Id().toString()));
    System.out.println(String.format("Document MimeType = %s", document.get_MimeType()));
    System.out.println(String.format("Document Name = %s", document.get_Name()));
    System.out.println(String.format("PublishTemplate Id = %s", publishTemplate.get_Id().toString()));

    PublishStyleTemplate publishStyleTemplate = publishTemplate.get_StyleTemplate();
    System.out.println(String.format("PublishStyleTemplate ProviderID = %s", publishStyleTemplate.get_ProviderID()));
    StringList stringList = publishStyleTemplate.get_InputFormats();
    Iterator iterator = stringList.iterator();
    while(iterator.hasNext()) {
        String inputFormat = (String) iterator.next();
        System.out.println(String.format("PublishStyleTemplate InputFormat = %s", inputFormat));
    }

    String publishOpts = new String(
            "<publishoptions><publicationname>"
            + document.get_Name()
            + "</publicationname></publishoptions>");

    PublishRequest publishRequest = Factory.PublishRequest.createInstance(objectStore);
    publishRequest.set_InputDocument(document);
    publishRequest.set_PublishTemplate(publishTemplate);
    publishRequest.setPublishOptions(publishOpts);

    publishRequest.save(RefreshMode.REFRESH);

    return publishRequest;
}

日志:2020-04-14T12:47:57.492 9F0B4BDE PUBL FNRCE0000E - 错误错误:读取 RenditionEngineConnection 抛出:发生意外异常。2020-04-14T12:47:57.493 9F0B4BDE PUBL FNRCE0000I - 信息 InvokeVista 异常:读取 RenditionEngineConnection 期间发生异常。2020-04-14T12:47:57.493 E0476562 PUBL FNRCE0066E - 错误分派 PublishRequest 行 {B0AB7771-0000-CA39-BFFD-BF7A84D30A96}\ncom.filenet.api.exception.EngineRuntimeException: FNRCE0066E: E_UNEXPECTED_EXCEPTION: n 在 com.filenet.engine.publish.PublishRequestPDFHandler.publishPDF(PublishRequestPDFHandler.java:435)\n 在 com.filenet.engine.publish.PublishRequestPDFHandler.execute(PublishRequestPDFHandler.java:169)\n 在 com.filenet.engine。发布.PublishRequestHandlerBase$1.run(PublishRequestHandlerBase.java:

标签: filenet-p8

解决方案


推荐阅读