I get this error while the application is running tesseract.doOCR(image)
inside a Docker container.
<code>java.lang.UnsatisfiedLinkError: Unable to load library 'tesseract':
Error loading shared library libtesseract.so: No such file or directory
Error loading shared library libtesseract.so: No such file or directory
Native library (linux-x86-64/libtesseract.so) not found in resource path ([jar:file:/app/app.war!/WEB-INF/classes!/, .................
............
layertools-2.5.5.jar!/])
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:301)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:461)
at com.sun.jna.Library$Handler.<init>(Library.java:192)
at com.sun.jna.Native.loadLibrary(Native.java:646)
at com.sun.jna.Native.loadLibrary(Native.java:630)
at net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(LoadLibs.java:85)
at net.sourceforge.tess4j.TessAPI.<clinit>(TessAPI.java:42)
at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:427)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:311)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:294)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:275)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:259)
</code>
<code>java.lang.UnsatisfiedLinkError: Unable to load library 'tesseract':
Error loading shared library libtesseract.so: No such file or directory
Error loading shared library libtesseract.so: No such file or directory
Native library (linux-x86-64/libtesseract.so) not found in resource path ([jar:file:/app/app.war!/WEB-INF/classes!/, .................
............
layertools-2.5.5.jar!/])
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:301)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:461)
at com.sun.jna.Library$Handler.<init>(Library.java:192)
at com.sun.jna.Native.loadLibrary(Native.java:646)
at com.sun.jna.Native.loadLibrary(Native.java:630)
at net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(LoadLibs.java:85)
at net.sourceforge.tess4j.TessAPI.<clinit>(TessAPI.java:42)
at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:427)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:311)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:294)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:275)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:259)
</code>
java.lang.UnsatisfiedLinkError: Unable to load library 'tesseract':
Error loading shared library libtesseract.so: No such file or directory
Error loading shared library libtesseract.so: No such file or directory
Native library (linux-x86-64/libtesseract.so) not found in resource path ([jar:file:/app/app.war!/WEB-INF/classes!/, .................
............
layertools-2.5.5.jar!/])
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:301)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:461)
at com.sun.jna.Library$Handler.<init>(Library.java:192)
at com.sun.jna.Native.loadLibrary(Native.java:646)
at com.sun.jna.Native.loadLibrary(Native.java:630)
at net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(LoadLibs.java:85)
at net.sourceforge.tess4j.TessAPI.<clinit>(TessAPI.java:42)
at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:427)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:311)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:294)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:275)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:259)
In directory, application run is working, without installing library separately. I get this error while the application is running tesseract.doOCR(image)
inside a Docker container.
None of options are working for tesseract. If I install tesseract with Docker file, it’s giving some env value set etc., and then it fails to read the eng.traineddata file.
The dependency I’m using:
<code><dependency>
<groupId>net.sourceforge.tess4j</groupId>
<artifactId>tess4j</artifactId>
<version>4.5.4</version>
</dependency>
</code>
<code><dependency>
<groupId>net.sourceforge.tess4j</groupId>
<artifactId>tess4j</artifactId>
<version>4.5.4</version>
</dependency>
</code>
<dependency>
<groupId>net.sourceforge.tess4j</groupId>
<artifactId>tess4j</artifactId>
<version>4.5.4</version>
</dependency>
My Docker file:
<code>FROM openjdk:8-jdk-alpine
WORKDIR /app
COPY ./target/MyApp.war app.war
ENTRYPOINT ["java", "-jar", "app.war"]
</code>
<code>FROM openjdk:8-jdk-alpine
WORKDIR /app
COPY ./target/MyApp.war app.war
ENTRYPOINT ["java", "-jar", "app.war"]
</code>
FROM openjdk:8-jdk-alpine
WORKDIR /app
COPY ./target/MyApp.war app.war
ENTRYPOINT ["java", "-jar", "app.war"]