Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-61482

Exporting pages to PDF fails due to java.awt.AWTError

XMLWordPrintable

      Issue Summary

      Exporting pages to PDF fails. It has been observed cases where this occurred when a Jira Issue link existed on the page.

      Environment

      Confluence 7.4.4

      Operating System: Linux

      Diagnosis

      Reviewing the logs, the following error is found after the export attempt fails:

      atlassian-confluence.log
      2021-02-10 10:03:24,048 ERROR [http-nio-8090-exec-55] [atlassian.confluence.servlet.ConfluenceServletDispatcher] sendError Could not execute action
       -- url: /spaces/flyingpdf/pdfpageexport.action | traceId: 42090dd179c66bb3 | userName: admin
      java.lang.RuntimeException: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. There was an error converting the page "Test-page". <a href="https://docs.atlassian.com/confluence/docs-74/PDF+export+in+Confluence+Data+Center">Learn more</a>
      ...
      Caused by: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. There was an error converting the page "Test-page". <a href="https://docs.atlassian.com/confluence/docs-74/PDF+export+in+Confluence+Data+Center">Learn more</a>
      ...
      Caused by: com.atlassian.confluence.util.sandbox.SandboxCrashedException: Sandbox has crashed while serving the request
      ...
      Caused by: java.io.EOFException
      

      To get even more details, it's possible to increase the PDF Sandbox class to debug:

      com.atlassian.confluence.impl.util.sandbox
      

      With the logs in debug, the atlassian-confluence.log file will show a message like this:

      atlassian-confluence.log
      2021-02-11 18:06:06,559 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker1: Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.
      

      Cause

      The PDF Sandbox can inadvertently pick up the DISPLAY environment variable and try to use it. For more information on what this variable is, please refer to the link below:

      Reviewing the support zip, the variable can be found in the application.xml file:

      application.xml
      <environment-variables>
      ...
          <DISPLAY>localhost:10.0</DISPLAY>
      ...
      </environment-variables>
      

      Solution

      Try getting rid of the DISPLAY variable on the Confluence side:

      1. Locate the and edit the <confluence_installation>/bin/setenv.sh file
      2. Add at the end of the file
        unset DISPLAY
        
      3. Restart Confluence on this node
      4. Wait for this node to fully start up, then apply the same changes to any additional Confluence DC nodes
      5. Once all nodes have the DISPLAY environment cleared out in setenv.sh, try exporting the same Page/Space again

              5339cdd01cf4 Jeffery Xie
              fthozeski@atlassian.com Felipe Thozeski (Inactive)
              Votes:
              9 Vote for this issue
              Watchers:
              21 Start watching this issue

                Created:
                Updated:
                Resolved: