I am trying to integrate regression R code into my j2ee project using R caller.
My datasource is from mysql database. So I used RMYSQL as package.
My code work fine under java project but when I moved it into backing bean class it throws an exception:  java.lang.NoClassDefFoundError: rcaller/RCaller
In maven dependency it exist only version 2.8 of Rcaller. And I'm in need to 2.5 version so I haved added it to build path manually.
The backing bean method is:
try {
       RCaller caller = new RCaller();
       RCode code = new RCode();  
       caller.setRscriptExecutable("Rscript.exe");
       code.clear();
       caller.setRCode(code);
       code.R_require("RMySQL");
       code.R_require("rpart");
       code.addRCode("mydb= dbConnect(MySQL(),user='root',password='root',dbname='db',host='localhost')"); 
       code.addRCode("rs= dbSendQuery(mydb,'select * from table')"); 
       code.addRCode("data = fetch(rs,n=-1)");  
       code.addRCode("data= data[data[['cred']]>0,]");  
       code.addRCode("data$navig <- ifelse(data$navig == 'Chrome',1,ifelse(data$navig == 'Firefox',2,ifelse(data$navig == 'Android',3,ifelse(data$navig == 'iPhone',4,9))))");  
       code.addRCode("data$rate =as.factor(data$rate)");  
       code.addRCode("ad.apprentissage= rpart(rate~vqs+ibt+tbt+bf+n+down+ping, data=data,minsplit = 7)");  
       code.addRCode("predArbreDecision=predict(ad.apprentissage,newdata=data,type='class') ");  
       code.addRCode("table(data$rate, predArbreDecision)");  
       File file = code.startPlot();
      // code.addRCode("ggplot(df, aes(x, y)) + geom_point() + geom_smooth(method='lm') + ggtitle('y = f(x)')");
code.addRCode("plot(ad.apprentissage,main='Arbre de décision de la vidéo Streaming')");
code.addRCode("text(ad.apprentissage)");
       caller.runOnly();
       ImageIcon ii = code.getPlot(file);
       code.showPlot(file);
   } catch (Exception e) {
       System.out.println(e.toString());
   } 
And in order to display the graph in jsf page, I have called that function as following:
 #{video_R_IntegrationBean.Test3()} 
 
    