Purva Kulkarni
2016-10-25 09:06:45 UTC
Hello,
I am writing a Java application in IntelliJ IDE. The application uses Rserve() to connect to R and access scripts. The java application communicates many times with R for input and output variables, and everything worked fine. However, today, I recieved the following error while trying to send an REXP object to an Rscript:
Rserve> ignoring SIGPIPE signal
Here is the chance of Java code where the error occurs:
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
rc = new RConnection();
final String inputFileDirectory = fileName.getParent();
rc.assign("importImagingFile", currentPath.concat("/importImagingFile.R"));
rc.eval("source(importImagingFile)");
rc.assign("currentWorkingDirectory", currentPath);
rc.assign("inputFileDirectory", inputFileDirectory);
rawSpectrumObjects = rc.eval("importImagingFile(inputFileDirectory,currentWorkingDirectory)â); // First Rscript (works successfully)
rawSpectrumListSize = rawSpectrumObjects.asList().size();
rc.assign("plotAverageSpectra", currentPath.concat("/plotAverageSpectra.R")); // REXP object generated from the first script is used as an input for the second script
rc.eval("source(plotAverageSpectra)");
rc.assign("rawSpectrumObjects", rawSpectrumObjects);
REXP averageSpectraObject = rc.eval("plotAverageSpectra(rawSpectrumObjects)â); // Get the " ignoring SIGPIPE signal â error from this script and the application is halted
// few more R scripts to run
rc.close();
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Based on reading a previous post (https://mailman.rz.uni-augsburg.de/pipermail/stats-rosuda-devel/2015q2/002202.html <https://mailman.rz.uni-augsburg.de/pipermail/stats-rosuda-devel/2015q2/002202.html>), I also tried running the application by commenting rc.close(). But this does not solve the purpose.
This is how I start Rserve from the Java application
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
public class Application {
private static StartRserve sr = new StartRserve();
public static void main(String[] args) throws Exception {
// Start Rserve()
sr.launchRserve("R CMD RServe --vanilla", "--no-save --slave", "--no-save --slave", true);
if(sr.isRserveRunning())
{
// Run the GUI construction in the Event-Dispatching thread for thread-safety
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new GUIMain(âMy application"); // Let the constructor do the job
}
});
}
}
}
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
And, I shutdown Rserve connection on window closing event
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
private WindowListener exitListener = new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
try {
RConnection c = new RConnection();
c.shutdown();
} catch (RserveException e1) {
e1.printStackTrace();
}
System.exit(0);
}
};
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
All this worked fine till yesterday. I am not sure why I get this error today? I updated R and Java today, could that be an issue?
Thank you for your help.
Best,
Purva
I am writing a Java application in IntelliJ IDE. The application uses Rserve() to connect to R and access scripts. The java application communicates many times with R for input and output variables, and everything worked fine. However, today, I recieved the following error while trying to send an REXP object to an Rscript:
Rserve> ignoring SIGPIPE signal
Here is the chance of Java code where the error occurs:
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
rc = new RConnection();
final String inputFileDirectory = fileName.getParent();
rc.assign("importImagingFile", currentPath.concat("/importImagingFile.R"));
rc.eval("source(importImagingFile)");
rc.assign("currentWorkingDirectory", currentPath);
rc.assign("inputFileDirectory", inputFileDirectory);
rawSpectrumObjects = rc.eval("importImagingFile(inputFileDirectory,currentWorkingDirectory)â); // First Rscript (works successfully)
rawSpectrumListSize = rawSpectrumObjects.asList().size();
rc.assign("plotAverageSpectra", currentPath.concat("/plotAverageSpectra.R")); // REXP object generated from the first script is used as an input for the second script
rc.eval("source(plotAverageSpectra)");
rc.assign("rawSpectrumObjects", rawSpectrumObjects);
REXP averageSpectraObject = rc.eval("plotAverageSpectra(rawSpectrumObjects)â); // Get the " ignoring SIGPIPE signal â error from this script and the application is halted
// few more R scripts to run
rc.close();
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Based on reading a previous post (https://mailman.rz.uni-augsburg.de/pipermail/stats-rosuda-devel/2015q2/002202.html <https://mailman.rz.uni-augsburg.de/pipermail/stats-rosuda-devel/2015q2/002202.html>), I also tried running the application by commenting rc.close(). But this does not solve the purpose.
This is how I start Rserve from the Java application
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
public class Application {
private static StartRserve sr = new StartRserve();
public static void main(String[] args) throws Exception {
// Start Rserve()
sr.launchRserve("R CMD RServe --vanilla", "--no-save --slave", "--no-save --slave", true);
if(sr.isRserveRunning())
{
// Run the GUI construction in the Event-Dispatching thread for thread-safety
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new GUIMain(âMy application"); // Let the constructor do the job
}
});
}
}
}
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
And, I shutdown Rserve connection on window closing event
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
private WindowListener exitListener = new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
try {
RConnection c = new RConnection();
c.shutdown();
} catch (RserveException e1) {
e1.printStackTrace();
}
System.exit(0);
}
};
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
All this worked fine till yesterday. I am not sure why I get this error today? I updated R and Java today, could that be an issue?
Thank you for your help.
Best,
Purva