Home:ALL Converter>Error executing library in Rserve from Java

Error executing library in Rserve from Java

Ask Time:2015-05-31T09:14:00         Author:Murta

Json Formatter

When I start Rserve from RStudio and try to connect to Rserve using RSclient as in the code below:

#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))

All works ok.

But if I try to start Rserve from command line (simulating what Java does). As the code:

#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))

I get this error in RStudio:

rsc_abort: connection closed by peer
Error in RS.eval(conn, library(openNLP)) : 
  read error - could not obtain response header

And this error in the command line:

  Invalid memory access of location 0x110 rip=0x7fff8ea0d5d2

Here and here are similar problems reference. My original problem is with RJDBC, not with openNLP, and it seems that both has rJava in common. I used openNLP here because it's easy to simulate, with no need to database connection. Any clue on how to solve this?

Author:Murta,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30552876/error-executing-library-in-rserve-from-java
yy