PDF generation fails with IllegalAccessException on AEM LTS environments
PDF generation requests through the AEM API on LTS environments fails with a 500 Internal Server Error and a Java IllegalAccessException. The failure occurs because the Java XML module blocks access to the internal package com.sun.org.apache.xerces.internal.jaxp under the default module export configuration. To fix this issue, add the required JVM argument to open the restricted Java XML package, restart the affected services, and verify that PDF generation requests complete successfully.
Description description
Environment
- AEM Forms
- AEM LTS environments
- Java Runtime Environment (JRE)
Issue/Symptoms
- PDF generation requests through the AEM API fail.
- The API returns an HTTP 500 Internal Server Error.
- Logs contain a Java
IllegalAccessException. - The Java process can’t access the internal package
com.sun.org.apache.xerces.internal.jaxp.
Resolution resolution
-
Add the following JVM argument to the Java startup configuration:
code language-none JAVA_OPTS="$JAVA_OPTS --add-opens=java.xml/com.sun.org.apache.xerces.internal.jaxp=ALL-UNNAMED" -
Save the configuration changes.
-
Restart the relevant AEM and Java services.
-
Run the PDF generation API request again.
-
Confirm that the API no longer returns HTTP 500 errors and that PDF generation succeeds.