5

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?

Murta
  • 2,037
  • 3
  • 25
  • 33

1 Answers1

0

Make sure to set exactly the same parameters for your R CMD. Make sure to check whether RStudio uses exactly the same Java version.

As for memory settings, you can always use this trick

export _JAVA_OPTIONS="-Xmx=2G"

to set memory size available to JVM. Using _JAVA_OPTIONS you can enforce settings that will be used by JVM.

Oo.oO
  • 12,464
  • 3
  • 23
  • 45