I have a Kotlin application and am trying to compile to a native binary using GraalVM using these versions:
Java version: 22.0.1+8, vendor version: GraalVM CE 22.0.1+8.1
We are using Aspose.Cells.Java version 24.1
and we’re locked into that version for a while due to other factors.
The native compilation completes successfully.
The app attempts to load the Aspose license like this:
License().setLicense(clazz.getResourceAsStream("/Aspose.Cells.Java.lic"))
But it fails with this error:
Cannot find black listed licenses resource or black list is invalid. Please report this error to Aspose.
I know the license file is in the native image. This code reads the license file contents and dumps it to the console, so I know it’s there:
val licenseText = clazz.getResource("/Aspose.Cells.Java.lic").readText()
println("*** licenseText ***\n$licenseText")
I can see the license text in the console.
Since I can read the license file contents, I tried using a StringReader
the wrap the license file text, and pass that to the setLicense
method:
License().setLicense(StringReader(clazz.getResource("/Aspose.Cells.Java.lic").readText()))
But it throws the same error as before:
Cannot find black listed licenses resource or black list is invalid. Please report this error to Aspose.
So I know the license file is there as I can read it and dump it to the console, but when using multiple methods to have Aspose read the license file, it fails.
What’s the problem?
Thank you!!