Tess4J works standalone in 64 bit windows but does not work in Tomcat 7

Trying OCR with Tess4J and being able to make it work as a standalone application on 64-bit windows. I am using eclipse for the same thing. Now I am trying to create a war of the same code and deploy to Tomcat7 and call the api using a servlet. I am getting the following error.

     java.util.NoSuchElementException
javax.imageio.spi.FilterIterator.next(ServiceRegistry.java:808)
javax.imageio.ImageIO$ImageWriterIterator.next(ImageIO.java:816)
javax.imageio.ImageIO$ImageWriterIterator.next(ImageIO.java:801)
net.sourceforge.vietocr.ImageIOHelper.getImageByteBuffer(ImageIOHelper.java:190)
net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:133)
net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:88)
net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:75)
com.hp.cto.TextReading.doGet(TextReading.java:35)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

      

Any help would be greatly appreciated.

+3


source to share


1 answer


Make sure you have jai_imageio

in CLASSPATH

or in WEB-INF/lib

. Call ImageIO.scanForPlugins();

before calling doOCR

.



+3


source







All Articles