Issue with registration of java twelvemonkeys registration for Deeplearning app

853 Views Asked by At

I am trying to register for a servlet the following and getting an exception. The code is:

static {
        IIORegistry registry = IIORegistry.getDefaultInstance();
        registry.registerServiceProvider(new com.twelvemonkeys.servlet.image.IIOProviderContextListener());
        registry.registerServiceProvider(new com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReaderSpi());
        registry.registerServiceProvider(new com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageWriterSpi());
    }

I am getting the following exception thrown. Funny thing is I only am using the read not the write. I am using the 3.6 version of twelvemonkeys.

Thanks for any hints!

Exception in thread "main" java.lang.NoSuchMethodError: com.twelvemonkeys.imageio.util.IIOUtil.lookupProviderByName(Ljavax/imageio/spi/ServiceRegistry;Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;
    at com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageWriterSpi.onRegistration(JPEGImageWriterSpi.java:82)
    at javax.imageio.spi.SubRegistry.registerServiceProvider(Unknown Source)
    at javax.imageio.spi.ServiceRegistry.registerServiceProvider(Unknown Source)
    at javax.imageio.spi.IIORegistry$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.imageio.spi.IIORegistry.registerInstalledProviders(Unknown Source)
    at javax.imageio.spi.IIORegistry.registerStandardSpis(Unknown Source)
    at javax.imageio.spi.IIORegistry.<init>(Unknown Source)
    at javax.imageio.spi.IIORegistry.getDefaultInstance(Unknown Source)
    at deeplearningtest.test.<clinit>(test.java:32)
1

There are 1 best solutions below

0
Tony Anecito On

Ok, I solved the problem. I went to https://github.com/haraldk/TwelveMonkeys#manual-dependency-example and I re-downloaded all the jars mentioned in the article making sure I paid close attention to the versions to make sure 3.6 was selected since 3.6 is not shown as part of the jar name (which I liked). Once I restarted eclipse I got past that problem. Many thanks haraldK!