0

I am trying to publish a document using IBM FileNet.

I used the manual: https://www.ibm.com/support/knowledgecenter/SSNW2F_5.2.0/com.ibm.p8.ce.dev.ce.doc/publish_procedures.htm

But I got an exception "An exception occurred during a read of the RenditionEngineConnection".

What's my mistake? How should we set up "FileNet P8 Rendition Engine"? https://www.ibm.com/support/knowledgecenter/it/SSNW2F_5.1.0/com.ibm.p8.installingre.doc/p8pic003.htm

My source code:

/**
 * 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;
}

Log: 2020-04-14T12:47:57.492 9F0B4BDE PUBL FNRCE0000E - ERROR ERROR: Reading RenditionEngineConnection threw: An unexpected exception occurred. 2020-04-14T12:47:57.493 9F0B4BDE PUBL FNRCE0000I - INFO InvokeVista exception: An exception occurred during a read of the RenditionEngineConnection. 2020-04-14T12:47:57.493 E0476562 PUBL FNRCE0066E - ERROR Failed dispatching PublishRequest row {B0AB7771-0000-CA39-BFFD-BF7A84D30A96}\ncom.filenet.api.exception.EngineRuntimeException: FNRCE0066E: E_UNEXPECTED_EXCEPTION: An unexpected exception occurred.\n at com.filenet.engine.publish.PublishRequestPDFHandler.publishPDF(PublishRequestPDFHandler.java:435)\n at com.filenet.engine.publish.PublishRequestPDFHandler.execute(PublishRequestPDFHandler.java:169)\n at com.filenet.engine.publish.PublishRequestHandlerBase$1.run(PublishRequestHandlerBase.java:226)\n at com.filenet.engine.context.CallState.doAs(CallState.java:236)\n at com.filenet.engine.context.CallState.doAs(CallState.java:153)\n at com.filenet.engine.publish.PublishRequestHandlerBase.executeAs(PublishRequestHandlerBase.java:215)\n at com.filenet.engine.publish.PublishRequestExecutor.loadAndExecuteQueuedRow(PublishRequestExecutor.java:214)\n at com.filenet.engine.queueitem.QueueExecutor.dispatchQueuedRow(QueueExecutor.java:389)\n at com.filenet.engine.queueitem.QueueExecutor.dispatchEvent(QueueExecutor.java:209)\n at com.filenet.engine.queueitem.QueueExecutor.execute(QueueExecutor.java:133)\n at com.filenet.engine.tasks.BackgroundTask.safeExecute(BackgroundTask.java:275)\n at com.filenet.engine.tasks.BackgroundTask$BackgroundTaskPriviledgedExceptionAction.run(BackgroundTask.java:1110)\n at com.filenet.engine.context.CallState.doAsSystem(CallState.java:575)\n at com.filenet.engine.tasks.BackgroundTask.run(BackgroundTask.java:209)\n at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153)\n at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n at java.lang.Thread.run(Thread.java:785)\nCaused by: com.filenet.api.exception.EngineRuntimeException: FNRCU0005E: PUBLISH_READING_REC_THREW: An exception occurred during a read of the RenditionEngineConnection.\n at com.filenet.engine.publish.PublishRequestHandlerUtil.readRenditionEngineConnection(PublishRequestHandlerUtil.java:199)\n at com.filenet.engine.publish.PublishRequestPDFHandler$InvokeVistaPDF$1.run(PublishRequestPDFHandler.java:128)\n at com.filenet.engine.context.CallState.doAs(CallState.java:236)\n at com.filenet.engine.context.CallState.doAs(CallState.java:153)\n at com.filenet.engine.publish.PublishRequestPDFHandler$InvokeVistaPDF.run(PublishRequestPDFHandler.java:118)\n ... 3 more\nCaused by: com.filenet.api.exception.EngineRuntimeException: FNRCE0066E: E_UNEXPECTED_EXCEPTION: An unexpected exception occurred.\n at com.filenet.engine.publish.PublishRequestHandlerUtil.readRenditionEngineConnection(PublishRequestHandlerUtil.java:120)\n ... 7 more 2020-04-14T12:47:57.494 E0476562 PUBL FNRCE0000I - INFO dispatchFailed: marked queue item: {B0AB7771-0000-CA39-BFFD-BF7A84D30A96} as "poisoned" and will not retry further.

0

0

Browse other questions tagged or ask your own question.