Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-4746

Graal native-image fails when including PDFBox

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0.18
    • None
    • Parsing
    • None
    • MacOsx 10.14.5, Graal 19.3.0

    Description

      Graal native-image build fails when including PDFBox in project with

      Error: Detected a started Thread in the image heap. Threads running in the image generator are no longer running at image run time. Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image run time by using the option --initialize-at-build-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
      Detailed message:
      Trace: object sun.java2d.opengl.OGLRenderQueue$QueueFlusher
      object sun.java2d.opengl.OGLRenderQueue
      field sun.java2d.opengl.OGLRenderQueue.theInstance

       

      How to reproduce:

      String fileName = "Some pdf file.pdf";
      try

      { PDDocument document = PDDocument.load(Paths.get(fileName).toFile()); }

      catch(IOException e)

      { e.printStackTrace(); }

      then compile to native.

      Root cause is the inclusion of JBIG2Filter in org.apache.pdfbox.filter.FilterFactory. Comment this out and the problem goes away. This is possibly due to the fact that JBIG2Filter requires a plug in to be installed which is dynamically loaded. In native-image building all such resources must be known at build time.

       

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Posthuma Bruno
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: