简体   繁体   English

Rserve异常“评估失败,请求状态:错误代码:127”

[英]Rserve Exception “eval failed, request status: error code: 127”

I tried to execute some r code from java using Rserve: 我试图使用Rserve从Java执行一些r代码:

try {
    RConnection conn = new RConnection();
    conn.eval("write.csv(PoS, file = 'C:/test/PoS.csv',row.names=FALSE)");
} catch (REngineException eR) {
    System.err.println("Exception: "+ eR);
    throw new TestException("syntax error on eval on R code");        
} catch(Exception e){
    e.printStackTrace();
    throw new TestException("parseAndEval did not generate an exception on syntax error" );    
}

I got the eval failed error. 我收到评估失败的错误。 But I can successfully execute the Rcode in R: 但是我可以在R中成功执行Rcode:

write.csv(PoS, file = 'C:/test/PoS.csv',row.names=FALSE)

I am sure that Rserve() has been started on the R side, and other statements like 我确定Rserve()已在R端启动,并且其他语句如

conn.eval("iris");

is possible. 是可能的。

I have solved this issue. 我已经解决了这个问题。 The matrix PoS need to be reloaded, every time I establish a new Rconnection, or save it in the default workspace image alternatively. 每次我建立新的Rconnection时,都需要重新加载矩阵PoS ,或者将其保存在默认的工作区映像中。

To get the proper error message, use this instead of simple eval 要获取正确的错误消息,请使用此代替简单的eval

REXP rResponseObject = rServeConnection.parseAndEval("try(eval("+R_COMMAND_OR_SOURCE_FILE_PATH+"),silent=TRUE)");
 if (rResponseObject.inherits("try-error")) { 
LOGGER.error("R Serve Eval Exception : "+rResponseObject.asString()); 
}

This logger prints exact error thrown from R. 该记录器打印从R引发的确切错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在R和Java中解决异常“评估失败,请求状态:错误代码:127”? - How to resolve exception “eval failed, request status: error code: 127” in R and Java? 用 java 服务。 评估失败错误 127 - Rserve with java. Eval fail error 127 显示错误 HTTP 状态 500 - 请求处理失败; 嵌套异常是 org.hibernate.exception.ConstraintViolationException: - shows error HTTP Status 500 - Request processing failed; nested exception is org.hibernate.exception.ConstraintViolationException: cxf webclient-异常[请求处理失败; 嵌套的异常是Status:406 - cxf webclient - exception [Request processing failed; nested exception is Status : 406 org.rosuda.REngine.Rserve.RserveException:从java运行R脚本时eval失败 - org.rosuda.REngine.Rserve.RserveException: eval failed while running R script from java HTTP状态500错误,请求处理失败; 嵌套异常是 org.hibernate.exception.SQLGrammarException:无法执行语句 - HTTP status 500 error, Request processing failed; nested exception is org.hibernate.exception.SQLGrammarException: could not execute statement HTTP 500错误失败,并显示200状态代码 - HTTP 500 error failed with 200 status code HTMLUnit禁用状态代码错误异常 - HtmlUnit disable status code error exception Cplex Java API和127错误代码 - Cplex Java API and 127 error code 代码为127的opentsdb安装过程错误 - opentsdb install process error with code 127
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM