简体   繁体   中英

Tess4j with Wildfly

I would like to use Wildfly 11 and Tess4j library. I have a simple program and it´s working.

    public static void main(String[] args) {
    File imageFile = new File("myPath.pdf");
    ITesseract instance = new Tesseract(); // JNA Interface Mapping
    instance.setDatapath("myPath/tessdata");
    instance.setLanguage("deu");

    System.setProperty("jna.encoding", "UTF8");
    instance.setOcrEngineMode(TessAPI.TessOcrEngineMode.OEM_DEFAULT);

    try {
        String result = instance.doOCR(imageFile);
        System.out.println(result);
    } catch (TesseractException e) {
        System.err.println(e.getMessage());
    }
}

-> It´s working if I try to run the program as "JAVA application" from Eclipse but if I try to execute the program from my Wildfly application server, I got an error:

> trcmp(locale, "C"):Error:Assert failed:in file baseapi.cpp, line 209
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x000000012c7a78af, pid=11404, tid=0x000000000000c80b
#
# JRE version: Java(TM) SE Runtime Environment (8.0_121-b13) (build 1.8.0_121-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.121-b13 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [libtesseract.dylib+0x1568af]  _ZNK7ERRCODE5errorEPKc16TessErrorLogCodeS1_z+0x183
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:

Any ideas? I´m using tess4j 4.3.0 and I installed also Ghostscript... There might be any different between single JAVA application and Wildfly server.

It complaints about the locale. You'll need to set it to C when you start your Java app server:

export LC_ALL=C

https://github.com/nguyenq/tess4j/issues/105

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM