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 ascom.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:
-
Review the Workbench process to identify where a
com.adobe.idp.Documentis assigned or mapped to a variable or service that expects anorg.w3c.dom.Document. -
Align the data types so that both the source and target variables use the same document type, either
com.adobe.idp.Documentororg.w3c.dom.Document. -
If different types are required:
- Convert
com.adobe.idp.Documenttoorg.w3c.dom.Documentby reading and parsing the document stream as XML. - If required, convert
org.w3c.dom.Documentback tocom.adobe.idp.Documentfor downstream Adobe Forms operations. - Remove any direct cast or implicit assignment between these two types.
- Convert
-
Redeploy the updated Workbench application or process.
-
Test the process with representative input documents.
-
Verify that the
InvalidCoercionExceptionno longer occurs.