apache / camel-quarkus

Apache Camel Quarkus
https://camel.apache.org
Apache License 2.0
256 stars 189 forks source link

Native Build Failed While Use Camel-Pdf #3945

Closed dilipdhankecha2530 closed 2 years ago

dilipdhankecha2530 commented 2 years ago

Describe the bug

With camel-quarkus-pdf, i am able to generate image from the pdf file. My reference code is here. I am able to run the code but while creating the native image it will come up with below error message.

22.1-java11: Pulling from quarkus/ubi-quarkus-native-image
Digest: sha256:04464863cd626543e58f3058e168985b3be0597f55fa3de29c4a48191e89fe1b
Status: Image is up to date for quay.io/quarkus/ubi-quarkus-native-image:22.1-java11
quay.io/quarkus/ubi-quarkus-native-image:22.1-java11
========================================================================================================================
GraalVM Native Image: Generating 'code-with-quarkus-1.0.0-SNAPSHOT-runner' (executable)...
========================================================================================================================
[1/7] Initializing...                                                                                   (16.4s @ 0.30GB)
 Version info: 'GraalVM 22.1.0 Java 11 CE'
 C compiler: gcc (redhat, x86_64, 8.5.0)
 Garbage collector: Serial GC
 4 user-provided feature(s)
  - io.quarkus.awt.runtime.graal.AwtFeature
  - io.quarkus.runner.AutoFeature
  - io.quarkus.runtime.graal.DisableLoggingAutoFeature
  - io.quarkus.runtime.graal.ResourcesFeature
12:03:06,572 WARN  [org.apa.pdf.pdm.fon.FileSystemFontProvider] New fonts found, font cache will be re-built
12:03:06,577 WARN  [org.apa.pdf.pdm.fon.FileSystemFontProvider] Building on-disk font cache, this may take a while
12:03:06,706 WARN  [org.apa.pdf.pdm.fon.FileSystemFontProvider] Finished building on-disk font cache, found 9 fonts
[2/7] Performing analysis...  [*]                                                                       (51.3s @ 4.23GB)
  10,478 (81.87%) of 12,798 classes reachable
  15,560 (68.03%) of 22,872 fields reachable
  57,342 (59.63%) of 96,162 methods reachable
     543 classes,    23 fields, and 3,608 methods registered for reflection

Error: java.util.concurrent.ExecutionException: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of java.awt.image.ColorConvertOp are allowed in the image heap as this class should be initialized at image runtime. To see how this object got instantiated use --trace-object-instantiation=java.awt.image.ColorConvertOp.
com.oracle.graal.pointsto.util.AnalysisError: java.util.concurrent.ExecutionException: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of java.awt.image.ColorConvertOp are allowed in the image heap as this class should be initialized at image runtime. To see how this object got instantiated use --trace-object-instantiation=java.awt.image.ColorConvertOp.
        at com.oracle.graal.pointsto.util.AnalysisError.shouldNotReachHere(AnalysisError.java:172)
        at com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:66)
        at com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$postTask$9(ImageHeapScanner.java:611)
        at com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:193)
        at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:177)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.util.concurrent.ExecutionException: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of java.awt.image.ColorConvertOp are allowed in the image heap as this class should be initialized at image runtime. To see how this object got instantiated use --trace-object-instantiation=java.awt.image.ColorConvertOp.
        at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
        at com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:64)
        ... 9 more
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of java.awt.image.ColorConvertOp are allowed in the image heap as this class should be initialized at image runtime. To see how this object got instantiated use --trace-object-instantiation=java.awt.image.ColorConvertOp.
        at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.checkImageHeapInstance(ClassInitializationFeature.java:135)
        at com.oracle.graal.pointsto.meta.AnalysisUniverse.replaceObject(AnalysisUniverse.java:582)
        at com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.replaceObject(AnalysisConstantReflectionProvider.java:257)
------------------------------------------------------------------------------------------------------------------------
        at com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.interceptValue(AnalysisConstantReflectionProvider.java:228)
        at com.oracle.svm.hosted.heap.SVMImageHeapScanner.transformFieldValue(SVMImageHeapScanner.java:126)
        at com.oracle.graal.pointsto.heap.ImageHeapScanner.onFieldValueReachable(ImageHeapScanner.java:331)
        at com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$createImageHeapObject$3(ImageHeapScanner.java:272)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:63)
        ... 9 more
                        2.7s (3.8% of total time) in 21 GCs | Peak RSS: 4.96GB | CPU load: 6.43
========================================================================================================================
Failed generating 'code-with-quarkus-1.0.0-SNAPSHOT-runner' after 1m 8s.
Error: Image build request failed with exit status 1
> Task :quarkusBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':quarkusBuild'.
> io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: io.quarkus.deployment.pkg.steps.NativeImageBuildStep$ImageGenerationFailureException: Image generation failed. Exit code: 1
        at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:400)
        at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:240)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:944)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
        at java.base/java.lang.Thread.run(Thread.java:833)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 17s
6 actionable tasks: 1 executed, 5 up-to-date

Is there any configuration i missed?

Expected behavior

Build must be successful and binary file works fine with lambda function or Rest API.

jamesnetherton commented 2 years ago

Please try with quarkusPlatformVersion / quarkusPluginVersion 2.11.1.Final.

dilipdhankecha2530 commented 2 years ago

@jamesnetherton

Currently i am use below mentioned gradle.properties file.

#Gradle properties
quarkusPluginId=io.quarkus
quarkusPluginVersion=2.11.1.Final
quarkusPlatformGroupId=io.quarkus.platform
quarkusPlatformArtifactId=quarkus-bom
quarkusPlatformVersion=2.11.1.Final

After update the property i am getting below error.

