Aspose.Cells - GraalVM Native Build Fails

Hi All,

Using,

  • aspose-cells 18.3,
  • Quarkus Framework 1.8.1.Final,
  • Graal VM version 20.2.

When doing native build, > mvn clean install package -Pnative facing below error;

   [INFO] [org.hibernate.Version] HHH000412: Hibernate ORM core version 5.4.21.Final
5115 [INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: /codebuild/output/src159767782/src/target/estimates-1.0.0-SNAPSHOT-native-image-source-jar/estimates-1.0.0-SNAPSHOT-runner.jar
5116 [INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from /codebuild/output/src159767782/src/target/estimates-1.0.0-SNAPSHOT-native-image-source-jar/estimates-1.0.0-SNAPSHOT-runner.jar
5117 [INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 20.2.0 (Java Version 11.0.8)
5118 [INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] /usr/lib/jvm/graalvm-ce-java11-20.2.0/bin/native-image -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Duser.language=en -J-Dfile.encoding=UTF-8 --initialize-at-run-time=javax.imageio.ImageTypeSpecifier,com.sun.imageio.plugins.jpeg.JPEG\$JCS -H:+TraceClassInitialization --allow-incomplete-classpath --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -jar estimates-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+AddAllCharsets -H:EnableURLProtocols=http,https --enable-all-security-services -H:NativeLinkerOption=-no-pie --no-server -H:-UseServiceLoaderFeature -H:+StackTrace estimates-1.0.0-SNAPSHOT-runner
5119 [estimates-1.0.0-SNAPSHOT-runner:361] classlist: 12,299.77 ms, 1.64 GB
5120 [estimates-1.0.0-SNAPSHOT-runner:361] (cap): 2,084.07 ms, 1.64 GB
5121 [estimates-1.0.0-SNAPSHOT-runner:361] setup: 3,546.16 ms, 1.64 GB
5122 06:00:37,506 INFO [org.hib.val.int.uti.Version] HV000001: Hibernate Validator 6.1.5.Final
5123 06:00:37,612 INFO [org.hib.Version] HHH000412: Hibernate ORM core version 5.4.21.Final
5124 06:00:37,615 INFO [org.hib.ann.com.Version] HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
5125 06:00:37,638 INFO [org.hib.dia.Dialect] HHH000400: Using dialect: org.hibernate.dialect.SQLServer2012Dialect
5126 Warning: class initialization of class com.aspose.cells.zb failed with exception java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider. This class will be initialized at run time because option --allow-incomplete-classpath is used for image building. Use the option --initialize-at-run-time=com.aspose.cells.zb to explicitly request delayed initialization of this class.
5127 Warning: class initialization of class com.aspose.cells.za failed with exception java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider. This class will be initialized at run time because option --allow-incomplete-classpath is used for image building. Use the option --initialize-at-run-time=com.aspose.cells.za to explicitly request delayed initialization of this class.
5128 Warning: class initialization of class com.aspose.cells.znw failed with exception java.lang.NoClassDefFoundError: com/sun/media/imageio/plugins/tiff/TIFFImageWriteParam. This class will be initialized at run time because option --allow-incomplete-classpath is used for image building. Use the option --initialize-at-run-time=com.aspose.cells.znw to explicitly request delayed initialization of this class.
5129 06:00:53,243 INFO [org.jbo.threads] JBoss Threads version 3.1.1.Final
5130 [estimates-1.0.0-SNAPSHOT-runner:361] (clinit): 1,173.48 ms, 5.38 GB
5131 [estimates-1.0.0-SNAPSHOT-runner:361] (typeflow): 29,146.09 ms, 5.38 GB
5132 [estimates-1.0.0-SNAPSHOT-runner:361] (objects): 45,027.79 ms, 5.38 GB
5133 [estimates-1.0.0-SNAPSHOT-runner:361] (features): 1,691.81 ms, 5.38 GB
5134 [estimates-1.0.0-SNAPSHOT-runner:361] analysis: 80,446.78 ms, 5.38 GB
5135 Error: No instances of sun.nio.ch.FileChannelImpl are allowed in the image heap as this class should be initialized at image runtime. Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
5136 Detailed message:
5137 Trace: Object was reached by
5138 reading field sun.font.TrueTypeFont$TTDisposerRecord.channel of
5139 constant sun.font.TrueTypeFont$TTDisposerRecord@66f90e2a reached by
5140 reading field java.util.Hashtable$Entry.value of
5141 constant java.util.Hashtable$Entry@7497974b reached by
5142 indexing into array
5143 constant java.util.Hashtable$Entry[]@3bbf94de reached by
5144 reading field java.util.Hashtable.table of
5145 constant java.util.Hashtable@7d003a6 reached by
5146 scanning method sun.java2d.Disposer.addReference(Disposer.java:246)
5147 Call path from entry point to sun.java2d.Disposer.addReference(Reference, DisposerRecord):
5148 at sun.java2d.Disposer.addReference(Disposer.java:246)
5149 at sun.font.StrikeCache$WeakDisposerRef.<init>(StrikeCache.java:442)
5150 at sun.font.StrikeCache.getStrikeRef(StrikeCache.java:402)
5151 at sun.font.Font2D.getStrike(Font2D.java:397)
5152 at sun.font.Font2D.getStrike(Font2D.java:334)
5153 at sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector.java:1759)
5154 at sun.font.StandardGlyphVector.getDefaultStrike(StandardGlyphVector.java:1372)
5155 at sun.font.StandardGlyphVector.getGlyphStrike(StandardGlyphVector.java:1359)
5156 at sun.font.StandardGlyphVector.initPositions(StandardGlyphVector.java:1329)
5157 at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:669)
5158 at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:709)
5159 at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:940)
5160 at java.util.Properties.getProperty(Properties.java:1125)
5161 at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:144)
5162 at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:331)
5163 at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)
5164
5165 com.oracle.svm.core.util.UserError$UserException: No instances of sun.nio.ch.FileChannelImpl are allowed in the image heap as this class should be initialized at image runtime. Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
5166 Detailed message:
5167 Trace: Object was reached by
5168 reading field sun.font.TrueTypeFont$TTDisposerRecord.channel of
5169 constant sun.font.TrueTypeFont$TTDisposerRecord@66f90e2a reached by
5170 reading field java.util.Hashtable$Entry.value of
5171 constant java.util.Hashtable$Entry@7497974b reached by
5172 indexing into array
5173 constant java.util.Hashtable$Entry[]@3bbf94de reached by
5174 reading field java.util.Hashtable.table of
5175 constant java.util.Hashtable@7d003a6 reached by
5176 scanning method sun.java2d.Disposer.addReference(Disposer.java:246)
5177 Call path from entry point to sun.java2d.Disposer.addReference(Reference, DisposerRecord):
5178 at sun.java2d.Disposer.addReference(Disposer.java:246)
5179 at sun.font.StrikeCache$WeakDisposerRef.<init>(StrikeCache.java:442)
5180 at sun.font.StrikeCache.getStrikeRef(StrikeCache.java:402)
5181 at sun.font.Font2D.getStrike(Font2D.java:397)
5182 at sun.font.Font2D.getStrike(Font2D.java:334)
5183 at sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector.java:1759)
5184 at sun.font.StandardGlyphVector.getDefaultStrike(StandardGlyphVector.java:1372)
5185 at sun.font.StandardGlyphVector.getGlyphStrike(StandardGlyphVector.java:1359)
5186 at sun.font.StandardGlyphVector.initPositions(StandardGlyphVector.java:1329)
5187 at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:669)
5188 at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:709)
5189 at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:940)
5190 at java.util.Properties.getProperty(Properties.java:1125)
5191 at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:144)
5192 at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:331)
5193 at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)
5194
5195 at com.oracle.svm.core.util.UserError.abort(UserError.java:79)
5196 at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:217)
5197 at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:765)
5198 at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:555)
5199 at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:468)
5200 at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
5201 at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
5202 at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
5203 at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
5204 at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
5205 at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
5206 Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.nio.ch.FileChannelImpl are allowed in the image heap as this class should be initialized at image runtime. Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
5207 Detailed message:
5208 Trace: Object was reached by
5209 reading field sun.font.TrueTypeFont$TTDisposerRecord.channel of
5210 constant sun.font.TrueTypeFont$TTDisposerRecord@66f90e2a reached by
5211 reading field java.util.Hashtable$Entry.value of
5212 constant java.util.Hashtable$Entry@7497974b reached by
5213 indexing into array
5214 constant java.util.Hashtable$Entry[]@3bbf94de reached by
5215 reading field java.util.Hashtable.table of
5216 constant java.util.Hashtable@7d003a6 reached by
5217 scanning method sun.java2d.Disposer.addReference(Disposer.java:246)
5218 Call path from entry point to sun.java2d.Disposer.addReference(Reference, DisposerRecord):
5219 at sun.java2d.Disposer.addReference(Disposer.java:246)
5220 at sun.font.StrikeCache$WeakDisposerRef.<init>(StrikeCache.java:442)
5221 at sun.font.StrikeCache.getStrikeRef(StrikeCache.java:402)
5222 at sun.font.Font2D.getStrike(Font2D.java:397)
5223 at sun.font.Font2D.getStrike(Font2D.java:334)
5224 at sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector.java:1759)
5225 at sun.font.StandardGlyphVector.getDefaultStrike(StandardGlyphVector.java:1372)
5226 at sun.font.StandardGlyphVector.getGlyphStrike(StandardGlyphVector.java:1359)
5227 at sun.font.StandardGlyphVector.initPositions(StandardGlyphVector.java:1329)
5228 at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:669)
5229 at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:709)
5230 at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:940)
5231 at java.util.Properties.getProperty(Properties.java:1125)
5232 at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:144)
5233 at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:331)
5234 at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)
5235
5236 at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:126)
5237 at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:762)
5238 ... 8 more
5239 Error: Image build request failed with exit status 1

