org.geotools.styling.StyleFactory is not an ImageIO SPI class

Hello,

I have been trying to install the SNAP Python API on my Macbook. Everything (snappy, jpy, SNAP 6 itself) has installed correctly (I think) and I can import snappy without a problem. When I wanted to try the first example proposed at Atlassian, I got the following error:

RuntimeError: java.lang.IllegalArgumentException: org.geotools.styling.StyleFactory is not an ImageIO SPI class

This is caused by the function ProductIO():

p = ProductIO.readProduct()

I was first using Java 10, but after I did some research on this error, it said that Geotools only works with Java up to version 8. After reverting to Java 8, I still got the same error message.
I tried some other example from the snappy example folder, such as snappy_reader_writer_formats.py, and they work without a problem.

Does anyone have a solution to this problem?
Thanks

Hi Thibauld! I had the same yesterday in OSX 10.14, conda/Python 3.6, Java 10. I tried different jpy builds and OLCI data, but in the end it was the downgrading to Java 8 (and re-building jpy) that helped. Did you make sure that the snappy process uses your Java 8 installation?

Hi! Thanks for the answer. I also thought this was the problem. But I eventually switched to the use of a Docker container and my scripts are running smoothly inside the container.

Can anyone have proper solution for
java.lang.IllegalArgumentException: org.geotools.styling.StyleFactory is not an ImageIO SPI class

I am confused now. Please help.

Have you tried what @odermatt suggested?
Or what is said here:

It seems to be a problem which is only occuring under rare conditions. There haven’t been many reports in this forum.
What’s your environment you are seeing this error? Good to know would be your Operating system, the Python version, the SNAP version, and the Java version if different from SNAP default Java. Also have you build your own jpy?

I am using it in windows 10
python 3.6
jpy 0.9.0
SNAP 7.0
JAVA version 8 update 231
I used maven and VS to build jpy.
files in my python directory:
C:\Users<name>\anaconda3\Lib\site-packages\jpy.cp37-win_amd64.pyd
C:\Users<name>\anaconda3\Lib\site-packages\jpy-0.9.0.jar
C:\Users<name>\anaconda3\Lib\site-packages\jpyconfig.properties
C:\Users<name>\anaconda3\Lib\site-packages\jpyconfig.py
C:\Users<name>\anaconda3\Lib\site-packages\jpyutil.py
and pycache