Description
Describe the issue
I am using GraalVM for a long time with several dependencies (such as AWS...). But as soon as I am using the dependency 'org.xhtmlrenderer:flying-saucer-pdf:9.1.20' the native compilation fails in a very weird way:
Error: Main entry point class 'com.itemis.fotahub.aws.lambda.restapi.Main' not found.
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1
I have isolated the problem: I have commented all code which use this library. Even though, simply by adding this dependency in the gradle build script, it raises this very strange error.
Steps to reproduce the issue
- create a gradle project
- Add 'org.xhtmlrenderer:flying-saucer-pdf:9.1.20' as dependency
- Run native compilation
Describe GraalVM and your environment:
- GraalVM version 21.0.0 and 20.1.0
- JDK major version: 8
- OS: Ubuntu
- Architecture: AMD64
More details
All the option (--native-image-info, --verbose, and H:+ReportExceptionStackTraces) don't give anymore info.
Activity
cmoine commentedon Jan 25, 2021
I am not able to reproduce the problem on a simple project. Maybe the error pops up by mixing several libraries. Problem is that the error doesn't give any hint on the problem... :-(
oubidar-Abderrahim commentedon Jan 27, 2021
Could you please provide a working reproducer for this issue?
cmoine commentedon Jan 28, 2021
Sorry, but I cannot reproduce it on a simple project, and I cannot give you the entire project. I guess you can close the ticket. Who knows maybe someone will have the same problem!
hminukuri-chwy commentedon Mar 24, 2021
I am running into this error when I add this library ('org.xhtmlrenderer', 'flying-saucer-pdf', '9.1.20')
java.lang.ClassNotFoundException: com.lowagie.text.pdf.PdfName
implementation group: 'com.lowagie', name: 'itext', version: '2.1.7', ext: 'pom'
Tried to add above lib to resolve it , still running into same error
any thoughts ?
wushuartgaro commentedon Oct 19, 2022
Not sure whether you're using Quarkus 2.8 and above. If yes, the best way to deal with this is to import all the required libs to ensure the class path is complete at build time.
quarkusio/quarkus#25526 (comment)
You can refer to the pom.xml of the flying-saucer-pdf library itself.
https://github.com/flyingsaucerproject/flyingsaucer/blob/v9.1.20/flying-saucer-pdf/pom.xml
For my case, I would need to add in these three libs to build the native image successfully
implementation group 'com.lowagie', name: 'itext', version: '2.1.7'
implementation group 'org.bouncycastle', name: 'bcprov-jdk14', version: '1.64'
implementation group 'org.bouncycastle', name: 'bcmail-jdk14', version: '1.64'
emakunin commentedon Aug 10, 2024
Thank you @wushuartgaro. Your comment so far is the only working version and solution i've found for quarkus. All new versions cannot pass Quarkus's validations. I believe they've started using language features that are not supported by GraalVM. Even trying to move all the checks to runtime does not help. With this version and dependencies list it works.