Initialized native services in: /home/dilip/.gradle/native
Initialized jansi services in: /home/dilip/.gradle/native
Found daemon DaemonInfo{pid=39554, address=[4f41eab6-1283-4acb-9416-5ae0d3364511 port:43399, addresses:[/127.0.0.1]], state=Idle, lastBusy=1659006972254, context=DefaultDaemonContext[uid=6b2aaa34-18e7-42b0-ba2c-f29f15053e23,javaHome=/usr/lib/jvm/graalvm-ce-java17-22.0.0.2,daemonRegistryDir=/home/dilip/.gradle/daemon,pid=39554,idleTimeout=10800000,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=IN,-Duser.language=en,-Duser.variant]} however its context does not match the desired criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=/home/dilip/.sdkman/candidates/java/21.3.2.r17-grl,daemonRegistryDir=/home/dilip/.gradle/daemon,pid=40909,idleTimeout=null,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=IN,-Duser.language=en,-Duser.variant]
Actual: DefaultDaemonContext[uid=6b2aaa34-18e7-42b0-ba2c-f29f15053e23,javaHome=/usr/lib/jvm/graalvm-ce-java17-22.0.0.2,daemonRegistryDir=/home/dilip/.gradle/daemon,pid=39554,idleTimeout=10800000,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=IN,-Duser.language=en,-Duser.variant]

  Looking for a different daemon...
The client will now receive all logging from the daemon (pid: 40369). The daemon log file: /home/dilip/.gradle/daemon/7.4.2/daemon-40369.out.log
Starting 2nd build in daemon [uptime: 1 mins 31.411 secs, performance: 100%, non-heap usage: 35% of 256 MiB]
Using 8 worker leases.
Now considering [/home/dilip/Desktop/image-processor] as hierarchies to watch
Watching the file system is configured to be enabled if available
File system watching is active
Starting Build
Settings evaluated using settings file '/home/dilip/Desktop/image-processor/settings.gradle'.
Projects loaded. Root project using build file '/home/dilip/Desktop/image-processor/build.gradle'.
Included projects: [root project 'image-processor']

> Configure project :
Evaluating root project 'image-processor' using build file '/home/dilip/Desktop/image-processor/build.gradle'.
All projects evaluated.
Selected primary task 'clean' from project :
Selected primary task 'build' from project :
Tasks to be executed: [task ':clean', task ':processResources', task ':quarkusGenerateCode', task ':compileJava', task ':classes', task ':jar', task ':quarkusBuild', task ':assemble', task ':check', task ':build']
Tasks that were excluded: [task ':test']
:clean (Thread[Execution worker for ':',5,main]) started.

> Task :clean
Caching disabled for task ':clean' because:
  Build cache is disabled
Task ':clean' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
Watching 11 directories to track changes
:clean (Thread[Execution worker for ':',5,main]) completed. Took 0.046 secs.
:check (Thread[Execution worker for ':',5,main]) started.

