OCR exception with multiple threads

Hi, im trying to process multiple images in multiple threads of a class named OCR


(code in green, exception in red)

i get an exception before i but in a picture.

public class OCR implements Runnable {

String ThreadNr;
OcrEngine ocr;

public OCR(String Thread) {
ThreadNr = Thread;
}

@Override
public void run() {
ocr = new OcrEngine();
while (true) {
System.out.println("Thread nr.: " + ThreadNr);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
}
}


I create and start the threads with the main class

public static void main(String[] args) throws IOException, TesseractException {
Thread t0 = new Thread(new OCR(“1”));
t0.start();
Thread t1 = new Thread(new OCR(“2”));
t1.start();
}

when i run one of them it’s ok, but when i run two i get exceptions like this:

Exception in thread “Thread-0” class com.aspose.ocr.internal.bcc: Resource file is not correct. —> class com.aspose.ocr.OcrException: Unknow type. Use ResourceType or DrFontStyle only.
com.aspose.ocr.internal.bbx.a(Unknown Source)
com.aspose.ocr.internal.bcb.a(Unknown Source)
com.aspose.ocr.LanguageFactory.a(Unknown Source)
com.aspose.ocr.LanguageContainer.a(Unknown Source)
com.aspose.ocr.LanguageContainer.(Unknown Source)
com.aspose.ocr.OcrEngine.(Unknown Source)
javaapplication12.OCR.run(OCR.java:25)
java.lang.Thread.run(Thread.java:745)
— End of inner exception stack trace —
com.aspose.ocr.internal.bcb.a(Unknown Source)
com.aspose.ocr.LanguageFactory.a(Unknown Source)
com.aspose.ocr.LanguageContainer.a(Unknown Source)
com.aspose.ocr.LanguageContainer.(Unknown Source)
com.aspose.ocr.OcrEngine.(Unknown Source)
javaapplication12.OCR.run(OCR.java:25)
java.lang.Thread.run(Thread.java:745)
at com.aspose.ocr.internal.bcb.a(Unknown Source)
at com.aspose.ocr.LanguageFactory.a(Unknown Source)
at com.aspose.ocr.LanguageContainer.a(Unknown Source)
at com.aspose.ocr.LanguageContainer.(Unknown Source)
at com.aspose.ocr.OcrEngine.(Unknown Source)
at javaapplication12.OCR.run(OCR.java:25)
at java.lang.Thread.run(Thread.java:745)
Caused by: class com.aspose.ocr.OcrException: Unknow type. Use ResourceType or DrFontStyle only.
com.aspose.ocr.internal.bbx.a(Unknown Source)
com.aspose.ocr.internal.bcb.a(Unknown Source)
com.aspose.ocr.LanguageFactory.a(Unknown Source)
com.aspose.ocr.LanguageContainer.a(Unknown Source)
com.aspose.ocr.LanguageContainer.(Unknown Source)
com.aspose.ocr.OcrEngine.(Unknown Source)
javaapplication12.OCR.run(OCR.java:25)
java.lang.Thread.run(Thread.java:745)
at com.aspose.ocr.internal.bbx.a(Unknown Source)
… 7 more


Hi Christian,

Thank you for your inquiry.

Please, note that we have carried out testing at our end. We have executed the code provided by you in the post while using latest version Aspose.OCR for Java 2.9.0. We are able to notice the said issue. Therefore the issue has been logged into our issue tracking system with ID OCR-34206. Our product team will further look into it and provide updates. We will inform you accordingly.

In the mean while, if there is any issue please feel free to reach us. We will be glad to assist you.

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.