@aarkya89,
We have reviewed your error message and observed the following:

5126 Warning: class initialization of class com.aspose.cells.zb failed with exception java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider. This class will be initialized at run time because option --allow-incomplete-classpath is used for image building. Use the option --initialize-at-run-time=com.aspose.cells.zb to explicitly request delayed initialization of this class.
5127 Warning: class initialization of class com.aspose.cells.za failed with exception java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider. This class will be initialized at run time because option --allow-incomplete-classpath is used for image building. Use the option --initialize-at-run-time=com.aspose.cells.za to explicitly request delayed initialization of this class.

It seems that the issue is related to missing bouncy castle jar. You should add it to your classpath. It is available in the release archive of Aspose.Cells like for the latest archive it is named as “bcprov-jdk15on-160.jar”. You may add it to your classpath and share the feedback.

Hi @ahsaniqbalsidiqui,

Tried adding explicitly for runtime-class-initialization. But still notice

sun.nio.ch.FileChannelImpl

is causing error, as per the build stack not able to trace down from where this object is reached… This is only happening when add aspose-cells dependency in pom.xml. If removed, native build succeeds.

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] /usr/lib/jvm/graalvm-ce-java11-20.2.0/bin/native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Duser.language=en -J-Dfile.encoding=UTF-8 --initialize-at-run-time=javax.imageio.ImageTypeSpecifier,com.sun.imageio.plugins.jpeg.JPEG\$JCS,com.aspose.cells.za,com.aspose.cells.zb,com.aspose.cells.znw -H:+TraceClassInitialization --allow-incomplete-classpath --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -jar estimates-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+AddAllCharsets -H:EnableURLProtocols=http,https --enable-all-security-services -H:NativeLinkerOption=-no-pie --no-server -H:-UseServiceLoaderFeature -H:+StackTrace estimates-1.0.0-SNAPSHOT-runner
    5225 [estimates-1.0.0-SNAPSHOT-runner:371] classlist: 12,705.11 ms, 1.64 GB
    5226 [estimates-1.0.0-SNAPSHOT-runner:371] (cap): 838.83 ms, 1.64 GB
    5227 [estimates-1.0.0-SNAPSHOT-runner:371] setup: 2,295.58 ms, 1.64 GB
    5228 15:59:09,126 INFO [org.hib.val.int.uti.Version] HV000001: Hibernate Validator 6.1.5.Final
    5229 15:59:09,213 INFO [org.hib.Version] HHH000412: Hibernate ORM core version 5.4.21.Final
    5230 15:59:09,217 INFO [org.hib.ann.com.Version] HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
    5231 15:59:09,241 INFO [org.hib.dia.Dialect] HHH000400: Using dialect: org.hibernate.dialect.SQLServer2012Dialect
    5232 15:59:25,493 INFO [org.jbo.threads] JBoss Threads version 3.1.1.Final
    5233 [estimates-1.0.0-SNAPSHOT-runner:371] (clinit): 1,283.57 ms, 5.25 GB
    5234 [estimates-1.0.0-SNAPSHOT-runner:371] (typeflow): 28,643.21 ms, 5.25 GB
    5235 [estimates-1.0.0-SNAPSHOT-runner:371] (objects): 46,314.87 ms, 5.25 GB
    5236 [estimates-1.0.0-SNAPSHOT-runner:371] (features): 1,758.11 ms, 5.25 GB
    5237 [estimates-1.0.0-SNAPSHOT-runner:371] analysis: 81,730.77 ms, 5.25 GB
    5238 Error: No instances of sun.nio.ch.FileChannelImpl are allowed in the image heap as this class should be initialized at image runtime. Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
    5239 Detailed message:
    5240 Trace: Object was reached by
    5241 reading field sun.font.TrueTypeFont$TTDisposerRecord.channel of
    5242 constant sun.font.TrueTypeFont$TTDisposerRecord@67930834 reached by
    5243 reading field java.util.Hashtable$Entry.value of
    5244 constant java.util.Hashtable$Entry@45831d52 reached by
    5245 indexing into array
    5246 constant java.util.Hashtable$Entry[]@8e3bfd reached by
    5247 reading field java.util.Hashtable.table of
    5248 constant java.util.Hashtable@70efa393 reached by
    5249 scanning method sun.java2d.Disposer.addReference(Disposer.java:246)
    5250 Call path from entry point to sun.java2d.Disposer.addReference(Reference, DisposerRecord):
    5251 at sun.java2d.Disposer.addReference(Disposer.java:246)
    5252 at sun.font.StrikeCache$WeakDisposerRef.<init>(StrikeCache.java:442)
    5253 at sun.font.StrikeCache.getStrikeRef(StrikeCache.java:402)
    5254 at sun.font.Font2D.getStrike(Font2D.java:397)
    5255 at sun.font.Font2D.getStrike(Font2D.java:334)
    5256 at sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector.java:1759)
    5257 at sun.font.StandardGlyphVector.getDefaultStrike(StandardGlyphVector.java:1372)
    5258 at sun.font.StandardGlyphVector.getGlyphStrike(StandardGlyphVector.java:1359)
    5259 at sun.font.StandardGlyphVector.initPositions(StandardGlyphVector.java:1329)
    5260 at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:669)
    5261 at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:709)
    5262 at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:940)
    5263 at java.util.Properties.getProperty(Properties.java:1125)
    5264 at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:144)
    5265 at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:331)
    5266 at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)
    5267
    5268 com.oracle.svm.core.util.UserError$UserException: No instances of sun.nio.ch.FileChannelImpl are allowed in the image heap as this class should be initialized at image runtime. Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
    5269 Detailed message:
    5270 Trace: Object was reached by
    5271 reading field sun.font.TrueTypeFont$TTDisposerRecord.channel of
    5272 constant sun.font.TrueTypeFont$TTDisposerRecord@67930834 reached by
    5273 reading field java.util.Hashtable$Entry.value of
    5274 constant java.util.Hashtable$Entry@45831d52 reached by
    5275 indexing into array
    5276 constant java.util.Hashtable$Entry[]@8e3bfd reached by
    5277 reading field java.util.Hashtable.table of
    5278 constant java.util.Hashtable@70efa393 reached by
    5279 scanning method sun.java2d.Disposer.addReference(Disposer.java:246)
    5280 Call path from entry point to sun.java2d.Disposer.addReference(Reference, DisposerRecord):
    5281 at sun.java2d.Disposer.addReference(Disposer.java:246)
    5282 at sun.font.StrikeCache$WeakDisposerRef.<init>(StrikeCache.java:442)
    5283 at sun.font.StrikeCache.getStrikeRef(StrikeCache.java:402)
    5284 at sun.font.Font2D.getStrike(Font2D.java:397)
    5285 at sun.font.Font2D.getStrike(Font2D.java:334)
    5286 at sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector.java:1759)
    5287 at sun.font.StandardGlyphVector.getDefaultStrike(StandardGlyphVector.java:1372)
    5288 at sun.font.StandardGlyphVector.getGlyphStrike(StandardGlyphVector.java:1359)
    5289 at sun.font.StandardGlyphVector.initPositions(StandardGlyphVector.java:1329)
    5290 at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:669)
    5291 at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:709)
    5292 at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:940)
    5293 at java.util.Properties.getProperty(Properties.java:1125)
    5294 at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:144)
    5295 at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:331)
    5296 at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)
    5297
    5298 at com.oracle.svm.core.util.UserError.abort(UserError.java:79)
    5299 at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:217)
    5300 at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:765)
    5301 at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:555)
    5302 at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:468)
    5303 at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
    5304 at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
    5305 at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
    5306 at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
    5307 at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
    5308 at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
    5309 Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.nio.ch.FileChannelImpl are allowed in the image heap as this class should be initialized at image runtime. Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
    5310 Detailed message:
    5311 Trace: Object was reached by
    5312 reading field sun.font.TrueTypeFont$TTDisposerRecord.channel of
    5313 constant sun.font.TrueTypeFont$TTDisposerRecord@67930834 reached by
    5314 reading field java.util.Hashtable$Entry.value of
    5315 constant java.util.Hashtable$Entry@45831d52 reached by
    5316 indexing into array
    5317 constant java.util.Hashtable$Entry[]@8e3bfd reached by
    5318 reading field java.util.Hashtable.table of
    5319 constant java.util.Hashtable@70efa393 reached by
    5320 scanning method sun.java2d.Disposer.addReference(Disposer.java:246)
    5321 Call path from entry point to sun.java2d.Disposer.addReference(Reference, DisposerRecord):
    5322 at sun.java2d.Disposer.addReference(Disposer.java:246)
    5323 at sun.font.StrikeCache$WeakDisposerRef.<init>(StrikeCache.java:442)
    5324 at sun.font.StrikeCache.getStrikeRef(StrikeCache.java:402)
    5325 at sun.font.Font2D.getStrike(Font2D.java:397)
    5326 at sun.font.Font2D.getStrike(Font2D.java:334)
    5327 at sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector.java:1759)
    5328 at sun.font.StandardGlyphVector.getDefaultStrike(StandardGlyphVector.java:1372)
    5329 at sun.font.StandardGlyphVector.getGlyphStrike(StandardGlyphVector.java:1359)
    5330 at sun.font.StandardGlyphVector.initPositions(StandardGlyphVector.java:1329)
    5331 at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:669)
    5332 at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:709)
    5333 at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:940)
    5334 at java.util.Properties.getProperty(Properties.java:1125)
    5335 at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:144)
    5336 at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:331)
    5337 at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)
    5338
    5339 at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:126)
    5340 at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:762)
    5341 ... 8 more
    5342 Error: Image build request failed with exit status 1