> Task :check
Skipping task ':check' as it has no actions.
:check (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.
destroyer locations for task group 0 (Thread[Execution worker for ':',5,main]) started.
destroyer locations for task group 0 (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.
:processResources (Thread[Execution worker for ':',5,main]) started.

> Task :processResources
Watching 11 directories to track changes
Caching disabled for task ':processResources' because:
  Build cache is disabled
Task ':processResources' is not up-to-date because:
  Output property 'destinationDir' file /home/dilip/Desktop/image-processor/build/resources/main has been removed.
  Output property 'destinationDir' file /home/dilip/Desktop/image-processor/build/resources/main/application.yml has been removed.
  Output property 'destinationDir' file /home/dilip/Desktop/image-processor/build/resources/main/default_banner.txt has been removed.
Watching 11 directories to track changes
Watching 12 directories to track changes
:processResources (Thread[Execution worker for ':',5,main]) completed. Took 0.011 secs.
:quarkusGenerateCode (Thread[Execution worker for ':',5,main]) started.

> Task :quarkusGenerateCode
Watching 13 directories to track changes
Caching disabled for task ':quarkusGenerateCode' because:
  Build cache is disabled
Task ':quarkusGenerateCode' is not up-to-date because:
  Output property 'generatedOutputDirectory' file /home/dilip/Desktop/image-processor/build/classes/java/quarkus-generated-sources has been removed.
Watching 12 directories to track changes
file or directory '/home/dilip/Desktop/image-processor/src/integrationTest/java', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-generated-sources/grpc', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-generated-sources/avdl', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-generated-sources/avpr', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-generated-sources/avsc', not found
file or directory '/home/dilip/Desktop/image-processor/src/native-test/java', not found
file or directory '/home/dilip/Desktop/image-processor/src/quarkus-generated-sources/java', not found
file or directory '/home/dilip/Desktop/image-processor/src/quarkus-test-generated-sources/java', not found
file or directory '/home/dilip/Desktop/image-processor/src/test/java', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-test-generated-sources/grpc', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-test-generated-sources/avdl', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-test-generated-sources/avpr', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-test-generated-sources/avsc', not found
file or directory '/home/dilip/Desktop/image-processor/src/integrationTest/resources', not found
file or directory '/home/dilip/Desktop/image-processor/src/native-test/resources', not found
file or directory '/home/dilip/Desktop/image-processor/src/quarkus-generated-sources/resources', not found
file or directory '/home/dilip/Desktop/image-processor/src/quarkus-test-generated-sources/resources', not found
file or directory '/home/dilip/Desktop/image-processor/src/test/resources', not found
Watching 13 directories to track changes
:quarkusGenerateCode (Thread[Execution worker for ':',5,main]) completed. Took 1.307 secs.
:compileJava (Thread[Execution worker for ':',5,main]) started.

> Task :compileJava
Watching 14 directories to track changes
Watching 15 directories to track changes
Watching 15 directories to track changes
Watching 15 directories to track changes
Caching disabled for task ':compileJava' because:
  Build cache is disabled
Task ':compileJava' is not up-to-date because:
  Output property 'destinationDirectory' file /home/dilip/Desktop/image-processor/build/classes/java/main has been removed.
  Output property 'destinationDirectory' file /home/dilip/Desktop/image-processor/build/classes/java/main/com has been removed.
  Output property 'destinationDirectory' file /home/dilip/Desktop/image-processor/build/classes/java/main/com/smartproof has been removed.
Watching 14 directories to track changes
Watching 14 directories to track changes
Watching 14 directories to track changes
Watching 13 directories to track changes
The input changes require a full rebuild for incremental task ':compileJava'.
Full recompilation is required because no incremental change information is available. This is usually caused by clean builds or changing compiler arguments.
Compiling with toolchain '/home/dilip/.sdkman/candidates/java/21.3.2.r17-grl'.
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-generated-sources/grpc', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-generated-sources/avdl', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-generated-sources/avpr', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-generated-sources/avsc', not found
Compiling with JDK Java compiler API.
Note: /home/dilip/Desktop/image-processor/src/main/java/com/smartproof/lambda/service/CertificateGeneratorService.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Class dependency analysis for incremental compilation took 0.005 secs.
Created classpath snapshot for incremental compilation in 0.051 secs.
Watching 21 directories to track changes
Watching 22 directories to track changes
Watching 23 directories to track changes
Watching 24 directories to track changes
:compileJava (Thread[Execution worker for ':',5,main]) completed. Took 1.836 secs.
:classes (Thread[Execution worker for ':' Thread 6,5,main]) started.

> Task :classes
Skipping task ':classes' as it has no actions.
:classes (Thread[Execution worker for ':' Thread 6,5,main]) completed. Took 0.0 secs.
:jar (Thread[Execution worker for ':' Thread 6,5,main]) started.

> Task :jar
Watching 25 directories to track changes
Watching 26 directories to track changes
Caching disabled for task ':jar' because:
  Build cache is disabled
Task ':jar' is not up-to-date because:
  Output property 'archiveFile' file /home/dilip/Desktop/image-processor/build/libs/image-processor-1.0.0-SNAPSHOT.jar has been removed.
Watching 25 directories to track changes
Watching 26 directories to track changes
:jar (Thread[Execution worker for ':' Thread 6,5,main]) completed. Took 0.032 secs.
:quarkusBuild (Thread[Execution worker for ':' Thread 6,5,main]) started.

> Task :quarkusBuild
Watching 27 directories to track changes
Watching 27 directories to track changes
Watching 27 directories to track changes
Caching disabled for task ':quarkusBuild' because:
  Build cache is disabled
Task ':quarkusBuild' is not up-to-date because:
  Task has failed previously.
Watching 27 directories to track changes
Watching 27 directories to track changes
Watching 26 directories to track changes
file or directory '/home/dilip/Desktop/image-processor/src/integrationTest/java', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-generated-sources/grpc', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-generated-sources/avdl', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-generated-sources/avpr', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-generated-sources/avsc', not found
file or directory '/home/dilip/Desktop/image-processor/src/native-test/java', not found
file or directory '/home/dilip/Desktop/image-processor/src/quarkus-generated-sources/java', not found
file or directory '/home/dilip/Desktop/image-processor/src/quarkus-test-generated-sources/java', not found
file or directory '/home/dilip/Desktop/image-processor/src/test/java', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-test-generated-sources/grpc', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-test-generated-sources/avdl', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-test-generated-sources/avpr', not found
file or directory '/home/dilip/Desktop/image-processor/build/classes/java/quarkus-test-generated-sources/avsc', not found
file or directory '/home/dilip/Desktop/image-processor/src/integrationTest/resources', not found
file or directory '/home/dilip/Desktop/image-processor/src/native-test/resources', not found
file or directory '/home/dilip/Desktop/image-processor/src/quarkus-generated-sources/resources', not found
file or directory '/home/dilip/Desktop/image-processor/src/quarkus-test-generated-sources/resources', not found
file or directory '/home/dilip/Desktop/image-processor/src/test/resources', not found
JBoss Threads version 3.4.2.Final

Building native image source jar: /home/dilip/Desktop/image-processor/build/image-processor-1.0.0-SNAPSHOT-native-image-source-jar/image-processor-1.0.0-SNAPSHOT-runner.jar
Building native image from /home/dilip/Desktop/image-processor/build/image-processor-1.0.0-SNAPSHOT-native-image-source-jar/image-processor-1.0.0-SNAPSHOT-runner.jar
Cannot find the `native-image` in the GRAALVM_HOME, JAVA_HOME and System PATH. Install it using `gu install native-image` Attempting to fall back to container build.
Using docker to run the native image builder
Checking image status quay.io/quarkus/ubi-quarkus-native-image:22.1-java17
22.1-java17: Pulling from quarkus/ubi-quarkus-native-image
54e56e6f8572: Already exists
4f8ddd7f5a75: Already exists
f653af273fcb: Pulling fs layer
f653af273fcb: Download complete
f653af273fcb: Pull complete
Digest: sha256:3d5dd675ced8005a2530019e1acc69641ae67ebd73fa7facfd038e1061d24152
Status: Downloaded newer image for quay.io/quarkus/ubi-quarkus-native-image:22.1-java17
quay.io/quarkus/ubi-quarkus-native-image:22.1-java17
Running Quarkus native-image plugin on GraalVM 22.1.0 Java 17 CE (Java Version 17.0.3+7-jvmci-22.1-b06)
docker run --env LANG=C --rm --user 1000:1000 -v /home/dilip/Desktop/image-processor/build/image-processor-1.0.0-SNAPSHOT-native-image-source-jar:/project:z --name build-native-xCvYF quay.io/quarkus/ubi-quarkus-native-image:22.1-java17 -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=3 -J-Duser.language=en -J-Duser.country=IN -J-Dfile.encoding=UTF-8 --features=io.quarkus.awt.runtime.graal.AwtFeature,io.quarkus.awt.runtime.graal.DarwinAwtFeature,io.quarkus.runner.Feature,io.quarkus.runtime.graal.ResourcesFeature,io.quarkus.runtime.graal.DisableLoggingFeature -H:-ParseOnce -J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED -J--add-opens=java.base/java.text=ALL-UNNAMED -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -J-Djava.awt.headless=true -H:FallbackThreshold=0 --link-at-build-time -H:+ReportExceptionStackTraces -J-Xmx6g -H:-AddAllCharsets -H:EnableURLProtocols=http,https -H:NativeLinkerOption=-no-pie -H:-UseServiceLoaderFeature -H:+StackTrace image-processor-1.0.0-SNAPSHOT-runner -jar image-processor-1.0.0-SNAPSHOT-runner.jar
========================================================================================================================
GraalVM Native Image: Generating 'image-processor-1.0.0-SNAPSHOT-runner' (executable)...
========================================================================================================================
[1/7] Initializing...                                                                                   (14.3s @ 0.15GB)
 Version info: 'GraalVM 22.1.0 Java 17 CE'
 C compiler: gcc (redhat, x86_64, 8.5.0)
 Garbage collector: Serial GC
 5 user-provided feature(s)
  - io.quarkus.awt.runtime.graal.AwtFeature
  - io.quarkus.awt.runtime.graal.DarwinAwtFeature
  - io.quarkus.runner.Feature
  - io.quarkus.runtime.graal.DisableLoggingFeature
  - io.quarkus.runtime.graal.ResourcesFeature
11:25:43,220 WARN  [org.apa.pdf.pdm.fon.FileSystemFontProvider] New fonts found, font cache will be re-built
11:25:43,224 WARN  [org.apa.pdf.pdm.fon.FileSystemFontProvider] Building on-disk font cache, this may take a while
11:25:43,330 WARN  [org.apa.pdf.pdm.fon.FileSystemFontProvider] Finished building on-disk font cache, found 9 fonts
11:25:43,331 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Times-Roman
11:25:43,333 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Times-Bold
11:25:43,334 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Times-Italic
11:25:43,346 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Times-BoldItalic
11:25:43,348 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Helvetica
11:25:43,349 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Helvetica-Bold
11:25:43,351 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Helvetica-Oblique
11:25:43,353 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Helvetica-BoldOblique
11:25:43,354 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Courier
11:25:43,358 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Courier-Bold
11:25:43,359 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Courier-Oblique
11:25:43,361 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Courier-BoldOblique
11:25:43,367 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Symbol
11:25:43,371 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font ZapfDingbats
To see how the classes got initialized, use --trace-class-initialization=java.awt.image.DirectColorModel,java.awt.image.Raster,sun.java2d.Disposer,sun.awt.image.IntegerInterleavedRaster,java.awt.image.DataBufferByte,java.awt.image.BandedSampleModel,java.awt.Toolkit,java.awt.Rectangle,java.awt.image.WritableRaster,java.awt.color.ColorSpace$BuiltInSpace,java.awt.image.DataBufferInt,sun.java2d.StateTrackableDelegate,java.awt.image.SinglePixelPackedSampleModel,java.awt.image.BufferedImage,sun.java2d.StateTrackableDelegate$2,java.awt.image.SampleModel,java.awt.image.ColorModel,sun.awt.image.IntegerComponentRaster,sun.awt.image.SunWritableRaster,java.awt.image.PackedColorModel,java.awt.image.ComponentSampleModel,java.awt.Image,java.awt.image.DataBuffer,sun.awt.image.ByteBandedRaster
[2/7] Performing analysis...  [*]                                                                       (90.3s @ 2.39GB)
  12,459 (88.88%) of 14,018 classes reachable
  20,346 (59.21%) of 34,365 fields reachable
  73,091 (69.46%) of 105,234 methods reachable
     333 classes,    40 fields, and   630 methods registered for reflection

Error: Classes that should be initialized at run time got initialized during image building:
 java.awt.image.DirectColorModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.DirectColorModel got initialized use --trace-class-initialization=java.awt.image.DirectColorModel
java.awt.image.Raster the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.Raster got initialized use --trace-class-initialization=java.awt.image.Raster
sun.java2d.Disposer the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.java2d.Disposer got initialized use --trace-class-initialization=sun.java2d.Disposer
------------------------------------------------------------------------------------------------------------------------
sun.awt.image.IntegerInterleavedRaster the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.awt.image.IntegerInterleavedRaster got initialized use --trace-class-initialization=sun.awt.image.IntegerInterleavedRaster
java.awt.image.DataBufferByte the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.DataBufferByte got initialized use --trace-class-initialization=java.awt.image.DataBufferByte
java.awt.image.BandedSampleModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.BandedSampleModel got initialized use --trace-class-initialization=java.awt.image.BandedSampleModel
java.awt.Toolkit the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.Toolkit got initialized use --trace-class-initialization=java.awt.Toolkit
java.awt.Rectangle the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.Rectangle got initialized use --trace-class-initialization=java.awt.Rectangle
java.awt.image.WritableRaster the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.WritableRaster got initialized use --trace-class-initialization=java.awt.image.WritableRaster
java.awt.color.ColorSpace$BuiltInSpace the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.color.ColorSpace$BuiltInSpace got initialized use --trace-class-initialization=java.awt.color.ColorSpace$BuiltInSpace
java.awt.image.DataBufferInt the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.DataBufferInt got initialized use --trace-class-initialization=java.awt.image.DataBufferInt
sun.java2d.StateTrackableDelegate the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.java2d.StateTrackableDelegate got initialized use --trace-class-initialization=sun.java2d.StateTrackableDelegate
java.awt.image.SinglePixelPackedSampleModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.SinglePixelPackedSampleModel got initialized use --trace-class-initialization=java.awt.image.SinglePixelPackedSampleModel
java.awt.image.BufferedImage the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.BufferedImage got initialized use --trace-class-initialization=java.awt.image.BufferedImage
sun.java2d.StateTrackableDelegate$2 the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.java2d.StateTrackableDelegate$2 got initialized use --trace-class-initialization=sun.java2d.StateTrackableDelegate$2
java.awt.image.SampleModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.SampleModel got initialized use --trace-class-initialization=java.awt.image.SampleModel
java.awt.image.ColorModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.ColorModel got initialized use --trace-class-initialization=java.awt.image.ColorModel
sun.awt.image.IntegerComponentRaster the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.awt.image.IntegerComponentRaster got initialized use --trace-class-initialization=sun.awt.image.IntegerComponentRaster
sun.awt.image.SunWritableRaster the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.awt.image.SunWritableRaster got initialized use --trace-class-initialization=sun.awt.image.SunWritableRaster
java.awt.image.PackedColorModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.PackedColorModel got initialized use --trace-class-initialization=java.awt.image.PackedColorModel
java.awt.image.ComponentSampleModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.ComponentSampleModel got initialized use --trace-class-initialization=java.awt.image.ComponentSampleModel
java.awt.Image the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.Image got initialized use --trace-class-initialization=java.awt.Image
java.awt.image.DataBuffer the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.DataBuffer got initialized use --trace-class-initialization=java.awt.image.DataBuffer
sun.awt.image.ByteBandedRaster the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.awt.image.ByteBandedRaster got initialized use --trace-class-initialization=sun.awt.image.ByteBandedRaster

com.oracle.svm.core.util.UserError$UserException: Classes that should be initialized at run time got initialized during image building:
                        6.8s (6.4% of total time) in 27 GCs | Peak RSS: 3.29GB | CPU load: 5.89
 java.awt.image.DirectColorModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.DirectColorModel got initialized use --trace-class-initialization=java.awt.image.DirectColorModel
========================================================================================================================
java.awt.image.Raster the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.Raster got initialized use --trace-class-initialization=java.awt.image.Raster
Failed generating 'image-processor-1.0.0-SNAPSHOT-runner' after 1m 45s.
sun.java2d.Disposer the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.java2d.Disposer got initialized use --trace-class-initialization=sun.java2d.Disposer
sun.awt.image.IntegerInterleavedRaster the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.awt.image.IntegerInterleavedRaster got initialized use --trace-class-initialization=sun.awt.image.IntegerInterleavedRaster
java.awt.image.DataBufferByte the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.DataBufferByte got initialized use --trace-class-initialization=java.awt.image.DataBufferByte
java.awt.image.BandedSampleModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.BandedSampleModel got initialized use --trace-class-initialization=java.awt.image.BandedSampleModel
java.awt.Toolkit the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.Toolkit got initialized use --trace-class-initialization=java.awt.Toolkit
java.awt.Rectangle the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.Rectangle got initialized use --trace-class-initialization=java.awt.Rectangle
java.awt.image.WritableRaster the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.WritableRaster got initialized use --trace-class-initialization=java.awt.image.WritableRaster
java.awt.color.ColorSpace$BuiltInSpace the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.color.ColorSpace$BuiltInSpace got initialized use --trace-class-initialization=java.awt.color.ColorSpace$BuiltInSpace
java.awt.image.DataBufferInt the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.DataBufferInt got initialized use --trace-class-initialization=java.awt.image.DataBufferInt
sun.java2d.StateTrackableDelegate the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.java2d.StateTrackableDelegate got initialized use --trace-class-initialization=sun.java2d.StateTrackableDelegate
java.awt.image.SinglePixelPackedSampleModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.SinglePixelPackedSampleModel got initialized use --trace-class-initialization=java.awt.image.SinglePixelPackedSampleModel
java.awt.image.BufferedImage the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.BufferedImage got initialized use --trace-class-initialization=java.awt.image.BufferedImage
sun.java2d.StateTrackableDelegate$2 the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.java2d.StateTrackableDelegate$2 got initialized use --trace-class-initialization=sun.java2d.StateTrackableDelegate$2
java.awt.image.SampleModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.SampleModel got initialized use --trace-class-initialization=java.awt.image.SampleModel
java.awt.image.ColorModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.ColorModel got initialized use --trace-class-initialization=java.awt.image.ColorModel
sun.awt.image.IntegerComponentRaster the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.awt.image.IntegerComponentRaster got initialized use --trace-class-initialization=sun.awt.image.IntegerComponentRaster
sun.awt.image.SunWritableRaster the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.awt.image.SunWritableRaster got initialized use --trace-class-initialization=sun.awt.image.SunWritableRaster
java.awt.image.PackedColorModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.PackedColorModel got initialized use --trace-class-initialization=java.awt.image.PackedColorModel
java.awt.image.ComponentSampleModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.ComponentSampleModel got initialized use --trace-class-initialization=java.awt.image.ComponentSampleModel
java.awt.Image the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.Image got initialized use --trace-class-initialization=java.awt.Image
java.awt.image.DataBuffer the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.DataBuffer got initialized use --trace-class-initialization=java.awt.image.DataBuffer
sun.awt.image.ByteBandedRaster the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.awt.image.ByteBandedRaster got initialized use --trace-class-initialization=sun.awt.image.ByteBandedRaster

        at com.oracle.svm.core.util.UserError.abort(UserError.java:72)
        at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.checkDelayedInitialization(ConfigurableClassInitialization.java:560)
        at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.duringAnalysis(ClassInitializationFeature.java:167)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$10(NativeImageGenerator.java:726)
        at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:74)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$11(NativeImageGenerator.java:726)
        at com.oracle.graal.pointsto.PointsToAnalysis.runAnalysis(PointsToAnalysis.java:751)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:723)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:558)
        at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:515)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:407)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:615)
