【问题标题】:Tess4j with WildflyTess4j 与 Wildfly
【发布时间】:2018-12-26 19:18:19
【问题描述】:

我想使用 Wildfly 11 和 Tess4j 库。 我有一个简单的程序,它正在运行。

    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());
    }
}

-> 如果我尝试从 Eclipse 将程序作为“JAVA 应用程序”运行,但如果我尝试从 Wildfly 应用程序服务器执行程序,则会出现错误:

> 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:

有什么想法吗? 我正在使用 tess4j 4.3.0 并且我还安装了 Ghostscript ... 单个 JAVA 应用程序和 Wildfly 服务器之间可能存在任何不同。

【问题讨论】:

    标签: java ocr tess4j


    【解决方案1】:

    它抱怨语言环境。您需要在启动 Java 应用服务器时将其设置为 C

    export LC_ALL=C

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

    【讨论】:

    • 谢谢,但我也可以直接在代码中执行此操作吗?或者我应该在哪里设置?
    • 把它放在启动你的Java服务器实例的脚本中。或者尝试使用 JNA 方法来设置语言环境,如 github.com/nguyenq/tess4j/issues/106 中所述。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-27
    • 1970-01-01
    • 1970-01-01
    • 2016-10-28
    • 2013-09-05
    • 1970-01-01
    相关资源
    最近更新 更多