@aarkya89,
We have logged the issue as “CELLSJAVA-43380” in our database for investigations. Once we will have some news for you, we will update you in this topic.

Meanwhile, please make sure that you are working with latest version, Aspose.Cells for Java 20.12 with pom.xml configuration as explained in below document.

@aarkya89,
Would you please try the option
-Dquarkus.native.additional-build-args=’–initialize-at-run-time=sun.nio.ch.FileChannelImpl’
when doing the native build?

@johnson.shi

sun.nio.ch.FileChannelImpl supposed to be initialized during runtime. So even we specify build in args as --initialize-at-run-time=sun.nio.ch.FileChannelImpl will end up with the error-

Error: The class sun.nio.ch.FileChannelImpl has already been initialized; it is too late to register sun.nio.ch.FileChannelImpl for build-time initialization (from the command line). To see why sun.nio.ch.FileChannelImpl got initialized use -H:+TraceClassInitialization
    com.oracle.svm.core.util.UserError$UserException: The class sun.nio.ch.FileChannelImpl has already been initialized; it is too late to register sun.nio.ch.FileChannelImpl for build-time initialization (from the command line). To see why sun.nio.ch.FileChannelImpl got initialized use -H:+TraceClassInitialization
        at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
        at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.initializeAtRunTime(ConfigurableClassInitialization.java:271)
        at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.initializeAtRunTime(ConfigurableClassInitialization.java:232)
        at com.oracle.svm.hosted.classinitialization.InitKind.lambda$stringConsumer$0(InitKind.java:61)
        at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.processClassInitializationOptions(ClassInitializationFeature.java:151)
        at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:834)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:553)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:468)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
        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)
    Error: Image build request failed with exit status 1

If --H:+TraceClassInitialization is added to build args will end up with the error mentioned in the previous post above.

Also, tried native build using GraalVM-20.3 (with Quarkus - 1.8.1.Final) & ran into the same issue.

Below is the log for the same.

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] /usr/lib/jvm/graalvm-ce-java11-20.3.0/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Duser.language=en -J-Dfile.encoding=UTF-8 --trace-object-instantiation= --initialize-at-run-time=javax.imageio.ImageTypeSpecifier,com.sun.imageio.plugins.jpeg.JPEG\$JCS,com.aspose.cells.za,com.aspose.cells.zb,com.aspose.cells.znw,sun.font.StandardGlyphVector,sun.font.StandardGlyphVector\$GlyphStrike,com.aspose.cells.a.d.zgt,com.aspose.cells.zbzf,com.aspose.cells.zatt --allow-incomplete-classpath --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -jar estimates-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+AddAllCharsets -H:EnableURLProtocols=http,https --enable-all-security-services -H:NativeLinkerOption=-no-pie --no-server -H:-UseServiceLoaderFeature -H:+StackTrace estimates-1.0.0-SNAPSHOT-runner
[estimates-1.0.0-SNAPSHOT-runner:368]    classlist:   4,605.80 ms,  1.68 GB
[estimates-1.0.0-SNAPSHOT-runner:368]        (cap):     736.04 ms,  1.68 GB
[estimates-1.0.0-SNAPSHOT-runner:368]        setup:   2,158.32 ms,  1.68 GB
05:13:36,675 INFO  [org.hib.val.int.uti.Version] HV000001: Hibernate Validator 6.1.5.Final
05:13:36,772 INFO  [org.hib.Version] HHH000412: Hibernate ORM core version 5.4.21.Final
05:13:36,777 INFO  [org.hib.ann.com.Version] HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
05:13:36,801 INFO  [org.hib.dia.Dialect] HHH000400: Using dialect: org.hibernate.dialect.SQLServer2012Dialect
05:13:56,183 INFO  [org.jbo.threads] JBoss Threads version 3.1.1.Final
[estimates-1.0.0-SNAPSHOT-runner:368]     (clinit):   2,058.08 ms,  5.71 GB
[estimates-1.0.0-SNAPSHOT-runner:368]   (typeflow):  36,714.01 ms,  5.71 GB
[estimates-1.0.0-SNAPSHOT-runner:368]    (objects):  42,175.45 ms,  5.71 GB
[estimates-1.0.0-SNAPSHOT-runner:368]   (features):   1,832.64 ms,  5.71 GB
[estimates-1.0.0-SNAPSHOT-runner:368]     analysis:  87,602.92 ms,  5.71 GB
Error: Unsupported features in 2 methods
Detailed message:
Error: No instances of java.awt.color.ICC_ColorSpace 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.color.ICC_ColorSpace.
Trace: Object was reached by 
    reading field java.awt.image.ColorModel.colorSpace of
        constant java.awt.image.DirectColorModel@6dff5a6e reached by 
    reading field java.awt.image.ColorModel.RGBdefault