Error: Image build request failed with exit status 1

> Task :quarkusBuild FAILED
Watching 32 directories to track changes
Watching 33 directories to track changes
Watching 33 directories to track changes
:quarkusBuild (Thread[Execution worker for ':' Thread 6,5,main]) completed. Took 4 mins 57.252 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':quarkusBuild'.
> io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: io.quarkus.deployment.pkg.steps.NativeImageBuildStep$ImageGenerationFailureException: Image generation failed. Exit code: 1
        at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:420)
        at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:261)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:977)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
        at java.base/java.lang.Thread.run(Thread.java:833)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 5m 2s
6 actionable tasks: 6 executed
jamesnetherton commented 2 years ago

Worth noting that camel-quarkus-pdf is not a general purpose extension for you to use Apache PDFBox APIs.

Native support is only guaranteed to work in the context of the functionality that the Apache Camel PDF component uses. At the moment, that extends only to PDF text manipulation. There is currently no native support for all of the functionality provided by PDFBox, like image manipulation etc.

You can try to work around the issue with a configuration property:

quarkus.native.additional-build-args=--initialize-at-run-time=org.apache.pdfbox.rendering.SoftMask,--initialize-at-run-time=org.apache.pdfbox.pdmodel.graphics.color.PDCIEDictionaryBasedColorSpace
dilipdhankecha2530 commented 2 years ago

