Search code examples
weblogictiffjavax.imageiojai

Weblogic server - Getting NoClassDeffError for TIFFImageReader even when the library is in classpath


I am working on TIFF to JPEG conversion program. I am using the TIFF implementation from jai-imageio-core.1.3.1.jar, which is available in the classpath.

Everything works fine in my local environment in eclipse (running on tomcat server). However, when I deploy the same in Weblogic, I am getting the following error. Weblogic server is unable to recognize the TIFF implementation classes. I am unable to find the missing link. Please help.

java.lang.NoClassDefFoundError: com/github/jaiimageio/impl/plugins/tiff/TIFFImageReader
        at com.github.jaiimageio.impl.plugins.tiff.TIFFImageReaderSpi.createReaderInstance(TIFFImageReaderSpi.java:118)
        at javax.imageio.spi.ImageReaderSpi.createReaderInstance(ImageReaderSpi.java:320)
        at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:529)
        at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:513)
        at javax.imageio.ImageIO.read(ImageIO.java:1443)
        at javax.imageio.ImageIO.read(ImageIO.java:1308)

Solution

  • I will answer my own question. The issue is resolved. The problem was with the the jai-imageio-core.1.3.1.jar file present in multiple places. It was present in my application war file in WEB-INF/lib folder. however, the same jar file was also present outside the war in the weblogic adm root directory. (my bad)

    I guess weblogic clearly expects the jar file only in 1 place (especially java SPI implementation jar)

    It is also a good idea to search all directories under weblogic to make sure there are no additional jar files of the same name.