程序在我使用Java 6时运行良好,但切换到Java 7后出现错误。相同的图像文件已用于测试,因此可能不是图像格式的问题。
部分代码:(ImageIO.write行发生错误)
try {
ImageIO.write(bimage, format, bstream);
bstream.close();
return bstream.toByteArray();
} catch (IOException e) {
throw new RuntimeException(e);
}
错误:
java.util.ServiceConfigurationError: javax.imageio.spi.ImageReaderSpi: Provider com.slb.imageio.plugins.wsq.writer.WSQImageWriterSpi not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:231)
at java.util.ServiceLoader.access$300(ServiceLoader.java:181)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:369)
at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
at javax.imageio.spi.IIORegistry$1.run(IIORegistry.java:241)
at java.security.AccessController.doPrivileged(Native Method)
at javax.imageio.spi.IIORegistry.registerInstalledProviders(IIORegistry.java:249)
at javax.imageio.spi.IIORegistry.registerStandardSpis(IIORegistry.java:184)
at javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:137)
at javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:159)
at javax.imageio.ImageIO.<clinit>(ImageIO.java:65)
不仅 ImageIO.write(),其他 ImageIO 方法也不能正常工作,例如:
JPEGImageWriter imageWriter = (JPEGImageWriter)ImageIO.getImageWritersBySuffix("jpeg").next();
ImageOutputStream ios = ImageIO.createImageOutputStream(out);
我尝试搜索类似的错误,但没有找到解决方案。谁能帮我这个?谢谢