将jar文件添加到jpype会使Java崩溃

时间:2019-01-04 19:29:12

标签: java python flask jpype jaydebeapi

我正在使用flask-appbuilder来构建应用程序。为了提交执行ddl的表单,我在startJVM()时向jarype添加了一个jar文件,但是java总是崩溃。下面是我的代码:

# A fatal error has been detected by the Java Runtime Environment:
#  
#  SIGSEGV (0xb) at pc=0x00007fce15f978b9, pid=12, tid=0x00007fce0f7fe700
#
# JRE version: OpenJDK Runtime Environment (8.0_181-b13) (build 1.8.0_181-8u181-b13-2~deb9u1-b13)
# Java VM: OpenJDK 64-Bit Server VM (25.181-b13 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [_jpype.cpython-37m-x86_64-linux-gnu.so+0x3f8b9]  
JPJavaEnv::NewLocalRef(_jobject*)+0x9
#
# 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_pid12.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp

这是崩溃错误,我尝试了“ ulimit -c unlimited”,但是没有运气。

com.sun.javafx.application.Application

1 个答案:

答案 0 :(得分:0)

我使用了multi_threading,这就是原因。

Jaydebeapi使用jpype启动JVM。您需要在线程主体中使用jpype.attachThreadToJVM()才能使JVM在该线程中可用。您可以使用jpype.isThreadAttachedToJVM()来检查其附件。