@jamesnetherton With below command

./gradlew clean build -Dquarkus.package.type=native -Dquarkus.native.native-image-xmx=6g -Dquarkus.native.additional-build-args=--initialize-at-run-time=org.apache.pdfbox.rendering.SoftMask,--initialize-at-run-time=org.apache.pdfbox.pdmodel.graphics.color.PDCIEDictionaryBasedColorSpace -i -x test -x javadoc

i got an error

22.1-java17: Pulling from quarkus/ubi-quarkus-native-image
Digest: sha256:3d5dd675ced8005a2530019e1acc69641ae67ebd73fa7facfd038e1061d24152
Status: Image is up to date for quay.io/quarkus/ubi-quarkus-native-image:22.1-java17
quay.io/quarkus/ubi-quarkus-native-image:22.1-java17
Running Quarkus native-image plugin on GraalVM 22.1.0 Java 17 CE (Java Version 17.0.3+7-jvmci-22.1-b06)
docker run --env LANG=C --rm --user 1000:1000 -v /home/dilip/Desktop/image-processor/build/image-processor-1.0.0-SNAPSHOT-native-image-source-jar:/project:z --name build-native-ycTEV quay.io/quarkus/ubi-quarkus-native-image:22.1-java17 -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=3 -J-Duser.language=en -J-Duser.country=IN -J-Dfile.encoding=UTF-8 --features=io.quarkus.runner.Feature,io.quarkus.runtime.graal.ResourcesFeature,io.quarkus.runtime.graal.DisableLoggingFeature,io.quarkus.awt.runtime.graal.AwtFeature,io.quarkus.awt.runtime.graal.DarwinAwtFeature -H:-ParseOnce -J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED -J--add-opens=java.base/java.text=ALL-UNNAMED --initialize-at-run-time=org.apache.pdfbox.rendering.SoftMask --initialize-at-run-time=org.apache.pdfbox.pdmodel.graphics.color.PDCIEDictionaryBasedColorSpace -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -J-Djava.awt.headless=true -H:FallbackThreshold=0 --link-at-build-time -H:+ReportExceptionStackTraces -J-Xmx6g -H:-AddAllCharsets -H:EnableURLProtocols=http,https -H:NativeLinkerOption=-no-pie -H:-UseServiceLoaderFeature -H:+StackTrace image-processor-1.0.0-SNAPSHOT-runner -jar image-processor-1.0.0-SNAPSHOT-runner.jar
========================================================================================================================
GraalVM Native Image: Generating 'image-processor-1.0.0-SNAPSHOT-runner' (executable)...
========================================================================================================================
[1/7] Initializing...                                                                                    (7.2s @ 0.15GB)
 Version info: 'GraalVM 22.1.0 Java 17 CE'
 C compiler: gcc (redhat, x86_64, 8.5.0)
 Garbage collector: Serial GC
 5 user-provided feature(s)
  - io.quarkus.awt.runtime.graal.AwtFeature
  - io.quarkus.awt.runtime.graal.DarwinAwtFeature
  - io.quarkus.runner.Feature
  - io.quarkus.runtime.graal.DisableLoggingFeature
  - io.quarkus.runtime.graal.ResourcesFeature
