java Tesseract 3.0和Tesser4j使linux服务器上的应用程序崩溃
我在java应用程序中使用Tesseract 3.04和TesserJ3.0.0。 在我的应用程序中,我为OCR创建了一个实现Runnable的服务
应用程序部署在Centos 6中
下面的代码正在使用中
Tesseract1 instance = new Tesseract1();
result = instance.doOCR("pathtodocument/abc.pdf");
我根据用户的请求从文档上传服务启动OCR服务线程,并处理PDF中的文本数据
当我为单个请求测试代码时,它工作得非常完美。 问题是: 当我一次发送多个请求时,整个应用程序就会崩溃
下面是catalina中的错误。出去
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f9514000078, pid=12979, tid=140277704374016
#
# JRE version: Java(TM) SE Runtime Environment (8.0_74-b02) (build 1.8.0_74-b02)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.74-b02 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C 0x00007f9514000078
#
# 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:
# //hs_err_pid12979.log
#
# If you would like to submit a bug report, please visit:
当我将调试器投入服务并执行应用程序时,一切正常
# 1 楼答案
为Tesseract1创建bean
在用:autowire Tesseract
将doOcr方法放入同步块中
现在,服务线程将在不使应用程序崩溃的情况下运行
注意:我们正在取消同步文档请求的并发OCR