API Bytedeco Tesseract не работает внутри DockerJAVA

Программисты JAVA общаются здесь
Ответить
Anonymous
 API Bytedeco Tesseract не работает внутри Docker

Сообщение Anonymous »

Код: Выделить всё

import org.bytedeco.tesseract.TessBaseAPI;

public class TesseractInitExample {
public static void main(String[] args) {
// Create a new Tesseract API instance
TessBaseAPI api = new TessBaseAPI();

// Set the path to tessdata and language (change accordingly)
String dataPath = "/root/GitHub/tessdata_best";
String language = "eng";

// Initialize Tesseract
if (api.Init(dataPath, language) != 0) {
System.err.println("Could not initialize Tesseract.");
return;
}

System.out.println("Tesseract initialized successfully!");

// Cleanup
api.End();
}
}
Ниже находится файл docker

Код: Выделить всё

FROM gradle:8.11.1-jdk17-alpine AS build

RUN apk add --no-cache git
RUN git clone --branch main --single-branch https://github.com/tesseract-ocr/tessdata_best.git /root/GitHub/tessdata_best

COPY --chown=gradle:gradle . /home/gradle/src
WORKDIR /home/gradle/src
RUN gradle build --no-daemon -x test

FROM eclipse-temurin:17.0.13_11-jdk-alpine

COPY --from=build /root/GitHub/tessdata_best /root/GitHub/tessdata_best

RUN apk add --no-cache \
tesseract-ocr \
leptonica-dev

VOLUME /tmp
ARG JAVA_OPTS
ENV JAVA_OPTS=$JAVA_OPTS

RUN mkdir /app
COPY --from=build /home/gradle/src/build/libs/*.jar /app/extract.jar
ENTRYPOINT ["java", "-XX:+UnlockExperimentalVMOptions", "-Djava.security.egd=file:/dev/./urandom","-jar","/app/extract.jar"]
При запуске контейнера во время инициализации появляется ошибка ниже.

Код: Выделить всё

3.362 seconds (process running for 4.095)
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000000005f2b0, pid=1, tid=7
#
# JRE version: OpenJDK Runtime Environment Temurin-17.0.13+11 (17.0.13+11) (build 17.0.13+11)
# Java VM: OpenJDK 64-Bit Server VM Temurin-17.0.13+11 (17.0.13+11, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# C  [libtesseract.so.5.5+0x14b9c8]  tesseract::CHAR_FRAGMENT::parse_from_string(char const*)+0xc8
#
# Core dump will be written. Default location: Core dumps may be processed with "/wsl-capture-crash %t %E %p %s" (or dumping to //core.1)
#
# An error report file with more information is saved as:
# //hs_err_pid1.log
#
# If you would like to submit a bug report, please visit:
#   https://github.com/adoptium/adoptium-support/issues
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Невозможно обнаружить эту ошибку. Как я могу решить эту проблему (отлично работает в Windows локально)?

Подробнее здесь: https://stackoverflow.com/questions/793 ... ide-docker
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «JAVA»