[R-SIG-Mac] R-engine failure on Mac OS Snow Leopard 10.6.4, 32 bits, with java 1.6

Christine Plumejeaud christine.plumejeaud at imag.fr
Tue Feb 1 17:22:23 CET 2011


Hello,
Thank you very much for your answer.
My program don't use directly Tcl/TK - this is R that loads it when it 
loads the 'aplpack' package.  Indeed, my program works  when this 
package is commented (Tcl/Tk is not loaded anymore). Now, there is just 
to find a library for computing bagplot which does not require tcl/tk.

Cheers
Christine

I put bellow the code and the stack trace that was loading R (and failing).


------------------------------------------------------------------------------------------------------------------------
Here is the java code :
------------------------------------------------------------------------------------------------------------------------

package RMethods;
import org.rosuda.JRI.Rengine;
public class RengineObject {

     public static Rengine rengine;

     /**
      * Constructeur de la classe RengineObject. Permet de créer la 
machine virtuelle R et de charger tous les
      * paquetages R nécessaire au bon fonctionnement de l'application
      * @param args
      *          Arguments entrés en ligne de commande
      */
     public RengineObject(String[] args) {

         // on crée la machine R
         rengine = new Rengine(args, false, new RConsole());

         // on vérifie qu'on a la bonne version de la JRI
         if (!Rengine.versionCheck()) {
             System.err
                     .println("** Version mismatch - Java files don't 
match library version.");
             System.exit(1);
         }

         // la machine qui est créée est un thread donc on attend qu'il 
soit prêt
         if (!rengine.waitForR()) {
             System.out.println("Cannot load R");
             return;
         }

         // on charge dans la machine R toutes les librairies 
nécessaires au bon fonctionnement de l'application
         rengine.eval("require(GISTools)");
         rengine.eval("require(png)");
         // librairie pour script 2
         rengine.eval("require(moments)");
         rengine.eval("require(robustbase)");
         rengine.eval("require(locfit)");
         // librairie pour script3
         rengine.eval("require(aplpack)");// Package for bagplots...
         rengine.eval("require(mvoutlier)");// Load the necessary package...
         System.out.println("** R loaded ** ");
     }
}
------------------------------------------------------------------------------------------------------------------------
Here the output in java console
------------------------------------------------------------------------------------------------------------------------

plumejeau:ESTIM christineplumejeaud$ ./run.sh
estim directory : ./
java.library.path: 
/Library/Frameworks/R.framework/Resources/library/rJava/jri
R_HOME: /Library/Frameworks/R.framework/Resources

R version 2.12.1 (2010-12-16)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-apple-darwin9.8.0/i386 (32-bit)

R est un logiciel libre livr? sans AUCUNE GARANTIE.
Vous pouvez le redistribuer sous certaines conditions.
Tapez 'license()' ou 'licence()' pour plus de d?tails.

R est un projet collaboratif avec de nombreux contributeurs.
Tapez 'contributors()' pour plus d'information et
'citation()' pour la fa?on de le citer dans les publications.

Tapez 'demo()' pour des d?monstrations, 'help()' pour l'aide
en ligne ou 'help.start()' pour obtenir l'aide au format HTML.
Tapez 'q()' pour quitter R.

Le chargement a n?cessit? le package : GISTools
Le chargement a n?cessit? le package : maptools
Le chargement a n?cessit? le package : foreign
Le chargement a n?cessit? le package : sp
Le chargement a n?cessit? le package : lattice

     Note: polygon geometry computations in maptools
      depend on the package gpclib, which has a
      restricted licence. It is disabled by default;
      to enable gpclib, type gpclibPermit()

Checking rgeos availability as gpclib substitute:
FALSE
Le chargement a n?cessit? le package : RColorBrewer
Le chargement a n?cessit? le package : spdep
Le chargement a n?cessit? le package : boot

Attachement du package : 'boot'

The following object(s) are masked from 'package:lattice':

     melanoma

Le chargement a n?cessit? le package : Matrix

Attachement du package : 'Matrix'

The following object(s) are masked from 'package:base':

