Getting 'java.lang.UnsatisfiedLinkError' in Confluence Data Center when exporting a Space to PDF
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When attempting to export a space into PDF, it fails with a System Error page and a generic SandboxCrashedException message in the logs due to a dependency on the Linux X11 library.
Diagnosis
Initially, the following is observed in the atlassian-confluence.log
when the export to PDF operation failed:
2023-09-19 10:47:55,075 ERROR [https-jsse-nio2-8443-exec-1] [apache.struts2.dispatcher.DefaultDispatcherErrorHandler] sendErrorResponse Exception occurred during processing request: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. There was an error converting the page \"Page Name\". <a href=\"https://docs.atlassian.com/confluence/docs-85/PDF+export+in+Confluence+Data+Center\">Learn more</a>
-- url: /spaces/flyingpdf/pdfpageexport.action | userName: admin | referer: /display/SPACE/Page+Name | traceId: e56bab7ffde1d479
java.lang.RuntimeException: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. There was an error converting the page "Page Name". <a href="https://docs.atlassian.com/confluence/docs-85/PDF+export+in+Confluence+Data+Center">Learn more</a>
at com.atlassian.confluence.extra.flyingpdf.impl.ExportPageAsPdfAction.doExecute(ExportPageAsPdfAction.java:57)
at com.atlassian.confluence.extra.flyingpdf.impl.PdfExportSemaphore.run(PdfExportSemaphore.java:28)
at com.atlassian.confluence.extra.flyingpdf.impl.ExportPageAsPdfAction.execute(ExportPageAsPdfAction.java:30)
...
...
Caused by: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. There was an error converting the page "Page Name". <a href="https://docs.atlassian.com/confluence/docs-85/PDF+export+in+Confluence+Data+Center">Learn more</a>
at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxXmlToPdfConverter.convertXhtmlToPdf(SandboxXmlToPdfConverter.java:95)
at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.renderPdf(SandboxPdfExporterService.java:354)
...
...
Caused by: com.atlassian.confluence.util.sandbox.SandboxCrashedException: Sandbox has crashed while serving the request
at com.atlassian.confluence.impl.util.sandbox.SandboxProcess.tryToThrowSpecificException(SandboxProcess.java:174)
at com.atlassian.confluence.impl.util.sandbox.SandboxProcess.execute(SandboxProcess.java:139)
at com.atlassian.confluence.impl.util.sandbox.SandboxLocalProcessPool.execute(SandboxLocalProcessPool.java:107)
...
...
This error message is quite generic, so extra DEBUG needs to be enabled in the Sandbox process as stated in our KB How to enable debug logging to investigate document conversion problems in Confluence's External Process Pool (sandbox)
Once additional debugs are enabled, the following error is observed few milliseconds before the SandboxCrashedException:
2023-09-20 07:08:02,215 DEBUG [https-jsse-nio2-8443-exec-19] [extra.flyingpdf.sandbox.SandboxPdfExporterService] createPdf Exporting page 11111111
2023-09-20 07:08:02,217 DEBUG [https-jsse-nio2-8443-exec-19] [extra.flyingpdf.html.RenderedXhtmlBuilder] renderToHtml Rendering to exported XHTML page id=11111111
...
...
2023-09-20 07:08:02,589 INFO [https-jsse-nio2-8443-exec-19] [extra.flyingpdf.auding.PdfExportAuditListener] onPDFExport Auditing PDF export of page
2023-09-20 07:08:02,589 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$buildConfig$0 worker1: Exception in thread \"main\" java.lang.UnsatisfiedLinkError: /opt/atlassian/confluence/jre/lib/libawt_xawt.so: libXrender.so.1: Cannot open shared object file: File or directory not found
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(Unknown Source)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source)
at java.base/java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.base/java.lang.Runtime.load0(Unknown Source)
at java.base/java.lang.System.load(Unknown Source)
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(Unknown Source)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source)
at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(Unknown Source)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source)
at java.base/java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.base/java.lang.Runtime.loadLibrary0(Unknown Source)
at java.base/java.lang.System.loadLibrary(Unknown Source)
at java.desktop/java.awt.Toolkit$2.run(Unknown Source)
at java.desktop/java.awt.Toolkit$2.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.desktop/java.awt.Toolkit.loadLibraries(Unknown Source)
at java.desktop/java.awt.Toolkit.initStatic(Unknown Source)
at java.desktop/java.awt.Toolkit.<clinit>(Unknown Source)
at java.desktop/java.awt.Color.<clinit>(Unknown Source)
at org.xhtmlrenderer.pdf.ITextOutputDevice.<init>(ITextOutputDevice.java:122)
at org.xhtmlrenderer.pdf.ITextRenderer.<init>(ITextRenderer.java:106)
at org.xhtmlrenderer.pdf.ITextRenderer.<init>(ITextRenderer.java:102)
at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfConversionTask.createRenderer(SandboxPdfConversionTask.java:104)
...
...
...
Cause
This error stack trace shows that the sandbox process was attempting to load GUI-related classes, which possibly made it look for dependent linux X11 (display) libraries (which may not be present or even needed).
This generally happens when the process picks up the presence of a valid DISPLAY configuration from the OS environment variables.
Solution
Please, follow these steps to overcome this situation:
Include line unset DISPLAY in your
setenv.sh
file, just before the export CATALINA_OPTS lineunset DISPLAY export CATALINA_OPTS
- Restart Confluence.
As an alternative to this, you can also check with your OS Administrator and install the missing X11 libraries for your OS version:
- Install the required libXtst-devel and libXrender-devel RPM to the server per the instructions on our Confluence UNIX and X11 Dependencids page.
- It might also be needed to configure as a System Property the following java argument: -Djava.awt.headless=true