11:51:15,459 WARN  [org.apa.pdf.pdm.fon.FileSystemFontProvider] New fonts found, font cache will be re-built
11:51:15,461 WARN  [org.apa.pdf.pdm.fon.FileSystemFontProvider] Building on-disk font cache, this may take a while
11:51:15,509 WARN  [org.apa.pdf.pdm.fon.FileSystemFontProvider] Finished building on-disk font cache, found 9 fonts
11:51:15,510 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Times-Roman
11:51:15,512 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Times-Bold
11:51:15,513 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Times-Italic
11:51:15,515 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Times-BoldItalic
11:51:15,517 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Helvetica
11:51:15,518 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Helvetica-Bold
11:51:15,519 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Helvetica-Oblique
11:51:15,521 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Helvetica-BoldOblique
11:51:15,522 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Courier
11:51:15,533 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Courier-Bold
11:51:15,535 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Courier-Oblique
11:51:15,536 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Courier-BoldOblique
11:51:15,537 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font Symbol
11:51:15,538 WARN  [org.apa.pdf.pdm.fon.PDType1Font] Using fallback font LiberationSans for base font ZapfDingbats
To see how the classes got initialized, use --trace-class-initialization=java.awt.Image,sun.awt.image.ByteBandedRaster,java.awt.image.SampleModel,sun.java2d.StateTrackableDelegate,java.awt.Rectangle,sun.awt.image.IntegerInterleavedRaster,java.awt.image.ColorModel,java.awt.Toolkit,sun.awt.image.IntegerComponentRaster,java.awt.image.DirectColorModel,java.awt.image.Raster,java.awt.image.SinglePixelPackedSampleModel,sun.java2d.StateTrackableDelegate$2,java.awt.image.WritableRaster,java.awt.image.DataBuffer,java.awt.image.ComponentSampleModel,java.awt.image.BandedSampleModel,sun.awt.image.SunWritableRaster,sun.java2d.Disposer,java.awt.image.BufferedImage,java.awt.color.ColorSpace$BuiltInSpace,java.awt.image.DataBufferByte,java.awt.image.DataBufferInt,java.awt.image.PackedColorModel
[2/7] Performing analysis...  [*]                                                                       (68.1s @ 1.90GB)
  12,459 (88.87%) of 14,019 classes reachable
  20,347 (59.22%) of 34,357 fields reachable
  73,086 (69.45%) of 105,233 methods reachable
     333 classes,    40 fields, and   629 methods registered for reflection

