Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201894

Executing R code deployed in Pivotal Cloud Foundry (PCF) from Java locally

$
0
0

I am trying to connect R code which is deployed in PCF from java code locally which is not working. My R project structure is mentioned below. It is working in local perfectly but not working remotely.

Note : I have used Rserve to execute R code from Java

.RData .Rhistory

manifest.yml

metrics_discovery.Rproj

nameFunc.R

r.yml

rserv.conf

start.R

manifest.yml

applications: 
- name: r_discovery 
  disk_qouta: 1GB 
  memory: 1GB 
  buildpack: r_buildpack_latest 
  random-route: false 
  stack: cflinuxfs3 
  health-check-type: process 
  services: [] 
  command: R -f start.R 
  env: 
    http_proxy:  
    https_proxy:  
    PIP_TRUSTED_HOST:  
    PIP_INDEX_URL: 

start.R

library(Rserve) 
Rserve(args="--no-save", port=6311)

r.yml

packages: []

nameFunc.R

nameFunc <- function() {
  result <- "Hello World"
  return(result)
}
nameFunc()

Java code

public class Test {

    public static void main(String[] args) throws RserveException, REXPMismatchException, IOException {
        RConnection c = new RConnection("***.***.**.**",6311); 
        if(c.isConnected()) {
            System.out.println("System is connected to Rserve");

        }else {
            System.out.println("System is not connected to Rserve");
        }

        c.close();
        System.out.println("Session closed");
    }
}

Viewing all articles
Browse latest Browse all 201894

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>