Error: No instances of sun.nio.ch.FileChannelImpl 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=sun.nio.ch.FileChannelImpl.
Trace: Object was reached by 
    reading field sun.font.TrueTypeFont$TTDisposerRecord.channel of
        constant sun.font.TrueTypeFont$TTDisposerRecord@4658bf91 reached by 
    reading field java.util.Hashtable$Entry.value of
        constant java.util.Hashtable$Entry@98eae20 reached by 
    indexing into array
        constant java.util.Hashtable$Entry[]@1ea5e530 reached by 
    reading field java.util.Hashtable.table of
        constant java.util.Hashtable@210e9022 reached by 
    scanning method sun.java2d.Disposer.addReference(Disposer.java:246)
Call path from entry point to sun.java2d.Disposer.addReference(Reference, DisposerRecord): 
    at sun.java2d.Disposer.addReference(Disposer.java:246)
    at sun.font.StrikeCache$WeakDisposerRef.<init>(StrikeCache.java:442)
    at sun.font.StrikeCache.getStrikeRef(StrikeCache.java:402)
    at sun.font.Font2D.getStrike(Font2D.java:397)
    at sun.font.Font2D.getStrike(Font2D.java:334)
    at sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector.java:1759)
    at sun.font.StandardGlyphVector.getDefaultStrike(StandardGlyphVector.java:1372)
    at sun.font.StandardGlyphVector.getGlyphStrike(StandardGlyphVector.java:1359)
    at sun.font.StandardGlyphVector.initPositions(StandardGlyphVector.java:1329)
    at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:669)
    at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:709)
    at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:940)
    at java.util.Properties.getProperty(Properties.java:1125)
    at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:144)
    at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:330)
    at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)

