There are many examples on the Internet, and errors are reported during Web operations.
Java. util. nosuchelementexception at javax. ImageIO. SPI. filteriterator. Next (unknown source)
Environment:
JDK: jdk_1.6.0_30 used for compiling and running JDK: jdk_1.7.0_11
Web Container: tomcat-6.0.32
After a breakpoint test, it was found that (imageformat is not in the Image Format)
Iterator <imagereader> readers =ImageIO. getimagereadersbyformatname (imageformat );
In the iterator, readers shows that next is empty (or zerolist is empty in ITER ). I thought that some classes are not loaded and started to experiment with class. forname ("XX") separately. Later, you can manually register before the iterator.
Iioregistry registry =Iioregistry. getdefaultinstance (); Registry. registerserviceprovider (NewCom. Sun. Media. imageioimpl. plugins. Tiff. Fig (); Registry. registerserviceprovider (NewCom. Sun. Media. imageioimpl. plugins. Tiff. Unzip imagereaderspi ());
And then run it.
Reference: http://bbs.csdn.net/topics/370193992