Hi,
I’m evaluating a OCR software with a Domino 8.01 on a Windows 2003 server. It’s called Asprise OCR for Java and consist of a some .jar files (that I include in my Java agent) and some .dll (that I put inside the “Windows\System32” folder of the server)
Here’s the URL of the OCR software:
Here’s my code:
import lotus.domino.*;
import com.asprise.util.ocr.OCR;
import com.asprise.util.pdf.PDFReader;
import java.io.File;
import java.awt.image.BufferedImage;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
// Extract text from a PDF (image)
OCR ocr = new OCR();
PDFReader reader = new PDFReader(new File("c:\\input_img.pdf"));
reader.open();
int pages = reader.getNumberOfPages();
for (int i=0; i < pages; i++) {
BufferedImage image = reader.getPageAsImage(i);
String text = ocr.recognizeCharacters(image);
System.out.println(text);
}
reader.close();
ocr=null;
} catch(Exception e) {
e.printStackTrace();
}
}
}
When I run it the first time, it works as expected and display the text from the PDF (once OCRed).
When I run it a second time, I receive the following error:
05/12/2009 11:04:00 AM HTTP JVM: Exception in thread “AgentThread: JavaAgent”
05/12/2009 11:04:00 AM HTTP JVM: java.lang.UnsatisfiedLinkError: AspriseOCR (Library is already loaded in another ClassLoader)
05/12/2009 11:04:00 AM HTTP JVM: at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:979)
05/12/2009 11:04:00 AM HTTP JVM: at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:948)
05/12/2009 11:04:00 AM HTTP JVM: at java.lang.System.loadLibrary(System.java:453)
05/12/2009 11:04:00 AM HTTP JVM: at com.asprise.util.ocr.OCR.loadLibrary(OCR.java:247)
05/12/2009 11:04:00 AM HTTP JVM: at com.asprise.util.ocr.OCR.(OCR.java:56)
05/12/2009 11:04:00 AM HTTP JVM: at JavaAgent.NotesMain(JavaAgent.java:13)
05/12/2009 11:04:00 AM HTTP JVM: at lotus.domino.AgentBase.runNotes(Unknown Source)
05/12/2009 11:04:00 AM HTTP JVM: at lotus.domino.NotesThread.run(Unknown Source)
I need to restart the server to make it works again. But then, it will work again the first time the agent is called.
I have the same problem if I run this agent locally on my workstation.
However, when I run that same code locally on my workstation using Eclipse, It always work… I never receive that error.
Can someone help me on this?
Thanks!