com.oracle.svm.core.util.UserError$UserException: Unsupported features in 2 methods
Detailed message:
Error: No instances of java.awt.color.ICC_ColorSpace 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.color.ICC_ColorSpace.
Trace: Object was reached by 
    reading field java.awt.image.ColorModel.colorSpace of
        constant java.awt.image.DirectColorModel@6dff5a6e reached by 
    reading field java.awt.image.ColorModel.RGBdefault
Error: No instances of sun.nio.ch.FileChannelImpl 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=sun.nio.ch.FileChannelImpl.
Trace: Object was reached by 
    reading field sun.font.TrueTypeFont$TTDisposerRecord.channel of
        constant sun.font.TrueTypeFont$TTDisposerRecord@4658bf91 reached by 
    reading field java.util.Hashtable$Entry.value of
        constant java.util.Hashtable$Entry@98eae20 reached by 
    indexing into array
        constant java.util.Hashtable$Entry[]@1ea5e530 reached by 
    reading field java.util.Hashtable.table of
        constant java.util.Hashtable@210e9022 reached by 
    scanning method sun.java2d.Disposer.addReference(Disposer.java:246)
Call path from entry point to sun.java2d.Disposer.addReference(Reference, DisposerRecord): 
    at sun.java2d.Disposer.addReference(Disposer.java:246)
    at sun.font.StrikeCache$WeakDisposerRef.<init>(StrikeCache.java:442)
    at sun.font.StrikeCache.getStrikeRef(StrikeCache.java:402)
    at sun.font.Font2D.getStrike(Font2D.java:397)
    at sun.font.Font2D.getStrike(Font2D.java:334)
    at sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector.java:1759)
    at sun.font.StandardGlyphVector.getDefaultStrike(StandardGlyphVector.java:1372)
    at sun.font.StandardGlyphVector.getGlyphStrike(StandardGlyphVector.java:1359)
    at sun.font.StandardGlyphVector.initPositions(StandardGlyphVector.java:1329)
    at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:669)
    at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:709)
    at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:940)
    at java.util.Properties.getProperty(Properties.java:1125)
    at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:144)
    at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:330)
    at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)

    at com.oracle.svm.core.util.UserError.abort(UserError.java:82)
    at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:217)
    at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:768)
    at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:558)
    at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:471)
    at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
    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: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Unsupported features in 2 methods
