当我从RStudio启动Rserve并尝试使用 RSclient 连接到 Rserve 时,如下代码所示:
#Loading Libraries
library(Rserve)
library(RSclient)
#Loading Rserve
Rserve(args='--no-save --slave')
#Open Connection to Rserve and Executing openNPL
conn <- RS.connect(port=6311)
RS.eval(conn,library(openNLP))
一切正常。
但是,如果我尝试从命令行启动 Rserve(模拟 Java 所做的)。作为代码:
#loading Rserve from command line, to simulate what java does.
#Using Mac OS 10.10.2
/Library/Frameworks/R.framework/Resources/bin/R CMD /Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rserve/libs//Rserve --no-save --slave --RS-port 6311
#in RStudio
#Loading Rclient
library(RSclient)
#Loading Rserve
Rserve(args='--no-save --slave')
#Open Connection to Rserve and Executing openNPL
conn <- RS.connect(port=6311)
RS.eval(conn,library(openNLP))
我在 RStudio 中收到此错误:
rsc_abort: connection closed by peer
Error in RS.eval(conn, library(openNLP)) :
read error - could not obtain response header
而命令行中的这个错误:
Invalid memory access of location 0x110 rip=0x7fff8ea0d5d2
这里和这里是类似的问题参考。我最初的问题是RJDBC,而不是openNLP,而且似乎两者都有rJava的共同点。我在这里使用了openNLP,因为它很容易模拟,不需要连接数据库。关于如何解决这个问题的任何线索?