OpenCSV Graal native image include resource bundles

67 views Asked by At

I am using OpenCSV to pump data into a Spring service that gets compiled to a Graal native image. When I try to parse a CSV file I get the following error:

Exception in thread "pool-7-thread-5" java.lang.RuntimeException: java.util.MissingResourceException: Can't find bundle for base name opencsv, locale en_GR
        at com.opencsv.bean.concurrent.ProcessCsvLine.run(ProcessCsvLine.java:111)
        at java.base@21/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base@21/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base@21/java.lang.Thread.runWith(Thread.java:1596)
        at java.base@21/java.lang.Thread.run(Thread.java:1583)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:833)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:211)

I read up on Graal's recommendation about dealing with resource bundles here and I tried to configured my graalNativeImage task (I am using Gradle) to take into account the location of this bundle, like so:

graalvmNative {
    binaries {
        main {
            buildArgs.add('-H:IncludeResourceBundles=com.opencsv.opencsv.opencsv')
            buildArgs.add('--initialize-at-build-time=org.apache.commons.logging.LogFactoryService')
        }
    }
}

Even with the above in place, I am still getting the same error. I understand that at runtime the desired bundle file is not present but I do not understand how I can include it.

What needs to be done in order to correct this behavior?

0

There are 0 answers