InvalidCoercionException during document mapping in Adobe Experience Manager Forms JEE

In Adobe Experience Manager Forms JEE, a Workbench process can fail with an InvalidCoercionException when it attempts to assign a com.adobe.idp.Document value to a variable that expects an org.w3c.dom.Document. This occurs when process mappings or custom code use incompatible document types and Workbench attempts an unsupported implicit conversion. To fix this issue, align the document types used by process variables, service inputs, outputs, and custom code.

Description description

Environment

Adobe Experience Manager (AEM) Forms JEE 6.5.0

Issue/Symptoms

  • A Workbench process fails for some records with the following error:

    com.adobe.idp.dsc.util.InvalidCoercionException: Cannot coerce object: of type: com.adobe.idp.Document to type: interface org.w3c.dom.Document

  • The process output variable (such as Out1.xml) is provided as com.adobe.idp.Document.

  • The receiving Workbench variable or downstream service expects org.w3c.dom.Document.

  • Workbench attempts an implicit type conversion during SetValueService. Because this conversion is not supported, the process throws the exception.

Cause

A data type mismatch exists in the Workbench process mapping or custom code. An Adobe document type (com.adobe.idp.Document) is assigned to a variable that expects a W3C XML document (org.w3c.dom.Document). Workbench does not support implicit conversion between these types, resulting in the exception.

Resolution resolution

Follow these steps to resolve the issue:

  1. Review the Workbench process to identify where a com.adobe.idp.Document is assigned or mapped to a variable or service that expects an org.w3c.dom.Document.

  2. Align the data types so that both the source and target variables use the same document type, either com.adobe.idp.Document or org.w3c.dom.Document.

  3. If different types are required:

    • Convert com.adobe.idp.Document to org.w3c.dom.Document by reading and parsing the document stream as XML.
    • If required, convert org.w3c.dom.Document back to com.adobe.idp.Document for downstream Adobe Forms operations.
    • Remove any direct cast or implicit assignment between these two types.
  4. Redeploy the updated Workbench application or process.

  5. Test the process with representative input documents.

  6. Verify that the InvalidCoercionException no longer occurs.

recommendation-more-help
experience-cloud-kcs-help-kbarticles