Geoprocessor Job does not exist or is inaccessible
来源:互联网 发布:淘宝自然流量优化 编辑:程序博客网 时间:2024/05/17 06:57
在应用ArcGIS api for JavaScript 进行GP等值线调用的时候,F12调试出现了"jobid" Job does not exist or is inaccessible 错误,意思是这个GP Task的生成的结果不存在或不可用;
但是装载GP Task结果的C:\arcgisserver\arcgisjobs目录下确实生成了这个jobid的结果,经过仔细分析与网上查找,觉得问题应该出现在:gp.submitJob(parms, jobResult_Async);
也就是说GP Task还在执行的时候,jobResult_Async(亦或者是在它前面的函数)就已经执行了并且去调还未完全执行 完毕的任务的结果,那肯定是调不到的了,尤其是耗时比较长的GP任务,更是要出错的了;(这个问题是在ArcGIS S 10.0下遇到的,应该是一个bug吧)
解决方法:
方法1:异步调用换成同步调用(可以解决)
将原有的异步执行gp.submitJob(parms, jobResult_Async)改成:(以等值线为例)
gp.execute(parms,jobResult_Tb);function jobResult_Tb(result){addResults(result[0].value.features);}function addResults(results) {var features=results;for (var f = 0, fl = features.length; f < fl; f++) {var feature = features[f];var symbol = new esri.symbols.SimpleLineSymbol(esri.symbols.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([160, 32, 240 ]), 1);feature.setSymbol(symbol);esrimap.graphics.add(feature);}}经过亲自实践,可以解决问题;
方法2:setUpdateDelay(可以解决)
在gp.submitJob(parms, jobResult_Async)之前加上:
gp.setUpdateDelay(3000);gp.submitJob(parms, jobResult_Async);//异步 resultfunction jobResult_Async(result) {jobId = result.jobId;var status = result.jobStatus;if (status === esri.tasks.JobInfo.STATUS_SUCCEEDED) {// 成功之后,将其中的结果取出来,当然这也是参数名字// 在模型中,想要取出中间结果,需要设置为模型参数gp.getResultData(jobId, "Contour_Output", addResults);}}function addResults(results) {var features = results.value.features;//注意与同步执行的区别for (var f = 0, fl = features.length; f < fl; f++) {var feature = features[f];var symbol = new esri.symbols.SimpleLineSymbol(esri.symbols.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([160, 32, 240 ]), 1);feature.setSymbol(symbol);// gl_stations.add(feature);esrimap.graphics.add(feature);}}setUpdateDelay(5000)很有意思,经过调试分析笔者发现:
当到达5秒时如果GP任务已经执行结束,则执行jobResult_Async
如果5秒了GP任务还正在执行(arcgisjobs中文件正在生成),则推迟到5*2也就是10秒后再执行jobResult_Async,无论任务是否执行完毕;
也就是说如果想用此法解决出现的问题,那么就要预估也就是看arcgisjobs下执行完GP任务大概需要多长时间,然后再加一点时间,比如用时15秒,那么这里可以写setUpdateDelay(20000、25000),如果某一次任务在20秒后还没执行完,则程序将等待到40秒再去执行jobResult_Async,如果40秒后还没执行完,不好意思,会报之前同样的的错误;
方法3:gpError(这个解决问题的方法很蛋疼)
gp.submitJob后面可以跟一个gpError函数,也就是当GP 任务出现问题的时候执行它
function gpError(e) { if (e.message.search("does not exist or is inaccessible") > -1) { var jobId = e.message.replace(/Job '([a-z,0-9]*)' does not exist or is inaccessible\./, "$1"); gp.getResultData(jobId, "Output_PDF"); } else { showDialog(dojo.string.substitute('<h1>Error: ${error}</h1>', { error: e.message })); }}怎么样?够恶心吧,在出现错误的函数中去调用任务结果...没有试过,看着就蛋疼;
方法4:ArcGIS 10.1 及以上版本(没有尝试)
本错误是在ArcGIS 10.0中遇到的,网上有说换成高版本的就好了,这个是10.0的bug
由于系统涉及了好多GP服务,如果换版本还要有大量改动,所以笔者没有尝试,如果哪位读者尝试了可以留言告知
方法5:ArcGIS Server发布GP 与 程序分在两个机器上(没有尝试)
网上解决方法还有说将GP服务与程序分在两个机器上就不会有该问题了,由于不符合本项目部署条件,笔者没有尝试,如果哪位读者尝试了可以留言告知
谢谢大家!
阅读全文
1 0
- Geoprocessor Job does not exist or is inaccessible
- 关于Service 'XXXX' of type 'MapServer' does not exist or is inaccessible问题的解决
- Service 'china' of type 'MapServer' does not exist or is inaccessible
- About Derby "ERROR 42X51: The class '***' does not exist or is inaccessible. This can hap pen if the class is not public."
- does not exist or is not a readable directory
- ..\TestApp does not exist or is not a readable directory
- If the job does not exist, an error from msdb.dbo.sp_delete_job is expected
- netbean中does not exist or is not a readable错误的解决
- 关于error C2871: 'std' : does not exist or is not a namespace处理
- netbean中does not exist or is not a readable错误的解决
- 关于VC中 error C2871: 'std' : does not exist or is not a namespace
- java.lang.IllegalArgumentException: Document base *** does not exist or is not a readable
- 启动Tomcat6.x时manager does not exist or is not a readable directory
- [转]启动Tomcat6.x时manager does not exist or is not a readable directory
- java.lang.IllegalArgumentException: Document base XXXXX does not exist or is not a readable directory
- 启动Tomcat报异常host-manager does not exist or is not a readable directory
- Tomcat报 XXX does not exist or is not a readable directory错误时的解决办法
- java.lang.IllegalArgumentException: Document base *** does not exist or is not a readable
- [射线法]判断一个点是否在多边形内部
- linux ubuntu 安装VirtualBox
- 夜灵的Html笔记Day06——群组、后代、伪类选择器,尺寸、边框、倒角、阴影、盒子模型
- vector::erase()函数调用出错问题
- 汇编语言---GCC内联汇编
- Geoprocessor Job does not exist or is inaccessible
- freemaker的使用
- 推荐几个精致的web UI框架及常用前端UI框架
- 【剑指】 面试题58 翻转单词顺序
- 总线基础--UART
- CentOS 更换阿里云源
- JDBC数据库之添加数据
- Ajax工作原理
- hdu 3068 最长回文 (manacher算法)