Bruno created PDFBOX-4746:
-----------------------------

             Summary: Graal native-image fails when including PDFBox
                 Key: PDFBOX-4746
                 URL: https://issues.apache.org/jira/browse/PDFBOX-4746
             Project: PDFBox
          Issue Type: Bug
          Components: Parsing
    Affects Versions: 2.0.18
         Environment: MacOsx 10.14.5, Graal 19.3.0
            Reporter: Bruno
             Fix For: 2.0.19


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.

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to