java.util.ServiceConfigurationError:无法实例化提供程序 [英] java.util.ServiceConfigurationError: Provider could not be instantiated

查看:698
本文介绍了java.util.ServiceConfigurationError:无法实例化提供程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要转换为.jpg.jp2图像文件.

I have a .jp2 image file that I want to convert to .jpg.

    BufferedImage background = ImageIO.read(new File("images\\"
    + randNum + ".jp2"));
    ImageIO.write(background, "jpg", new File("images\\" + randNum
                + ".jpg"));

我有这个例外:

java.util.ServiceConfigurationError: javax.imageio.spi.ImageWriterSpi:  Provider com.github.jaiimageio.jpeg2000.impl.J2KImageWriterSpi could not be instantiated
 ...
Caused by: java.lang.NoClassDefFoundError: com/github/jaiimageio/impl/common/PackageUtil
 ...
Caused by: java.lang.ClassNotFoundException: com.github.jaiimageio.impl.common.PackageUtil

推荐答案

显然,发生了冲突,我使用的是来自不同库的类,在这里我同时具有jai_imageiojai-imageio-jpeg2000,我通过简单地删除来解决了这个问题其中之一.

Apparently, a conflict occured, I was using classes from different libraries, here I had both jai_imageio and jai-imageio-jpeg2000, I solved this problem by simply removing one of them.

这篇关于java.util.ServiceConfigurationError:无法实例化提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