Document fragment save fails with XPath operator limit error in AEM Forms 6.5

In Adobe Experience Manager Forms 6.5, saving a document fragment fails when the generated XPath expression exceeds the JVM’s default operator limit. To fix this issue, address the XPath operator limit that blocks the document fragment save operation.

Description description

Environment

Adobe Experience Manager (AEM) Forms 6.5 (all platforms)

Symptoms

  • When creating and saving a document fragment in AEM Forms, the following error appears in the UI:

    Text Creation Failed [ object Object]

  • The server log contains the following error:

    javax.xml.xpath.XPathExpressionException: javax.xml.transform.TransformerException: JAXP0801002: the compiler encountered an XPath expression containing '101' operators that exceeds the '100' limit set by 'FEATURE_SECURE_PROCESSING'.

  • The error occurs when the generated XPath expression for the document fragment exceeds the JVM’s default operator limit.

Cause

The JVM enforces a default limit of 100 operators in XPath expressions for security reasons. The document fragment creation process generates an expression with 101 operators, which exceeds this limit and causes the error.

Resolution resolution

Follow the steps below to resolve the issue:

  1. Stop the AEM Forms/JBoss server.

  2. Back up the current JBoss startup configuration.

  3. Add the following JVM options to the startup configuration:

    1. -Djdk.xml.xpathExprGrpLimit=100
    2. -Djdk.xml.xpathExprOpLimit=2000

    For Windows batch configuration, add the options to the appropriate file, such as domain.conf.bat for domain mode or standalone.conf.bat for standalone mode:

    code language-none
    set "JAVA_OPTS=%JAVA_OPTS% -Djdk.xml.xpathExprGrpLimit=100 -Djdk.xml.xpathExprOpLimit=2000"
    

    If JAVA_OPTS is defined externally, ensure that these parameters are appended to the effective value used by the service or startup command.

  4. Restart the AEM Forms/JBoss server.

  5. Verify from the startup output that jdk.xml.xpathExprOpLimit=2000 is applied.

  6. Attempt to create and save the document fragment again to confirm that the issue is resolved.

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