Closed melissalinkert closed 10 months ago
75cc25a adds one more potential fix to address the illegal access warning logged to stderr, as noted by @erindiel :
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.esotericsoftware.reflectasm.AccessClassLoader (file:/home/melissa/bioformats2raw/build/distributions/bioformats2raw-0.9.0-SNAPSHOT/lib/reflectasm-1.11.9.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.esotericsoftware.reflectasm.AccessClassLoader
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
The full stack trace, which results from setting JAVA_OPTS="--illegal-access=debug"
:
WARNING: Illegal reflective access by com.esotericsoftware.reflectasm.AccessClassLoader (file:/home/melissa/bioformats2raw/build/distributions/bioformats2raw-0.9.0-SNAPSHOT/lib/reflectasm-1.11.9.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
at com.esotericsoftware.reflectasm.AccessClassLoader.getDefineClassMethod(AccessClassLoader.java:111)
at com.esotericsoftware.reflectasm.AccessClassLoader.defineClass(AccessClassLoader.java:73)
at com.esotericsoftware.reflectasm.AccessClassLoader.defineAccessClass(AccessClassLoader.java:57)
at com.esotericsoftware.reflectasm.ConstructorAccess.get(ConstructorAccess.java:99)
at com.esotericsoftware.kryo.util.DefaultInstantiatorStrategy.newInstantiatorOf(DefaultInstantiatorStrategy.java:59)
at com.esotericsoftware.kryo.Kryo.newInstantiator(Kryo.java:1190)
at com.esotericsoftware.kryo.Kryo.newInstance(Kryo.java:1199)
at com.esotericsoftware.kryo.serializers.FieldSerializer.create(FieldSerializer.java:163)
at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:122)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:774)
at loci.formats.Memoizer$KryoDeser.loadReader(Memoizer.java:169)
at loci.formats.Memoizer.loadMemo(Memoizer.java:924)
at loci.formats.Memoizer.setId(Memoizer.java:702)
at loci.formats.ReaderWrapper.setId(ReaderWrapper.java:692)
at loci.formats.ChannelSeparator.setId(ChannelSeparator.java:317)
at com.glencoesoftware.bioformats2raw.Converter.convert(Converter.java:1241)
at com.glencoesoftware.bioformats2raw.Converter.call(Converter.java:1176)
at com.glencoesoftware.bioformats2raw.Converter.call(Converter.java:104)
at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:2264)
at picocli.CommandLine.parseWithHandlers(CommandLine.java:2664)
at picocli.CommandLine.parseWithHandler(CommandLine.java:2599)
at picocli.CommandLine.call(CommandLine.java:2875)
at com.glencoesoftware.bioformats2raw.Converter.main(Converter.java:2946)
This warning only shows up when a memo file is loaded, so either the memo file must exist prior to conversion or multiple workers need to be used in order to see the warning.
https://github.com/EsotericSoftware/reflectasm/issues/64 and https://github.com/EsotericSoftware/kryo/issues/692 are relevant upstream issues.
From what I can tell (based on this documentation in particular), --add-opens java.base/java.lang=ALL-UNNAMED
(as used in 75cc25a) is the next best option if the problematic library cannot be updated. Definitely happy to hear better ideas though.
Unfortunately, 75cc25a seems to have caused regression on JDK 8 runtime environments when using the 0.9.0 distribution bundle - see #237
Reproduced locally
sbesson@Sebastiens-MacBook-Pro-3 Downloads % jenv local 1.8
sbesson@Sebastiens-MacBook-Pro-3 Downloads % ./bioformats2raw-0.9.0/bin/bioformats2raw test.fake test.zarr
Unrecognized option: --add-opens
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
sbesson@Sebastiens-MacBook-Pro-3 Downloads % jenv local 11.0
sbesson@Sebastiens-MacBook-Pro-3 Downloads % ./bioformats2raw-0.9.0/bin/bioformats2raw test.fake test.zarr
sbesson@Sebastiens-MacBook-Pro-3 Downloads % rm -rf test.zarr
sbesson@Sebastiens-MacBook-Pro-3 Downloads % jenv local 17.0
sbesson@Sebastiens-MacBook-Pro-3 Downloads % ./bioformats2raw-0.9.0/bin/bioformats2raw test.fake test.zarr
This ensures that the correct log level is set before OpenCV is loaded.
Compare using
--log-level ERROR
with and without this PR.