Error: Classes that should be initialized at run time got initialized during image building:
 java.awt.Image the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.Image got initialized use --trace-class-initialization=java.awt.Image
sun.awt.image.ByteBandedRaster the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.awt.image.ByteBandedRaster got initialized use --trace-class-initialization=sun.awt.image.ByteBandedRaster
java.awt.image.SampleModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.SampleModel got initialized use --trace-class-initialization=java.awt.image.SampleModel
sun.java2d.StateTrackableDelegate the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.java2d.StateTrackableDelegate got initialized use --trace-class-initialization=sun.java2d.StateTrackableDelegate
java.awt.Rectangle the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.Rectangle got initialized use --trace-class-initialization=java.awt.Rectangle
sun.awt.image.IntegerInterleavedRaster the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.awt.image.IntegerInterleavedRaster got initialized use --trace-class-initialization=sun.awt.image.IntegerInterleavedRaster
java.awt.image.ColorModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.ColorModel got initialized use --trace-class-initialization=java.awt.image.ColorModel
java.awt.Toolkit the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.Toolkit got initialized use --trace-class-initialization=java.awt.Toolkit
sun.awt.image.IntegerComponentRaster the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.awt.image.IntegerComponentRaster got initialized use --trace-class-initialization=sun.awt.image.IntegerComponentRaster
java.awt.image.DirectColorModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.DirectColorModel got initialized use --trace-class-initialization=java.awt.image.DirectColorModel
java.awt.image.Raster the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.Raster got initialized use --trace-class-initialization=java.awt.image.Raster
java.awt.image.SinglePixelPackedSampleModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.SinglePixelPackedSampleModel got initialized use --trace-class-initialization=java.awt.image.SinglePixelPackedSampleModel
sun.java2d.StateTrackableDelegate$2 the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.java2d.StateTrackableDelegate$2 got initialized use --trace-class-initialization=sun.java2d.StateTrackableDelegate$2
java.awt.image.WritableRaster the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.WritableRaster got initialized use --trace-class-initialization=java.awt.image.WritableRaster
java.awt.image.DataBuffer the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.DataBuffer got initialized use --trace-class-initialization=java.awt.image.DataBuffer
------------------------------------------------------------------------------------------------------------------------
java.awt.image.ComponentSampleModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.ComponentSampleModel got initialized use --trace-class-initialization=java.awt.image.ComponentSampleModel
java.awt.image.BandedSampleModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.BandedSampleModel got initialized use --trace-class-initialization=java.awt.image.BandedSampleModel
sun.awt.image.SunWritableRaster the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.awt.image.SunWritableRaster got initialized use --trace-class-initialization=sun.awt.image.SunWritableRaster
sun.java2d.Disposer the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.java2d.Disposer got initialized use --trace-class-initialization=sun.java2d.Disposer
java.awt.image.BufferedImage the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.BufferedImage got initialized use --trace-class-initialization=java.awt.image.BufferedImage
java.awt.color.ColorSpace$BuiltInSpace the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.color.ColorSpace$BuiltInSpace got initialized use --trace-class-initialization=java.awt.color.ColorSpace$BuiltInSpace
java.awt.image.DataBufferByte the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.DataBufferByte got initialized use --trace-class-initialization=java.awt.image.DataBufferByte
java.awt.image.DataBufferInt the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.DataBufferInt got initialized use --trace-class-initialization=java.awt.image.DataBufferInt
java.awt.image.PackedColorModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.PackedColorModel got initialized use --trace-class-initialization=java.awt.image.PackedColorModel

com.oracle.svm.core.util.UserError$UserException: Classes that should be initialized at run time got initialized during image building:
 java.awt.Image the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.Image got initialized use --trace-class-initialization=java.awt.Image