Detailed message:
Error: No instances of java.awt.color.ICC_ColorSpace 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.color.ICC_ColorSpace.
Trace: Object was reached by 
    reading field java.awt.image.ColorModel.colorSpace of
        constant java.awt.image.DirectColorModel@6dff5a6e reached by 
    reading field java.awt.image.ColorModel.RGBdefault
Error: No instances of sun.nio.ch.FileChannelImpl 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=sun.nio.ch.FileChannelImpl.
Trace: Object was reached by 
    reading field sun.font.TrueTypeFont$TTDisposerRecord.channel of
        constant sun.font.TrueTypeFont$TTDisposerRecord@4658bf91 reached by 
    reading field java.util.Hashtable$Entry.value of
        constant java.util.Hashtable$Entry@98eae20 reached by 
    indexing into array
        constant java.util.Hashtable$Entry[]@1ea5e530 reached by 
    reading field java.util.Hashtable.table of
        constant java.util.Hashtable@210e9022 reached by 
    scanning method sun.java2d.Disposer.addReference(Disposer.java:246)
Call path from entry point to sun.java2d.Disposer.addReference(Reference, DisposerRecord): 
    at sun.java2d.Disposer.addReference(Disposer.java:246)
    at sun.font.StrikeCache$WeakDisposerRef.<init>(StrikeCache.java:442)
    at sun.font.StrikeCache.getStrikeRef(StrikeCache.java:402)
    at sun.font.Font2D.getStrike(Font2D.java:397)
    at sun.font.Font2D.getStrike(Font2D.java:334)
    at sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector.java:1759)
    at sun.font.StandardGlyphVector.getDefaultStrike(StandardGlyphVector.java:1372)
    at sun.font.StandardGlyphVector.getGlyphStrike(StandardGlyphVector.java:1359)
    at sun.font.StandardGlyphVector.initPositions(StandardGlyphVector.java:1329)
    at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:669)
    at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:709)
    at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:940)
    at java.util.Properties.getProperty(Properties.java:1125)
    at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:144)
    at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:330)
    at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)

    at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:129)
    at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:765)
    ... 8 more
