SCIFIO java version limitations

After an upgrade to Debian-10 (Buster) we can no longer process image formats with ITK that need SCIFIO (bioformats). Even though ITK-5.0.1 is newly compiled after the upgrade we get:

File: /opt/compilation/ITK_build/Modules/Remote/SCIFIO/src/itkSCIFIOImageIO.cxx
Line: 180
Description: itk::ERROR: SCIFIOImageIO(0x561739001e10): SCIFIOImageIO exited abnormally. Exception in thread "main" java.lang.UnsupportedClassVersionError: io/scif/itk/SCIFIOITKBridge : Unsupported major.minor version 52.0

The installed JRE/JDK is OpenJDK-11 and is the only one so far supported by Debian for Buster.
52.0 howerver seems to correspond to Java-8.

So I wonder if the JARs for SCIFIO are not compiled locally but downloaded?
How to solve this problem?

There is an outstanding issue to update the bundled JVM.

We could also update the JARs. Chatting with @ctrueden, my understanding that we can now move to bioformats JARs, which are maintained and now available in a non-copyleft license.

1 Like

Tried to solve this issue temporarily with a docker image based on ubuntu16:04 with openjdk-8 (https://github.com/romangrothausmann/ITK-CLIs/commit/e6e720f667f57f8cbad8216ec864583ba9687664) but am getting the same error even with the resulting docker image (registry.gitlab.com/romangrothausmann/itk-clis/scifio). Would I be needing more than just openjdk-8-jre in the docker execution environment?

I have been using SCIFIO will out issue recently on OSX and Linux in several environments. I installed openjdk-8-jdk on an ubuntu 18.04 image recently to get it working.

You may also find some insights in a recent SimpleITK Conda recipe where I enabled SCIFIO to create a local package.

1 Like

Hm, what java dependencies need to be satisfied during built and which during execution time? For my setup in the Dockerfile compilation works without any problems even without any JDK or JRE. With SCIFIO enabled, the installation then contains JARs and even a folder named jre/, so one might think it would not even need a JRE from the system.

I was able to build and test ITK with SCIFIO as follows on a debain:buster docker image:

apt install build-essential ninja-build cmake-curses-gui openjdk-11-jdk
git clone https://github.com/InsightSoftwareConsortium/ITK.git
mkdir bld && cd bld
ccmake -G Ninja -DModule_SCIFIO=ON ../
ninja
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:/bin/java::")
ctest -V -R ITKSCIFIOImageInfoTest0

Setting JAVA_HOME overrides the old JAVA version downloaded as part of SCIFIO.

2 Likes

Many thanks @blowekamp for the hint with JAVA_HOME, that did the trick even for the local installation.
So is the error caused because the “old JAVA version downloaded as part of SCIFIO” does not match the version of javac that was used to compile the SCIFIO-JARs (also downloaded as part of SCIFIO?)?

Yes, the JVM downloaded take priority over java in the PATH, but JAVA_HOME take higher priority. If you just delete lib/jre from the build tree and provide a java it works too.

Also got it working within a docker image with specifying JAVA_HOME


pointing to openjdk-8-jre or even openjdk-11-jre.
So the prolem seems to be due to the SCIFIO JARs being built for a different java version than is provided by lib/jre in the ITK installation.
With

JAR=/opt/itk-5.0.1/lib/jars/scifio-itk-bridge.jar ; unzip -p $JAR `unzip -l $JAR | grep '\.class$' | awk 'NR==1 {print $4}'` | file -

I get compiled Java class data, version 52.0 (Java 1.8) but

/opt/itk-5.0.1/lib/jre/bin/java -version

reports java version "1.6.0_24". Since SCIFIO works even if there is no java/javac available when ITK is compiled (https://github.com/romangrothausmann/ITK-CLIs/blob/1a9705180b230f98baefb53eefd944b5714927c8/Dockerfile), I conclude that the SCIFIO JARs are not compiled when ITK is compiled but instead are pulled (pre-compiled) from the net. Is that right?

That is right.

1 Like