django 使用jpype 报错:raise+OSError('JVM+cannot+be+restarted')
#调用jar包
def getJar(arg1,arg2):
jarpath = os.path.join(os.path.abspath('.'), 'tools/GetTest-1.0-SNAPSHOT.jar')
print(jarpath)
if not jpype.isJVMStarted():
print('--------startjvm---------')
jpype.startJVM(jpype.getDefaultJVMPath(), "-ea", "-Djava.class.path=%s" % jarpath)
if not jpype.isThreadAttachedToJVM():
print('-----attaching jvm-----')
jpype.attachThreadToJVM()
Client = jpype.JClass('cn.test.Client') #调用jar包非静态方法
t = Client()
result = t.getPhoneSecretKey(arg1, arg2)
time.sleep(1)
#jpype.shutdownJVM() 一定要注释掉!!!!!!
return result def inter(request):
if request.method == "POST":
try:
result = getJar(arg1, arg2)
except Exception as e:
print('traceback.print_exc():' + traceback.print_exc())
return JsonResponse({'result':'500'})
return JsonResponse(result)
django 使用jpype 报错:raise+OSError('JVM+cannot+be+restarted')的更多相关文章
- Django报错:OSError: raw write() returned invalid length 4 (should have been between 0 and 2)
在使用Django时Django报错:Django报错:OSError: raw write() returned invalid length 4 (should have been between ...
- django startproject xxx:报错UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 13: ordinal not in range(128)
django startproject xxx:报错UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 13: o ...
- python-----贴图 和 报错:OSError: image file is truncated (8 bytes not processed)的处理
将一张图片贴到另一张图片上,代码如下: from PIL import Image import os from PIL import ImageFile ImageFile.LOAD_TRUNCAT ...
- Django迁移数据库报错
Django迁移数据库报错 table "xxx" already exists错误 django在migrate时报错django migrate error: table 'x ...
- IDE安装完成无法打开,报错Fail load JVM DLL 问题与解决方案
安装完成pycharm 在打开pycharm的时候出现报错 Fail load JVM DLL xxxx xxx. 解决方案 安装Microsoft Visual C++ 2010 Redistrib ...
- 训练DQN,报错:OSError: [Errno 12] Cannot allocate memory
训练DQN,报错:OSError: [Errno 12] Cannot allocate memory 问题介绍: 这两天在做强化学习的作业,使用 DQN 打 Atari 游戏,但在训练过程中,出现了 ...
- django正常运行确报错的解决方法
django正常运行却报错的处理方法 出处 : https://www.infvie.com/ops-notes/django-normal-operation-error 报错一:self._soc ...
- Django:报错 raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc)
Django 执行迁移生成表: python manage.py migrate 报错: raise MigrationSchemaMissing("Unable to create the ...
- pycharm安装jpype报错及解决方法
安装jpype时发生报错: 按照提示去装了Microsoft visual C++,结果重新安装还是报错,根据https://blog.csdn.net/qq_38934189/article/det ...
随机推荐
- jrebel 插件使用
最近遇到一件神奇的事情,idea原本配置了热部署,但是修改java文件之后需要重启俩次才能编译成功,网上各种问度娘都没有解决,偶尔看到了jrebel这个插件,折腾了一番,终于完美解决,记录一下,供后来 ...
- LESS语法学习笔记
LESS 通过编写less文件来快速生成css文件,对css的语法进行了扩展 Less语法 注释 单行注释不会被编译,多行才会被编译 变量 less:定义变量用@ scss:定义变量用$ @num: ...
- php代码审计之命令执行中windows/linux的差异化问题
昨天好基友发来了一段代码,还是挺有趣的,记录下: <?php $a = '\''.str_replace("'","\'",$_GET[1]).'\''; ...
- 分布式调度任务-ElasticJob
一:问题的引出与复现 在一个风和日丽的工作日,公司运营发现系统的任务数据没有推送执行,整个流程因此停住了.我立马远程登陆服务器,查看日志,好家伙,系统在疯狂的打印相同的一段日志:c.d.d.j.i.e ...
- 深度学习白平衡(Color Constancy,AWB):ICCV2019论文解析
深度学习白平衡(Color Constancy,AWB):ICCV2019论文解析 What Else Can Fool Deep Learning? Addressing Color Constan ...
- Yolo:实时目标检测实战(上)
Yolo:实时目标检测实战(上) YOLO:Real-Time Object Detection 你只看一次(YOLO)是一个最先进的实时物体检测系统.在帕斯卡泰坦X上,它以每秒30帧的速度处理图像, ...
- 编写CUDA内核
编写CUDA内核 介绍 与用于CPU编程的传统顺序模型不同,CUDA具有执行模型.在CUDA中,编写的代码将同时由多个线程(通常成百上千个)执行.解决方案将通过定义网格,块和线程层次结构进行建模. N ...
- springmvc自定义的拦截器以及拦截器的配置
一.自定义拦截器 Spring MVC也可以使用拦截器对请求进行拦截处理,用户可以自定义拦截器来实现特定的功能,自定义的拦截器必须实现HandlerInterceptor接口. 二.HandlerIn ...
- 【NX二次开发】获取当前鼠标选择的对象 UF_UI_ask_global_sel_object_list
先选择多个对象object,然后使用此函数获取选择的对象的tag,最后就可以使用object的一些函数了. ufun例子: extern DllExport void ufusr(char *parm ...
- 搭建 MySQL 高可用高性能集群
什么是MySQL集群,什么是MySQL集群,如果你想知道什么是MySQL集群,我现在就带你研究. MySQL 是一款流行的轻量级数据库,很多应用都是使用它作为数据存储.作为小型应用的数据库,它完全可以 ...