Error: Image build request failed with exit status 1

If you analyse the log above; you can notice 2 errors.

  1. Error: No instances of java.awt.color.ICC_ColorSpace 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.color.ICC_ColorSpace.

  2. No instances of sun.nio.ch.FileChannelImpl 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=sun.nio.ch.FileChannelImpl.

For both error, when build args are added as
--trace-object-instantiation=sun.nio.ch.FileChannelImpl and --trace-object-instantiation=java.awt.color.ICC_ColorSpace
output message:
Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked

Thank you for the feedback. It needs certain time for us to prepare the environment for simulating and reproducing the issue. Before that, would you please try some other options to see whether you can get different result? For example, the option

--initialize-at-build-time=java.awt.color.ICC_ColorSpace

Or

--initialize-at-build-time=sun.nio.ch.FileChannelImpl

Thank you.

@johnson.shi -

It is not possible. Will end up with the below error.

Error: Incompatible change of initialization policy for <class name>: trying to change BUILD_TIME 
       from the command line to RERUN for JDK native code support via JNI
       com.oracle.svm.core.util.UserError$UserException: Incompatible change of initialization policy 
       for <class name>: trying to change BUILD_TIME from the command line to RERUN for JDK 
       native code support via JNI

class name refers to sun.nio.ch.FileChannelImpl or java.awt.color.ICC_ColorSpace.

The issue is also with the latest version Aspose.cells - 20.12

Will wait for your feedback based on your findings.

@aarkya89,
Thank you for the feedback. We will analyze this issue and provide our feedback when ready for sharing.

We have investigated this issue and finally we found that it was mainly caused by java.awt.* APIs such as java.awt.Font, java.awt.BufferedImage. It seems that graalvm does not support those APIs yet. For simple applications, for example, you may remove the reference to aspose.cells in your project and test the issue with following simple code:

java.awt.image.BufferedImage bi = new java.awt.image.BufferedImage (20, 20, java.awt.image.BufferedImage.TYPE_INT_RGB)

or:

java.awt.Font t = new java.awt.Font(“Serif”, 0, 10);

Even if the build succeeds, an error will still be reported when you run the generated native image.

For our component, those APIs are essential and many basic functions depend on them. So we are afraid you cannot use it with graalvm to build native image until graalvm supports java.awt.* better.