     det

Le chargement a n?cessit? le package : MASS
Le chargement a n?cessit? le package : nlme
Le chargement a n?cessit? le package : deldir
deldir 0.0-13

      Please note: The process for determining duplicated points
      has changed from that used in version 0.0-9 (and previously).

Le chargement a n?cessit? le package : coda
Le chargement a n?cessit? le package : spgwr
NOTE: default kernel and CV criteria changed
see help pages for details
Le chargement a n?cessit? le package : tripack
Le chargement a n?cessit? le package : gpclib
General Polygon Clipper Library for R (version 1.5-1)
     Type 'class ? gpc.poly' for help

GISTools library now loaded.
Le chargement a n?cessit? le package : png
Le chargement a n?cessit? le package : moments

Attachement du package : 'moments'

The following object(s) are masked from 'package:spdep':

     geary

Le chargement a n?cessit? le package : robustbase

Attachement du package : 'robustbase'

The following object(s) are masked from 'package:boot':

     salinity

Le chargement a n?cessit? le package : locfit
Le chargement a n?cessit? le package : akima
locfit 1.5-6      2010-01-20
Le chargement a n?cessit? le package : aplpack
Le chargement a n?cessit? le package : tcltk
Chargement de Tcl/Tk... termin?
Le chargement a n?cessit? le package : mvoutlier
** R loaded**
2011-02-01 16:57:34.923 java[2429:a0f] *** __NSAutoreleaseNoPool(): 
Object 0x122dc80 of class NSConcreteMapTableValueEnumerator autoreleased 
with no pool in place - just leaking
2011-02-01 16:57:34.933 java[2429:a0f] *** __NSAutoreleaseNoPool(): 
Object 0x1404cf0 of class NSConcreteMapTableValueEnumerator autoreleased 
with no pool in place - just leaking
tailleEcran : 1440x900
tailleAppli : 1024x768
Estim-->initProperties from resource file 
:jar:file:/Users/christine/Dev/estim/ESTIM/dist/ESTIM.jar!/messages.en.txt
Estim-->initProperties from resource file 
:jar:file:/Users/christine/Dev/estim/ESTIM/dist/ESTIM.jar!/messages.en.txt
panelVisualisationDimension 673x384
2011-02-01 16:57:36.055 java[2429:a0f] *** __NSAutoreleaseNoPool(): 
Object 0x12804a0 of class __NSCFDate autoreleased with no pool in place 
- just leaking
2011-02-01 16:57:36.055 java[2429:a0f] *** __NSAutoreleaseNoPool(): 
Object 0x1280990 of class NSCFTimer autoreleased with no pool in place - 
just leaking
------------------------------------------------------------------------------------------------------------------------


Le 01/02/11 16:25, Simon Urbanek a écrit :
> On Feb 1, 2011, at 10:01 AM, Christine Plumejeaud wrote:
>
>> Hi,
>> I have developped a java swing application (1.6) embedding R (using the
>> JRI, JRengine) and all was fine on my previous laptop (Mac OS X Leopard,
>> 10.5).
>>
>> But I had to change my laptop (Snow Leopard 10.6.4, 32 bits with java
>> 1.6), and now there is a failure, which seems to come from cocoa (read
>> this on other forums). The error "__NSAutoreleaseNoPool" is on all
>> forums.//For instance, see
>> http://www.omnigroup.com/mailman/archive/macosx-dev/2001-July/029778.html/
>> /
> Can you be more specific as of what you do? Can you include your exact setup and Java code? There is a lot of things that can break in R embedded into Java because of the way Java interacts with the OS - for example I'm surprised to see you load Tcl/Tk as that in itself is possibly problematic (at the very least it won't work properly with Java GUIs). As for the actual warnings you post those are technically harmless and easy to remove, but the underlying problem is that of Java co-operating (or not) with other libraries that interact with the OS -- if you want stability you really want to stay within the Java realm (i.e. use JavaGD instead of Quartz, don't even think about Tcl/Tk and use iWidgets/gWidgetsJava etc.). Also you don't want to call and UI code other than on the main thread (technically we allow apps to call R from other threads as long as they are synchronized but that won't work for OS interactions which have to be on the main thread).
>
> Cheers,
> Simon
>
>
>> I use the R  binairies downloaded from CRAN :
>> http://cran.r-project.org/
>> I also have installed the Xcode SDK
>>
>> Here is my stack trace :
>> ------------------------------------------------------------------------
>> java.library.path:
>> /Library/Frameworks/R.framework/Resources/library/rJava/jri
>> R_HOME: /Library/Frameworks/R.framework/Resources
>>
>> R version 2.12.1 (2010-12-16)
>> Copyright (C) 2010 The R Foundation for Statistical Computing
>> ISBN 3-900051-07-0
>> Platform: i386-apple-darwin9.8.0/i386 (32-bit)
>> ...
>> Chargement de Tcl/Tk... termin?
>> Le chargement a n?cessit? le package : mvoutlier
>> ** R loaded**
>> ------------------------------------------------------------------------
>> Ok all is fine
>> But ...
>> ------------------------------------------------------------------------
>>
>> 2011-02-01 14:16:47.428 java[377:a0f] *** __NSAutoreleaseNoPool():
>> Object 0x1130840 of class NSConcreteMapTableValueEnumerator autoreleased
>> with no pool in place - just leaking
>> 2011-02-01 14:16:47.432 java[377:a0f] *** __NSAutoreleaseNoPool():
>> Object 0x150c440 of class NSConcreteMapTableValueEnumerator autoreleased
>> with no pool in place - just leaking
>>
>> ------------------------------------------------------------------------
>>
>> Reading this post,
>> https://stat.ethz.ch/pipermail/r-sig-mac/2010-December/007913.html, I
>> understood that
>>
>> /"the latest update to Snow Leopard (10.6.5) removes necessary header/  /files from the system Java installation."
>> /
>>
>> OK, and all this have been ennoying other people using the mac OS X JVM
>> for other applications.
>> /
>> /
>> So I have followed the advice : installed the Xcode SDK and made java
>> reconf for R with good CPP flags/
>>
>> /------------------------------------------------------------------------
>> plumejeau:ESTIM christineplumejeaud$
>> JAVA_CPPFLAGS=-I/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/JavaVM.framework/Headers
>> R CMD javareconf
>> Java interpreter :
>> /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java
>> Java version     : 1.6.0_22
>> Java home path   :
>> /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
>> Java compiler    :
>> /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/javac
>> Java headers gen.:
>> /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/javah
>> Java archive tool:
>> /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/jar
>> Java library path:
>> JNI linker flags : -framework JavaVM
>> JNI cpp flags    :
>> -I/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/JavaVM.framework/Headers
>>
>> Updating Java configuration in /Library/Frameworks/R.framework/Resources
>> Done.
>> ------------------------------------------------------------------------
>>
>> Unfortunatly, the problem is going on...
>>
>> Have you any idea ?
>>
>> Here is the command to launch my application.
>> java -d32
>> -Djava.library.path=/Library/Frameworks/R.framework/Resources/library/rJava/jri
>> -cp "${ESTIM_DIR}/lib/JRI.jar:${ESTIM_DIR}/lib/JRIEngine.jar --arch
>> i386:${ESTIM_DIR}/lib/postgis_1_0_0.jar:${ESTIM_DIR}/lib/postgresql-8.1-404.jdbc3.jar:${ESTIM_DIR}/lib/REngine.jar:${ESTIM_DIR}/dist/ESTIM.jar"
>> Estim
>>
>> Thanks in advance,
>> Christine
>>
>> -- 
>> Christine Plumejeaud
>> Equipe Steamer, Laboratoire d'Informatique de Grenoble
>> 681 rue de la Passerelle
>> 38400 St Martin d'Hères
>> 04 76 82 72 11
>> christine.plumejeaud at imag.fr
>>
>>
>> 	[[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac



More information about the R-SIG-Mac mailing list