sun.awt.image.ByteBandedRaster the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.awt.image.ByteBandedRaster got initialized use --trace-class-initialization=sun.awt.image.ByteBandedRaster
java.awt.image.SampleModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.SampleModel got initialized use --trace-class-initialization=java.awt.image.SampleModel
sun.java2d.StateTrackableDelegate the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.java2d.StateTrackableDelegate got initialized use --trace-class-initialization=sun.java2d.StateTrackableDelegate
java.awt.Rectangle the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.Rectangle got initialized use --trace-class-initialization=java.awt.Rectangle
sun.awt.image.IntegerInterleavedRaster the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.awt.image.IntegerInterleavedRaster got initialized use --trace-class-initialization=sun.awt.image.IntegerInterleavedRaster
java.awt.image.ColorModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.ColorModel got initialized use --trace-class-initialization=java.awt.image.ColorModel
java.awt.Toolkit the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.Toolkit got initialized use --trace-class-initialization=java.awt.Toolkit
sun.awt.image.IntegerComponentRaster the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.awt.image.IntegerComponentRaster got initialized use --trace-class-initialization=sun.awt.image.IntegerComponentRaster
java.awt.image.DirectColorModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.DirectColorModel got initialized use --trace-class-initialization=java.awt.image.DirectColorModel
java.awt.image.Raster the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.Raster got initialized use --trace-class-initialization=java.awt.image.Raster
java.awt.image.SinglePixelPackedSampleModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.SinglePixelPackedSampleModel got initialized use --trace-class-initialization=java.awt.image.SinglePixelPackedSampleModel
sun.java2d.StateTrackableDelegate$2 the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.java2d.StateTrackableDelegate$2 got initialized use --trace-class-initialization=sun.java2d.StateTrackableDelegate$2
java.awt.image.WritableRaster the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.WritableRaster got initialized use --trace-class-initialization=java.awt.image.WritableRaster
java.awt.image.DataBuffer the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.DataBuffer got initialized use --trace-class-initialization=java.awt.image.DataBuffer
java.awt.image.ComponentSampleModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.ComponentSampleModel got initialized use --trace-class-initialization=java.awt.image.ComponentSampleModel
java.awt.image.BandedSampleModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.BandedSampleModel got initialized use --trace-class-initialization=java.awt.image.BandedSampleModel
sun.awt.image.SunWritableRaster the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.awt.image.SunWritableRaster got initialized use --trace-class-initialization=sun.awt.image.SunWritableRaster
sun.java2d.Disposer the class was requested to be initialized at run time (Quarkus run time init for AWT). To see why sun.java2d.Disposer got initialized use --trace-class-initialization=sun.java2d.Disposer
java.awt.image.BufferedImage the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.BufferedImage got initialized use --trace-class-initialization=java.awt.image.BufferedImage
java.awt.color.ColorSpace$BuiltInSpace the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.color.ColorSpace$BuiltInSpace got initialized use --trace-class-initialization=java.awt.color.ColorSpace$BuiltInSpace
java.awt.image.DataBufferByte the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.DataBufferByte got initialized use --trace-class-initialization=java.awt.image.DataBufferByte
java.awt.image.DataBufferInt the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.DataBufferInt got initialized use --trace-class-initialization=java.awt.image.DataBufferInt
java.awt.image.PackedColorModel the class was requested to be initialized at run time (Required for sun.text.bidi.BidiBase.NumericShapings). To see why java.awt.image.PackedColorModel got initialized use --trace-class-initialization=java.awt.image.PackedColorModel

        at com.oracle.svm.core.util.UserError.abort(UserError.java:72)
        at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.checkDelayedInitialization(ConfigurableClassInitialization.java:560)
        at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.duringAnalysis(ClassInitializationFeature.java:167)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$10(NativeImageGenerator.java:726)
        at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:74)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$11(NativeImageGenerator.java:726)
                        5.8s (7.5% of total time) in 24 GCs | Peak RSS: 3.39GB | CPU load: 6.87
========================================================================================================================
Failed generating 'image-processor-1.0.0-SNAPSHOT-runner' after 1m 16s.
        at com.oracle.graal.pointsto.PointsToAnalysis.runAnalysis(PointsToAnalysis.java:751)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:723)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:558)
        at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:515)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:407)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:615)
Error: Image build request failed with exit status 1

> Task :quarkusBuild FAILED
Watching 32 directories to track changes
Watching 33 directories to track changes
Watching 33 directories to track changes
:quarkusBuild (Thread[included builds,5,main]) completed. Took 1 mins 22.904 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':quarkusBuild'.
> io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: io.quarkus.deployment.pkg.steps.NativeImageBuildStep$ImageGenerationFailureException: Image generation failed. Exit code: 1
        at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:420)
        at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:261)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:977)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
        at java.base/java.lang.Thread.run(Thread.java:833)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)
jamesnetherton commented 2 years ago

It works fine for me. I cloned your project and used the same command to build. I ran the app with a sample PDF and it produced a PNG image as expected.

dilipdhankecha2530 commented 2 years ago

@jamesnetherton Yes it is resolve my problem but when i am using it with lambda function, it will generate large file apporx 38 MB. Is there any way to optimise this things?

oscerd commented 2 years ago

This is not really a workload for a Lamba Function...

dilipdhankecha2530 commented 2 years ago

@oscerd @jamesnetherton is there any way that i am using for the lambda function?

jamesnetherton commented 2 years ago

Is there any way to optimise this things?

Create your own extension for Apache PDFBox based off of the code here. The problem is you are using camel-quarkus-pdf but you are not actually using Camel. So all of the Camel transitive dependencies are effectively dead weight in your app.

oscerd commented 2 years ago

Btw i would create a Rest service and not deploying a Lamba Function.

jamesnetherton commented 2 years ago

Looks like there's an awt-graphics-pdfbox-quickstart example project being added to quarkus-quickstarts that can demo the desired functionality without camel-quarkus-pdf.

I vote for not modifying our PDF extension for now. If we get more reports of folks wanting to use more of the PDFBox APIs, then we can reconsider things and maybe even have a dedicated PDFBox extension that Camel & non-Camel users can leverage.