Question

5
Replies
238
Views
Ravi Kumar Pisupati Member since 2015 74 posts
Optum
Posted: 2 months ago
Last activity: 1 month 2 weeks ago

Unable to call Tesseract API to instantiate Tesseract object from Pega PE V84 after installation of necessary jar files

Hi,

I am trying to use Tesseract API (open source) from Pega to implement OCR (img to txt) functionality. For that, I have done the below steps but I am unable to instantiate the object of Tesseract. 

1) Installed the "tess4j-3.4.8.jar" in the Pega PE using import wizard. This is the imp jar for Tesseract API integration.

2) Added the jar location in the System -> Settings -> Compiler like below.

C:\Users\rpisupat\Documents\V84\PRPCPersonalEdition\tomcat\lib\Jars\tess4j\tess4j-3.4.8.jar;

Also tried to use the below in the same settings.

C:/Users/rpisupat/Documents/V84/PRPCPersonalEdition/tomcat/lib/Jars/tess4j/tess4j-3.4.8.jar;

3) Restarted the Tomcat server to test this API from a simple java step in an activity like below

=========================================================================

oLog.infoForced("** Hello!! ");  

net.sourceforge.tess4j.Tesseract tesseract = new net.sourceforge.tess4j.Tesseract();

//net.sourceforge.tess4j.Tesseract tesseract; //tesseract= net.sourceforge.tess4j.Tesseract.getInstance(); //net.sourceforge.tess4j.ITesseract tesseract = new net.sourceforge.tess4j.Tesseract();

//String exportPath= tools.getProperty("pxProcess.pxServiceExportPath").getStringValue(); //String filePath=exportPath+"SampleImage.jpg";

//java.io.File imgfile = new java.io.File(filePath);

oLog.infoForced("** Hi!!");

try{

  //String result = tesseract.doOCR(imgfile);   //oLog.infoForced("** Text from the image!! "+result); 

}catch(Exception e)   {  oLog.infoForced("**Err "+e);   }

===================================================================

The highlighted line is giving PRRuntime err in the log and not printing the last oLog statement. After digging the details from tomcat console, I came to know that the err is due to the exception caused by: java.lang.NoClassDefFoundErr: net/sourceforge/test4j/Tesseract

Any expert who can help me in this regards is greatly appreciated.

Pega Platform 8.4 System Administration
Share this page LinkedIn