Error executing library in Rserve from Java

When I started 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)) 

Everything is working fine.

But if I try to start Rserve from the command line (simulating what Java does). As a 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 on the command line:

  Invalid memory access of location 0x110 rip=0x7fff8ea0d5d2 

Here and here are similar problems. My initial problem was RJDBC , not openNLP , and it seems that both have rJava . I used openNLP here because it is easy to simulate without having to connect to the database. Any clue on how to solve this?

+5
source share
1 answer

Remember to set the exact same parameters for your R CMD. Make sure that RStudio uses the exact same version of Java.

As for memory settings, you can always use this trick

 export _JAVA_OPTIONS="-Xmx=2G" 

to set the memory size available for the JVM. Using _JAVA_OPTIONS , you can set the parameters that the JVM will use.

0
source

All Articles