So I'm trying to make use of R from Java through JRI. I'm using the RJava plugin for Eclipse and the two test files which come with rJava are working fine (rtest and rtest2). But when trying to run this simple code fragment, I get an EXCEPTION_ACCESS_VIOLATION:
public static void main(String... args) {
Rengine re = new Rengine();
if (!re.waitForR()) {
System.out.println("Unable to load R");
return;
} else
System.out.println("Connected to R");
re.eval("x=c(1:10)");
double d = re.eval("mean(x)").asDouble();
System.out.println(d);
}
The output I'm getting:
Connected to R
A fatal error has been detected by the Java Runtime Environment:
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006c726096, pid=5284, tid=7868
JRE version: Java(TM) SE Runtime Environment (8.0_25-b18) (build 1.8.0_25-b18)
Java VM: Java HotSpot(TM) 64-Bit Server VM (25.25-b02 mixed mode windows-amd64 compressed oops)
Problematic frame:
C [R.dll+0x26096]
Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
An error report file with more information is saved as:
C:\Users\gebruiker\workspace64\RTest\hs_err_pid5284.log
If you would like to submit a bug report, please visit:
http://bugreport.sun.com/bugreport/crash.jsp
The crash happened outside the Java Virtual Machine in native code.
See problematic frame for where to report the bug.
The complete log: http://pastebin.com/18wHWihB
I'm seeing this in the log, does it have to do something with it? (wrong use of the eval function? I just copied an example though...)
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.rosuda.JRI.Rengine.rniParse(Ljava/lang/String;I)J+0
j org.rosuda.JRI.Rengine.eval(Ljava/lang/String;Z)Lorg/rosuda/JRI/REXP;+53
j org.rosuda.JRI.Rengine.eval(Ljava/lang/String;)Lorg/rosuda/JRI/REXP;+3
j Main.main([Ljava/lang/String;)V+35
v ~StubRoutines::call_stub
If anybody could help, I'm at a loss and would appreciate it greatly :)
Instanitiate rengine like below, i have just made 10 as default size.
String args1[] = new String[10];
Rengine rengine = new Rengine(args, false, null);
You have to set the environment variable R_HOMEin your JVM environment. Set it in your environment variable won't work, JVM is NOT ware of that. Just figured it out by myself.
Related
I am trying to encrypt a few password in a properties file using an Ant script. When I run the Ant script I get:
java.lang.RuntimeException: Security Error in doEncrypt: org.jasypt.exceptions.EncryptionInitializationException: java.security.NoSuchAlgorithmException: PBEWithHMACSHA512AndAES_256 SecretKeyFactory not available
this is with org.jasypt.util.text.AES256TextEncryptor. So I tried to move to PooledPBEStringEncryptor and that throws org.jasypt.exceptions.EncryptionOperationNotPossibleException
I have this in the code for the latter:
Security.setProperty("crypto.policy", "unlimited");
pooledPBEStringEncryptor = new PooledPBEStringEncryptor();
pooledPBEStringEncryptor.setPassword(encryptionKey);
pooledPBEStringEncryptor.setAlgorithm("PBEWITHHMACSHA512AND256BITAES");
pooledPBEStringEncryptor.setPoolSize(4);
pooledPBEStringEncryptor.setSaltGenerator(new RandomSaltGenerator());
This is how I initialize the object.
I am on WebSphere 8.5.5.10 and JAVA8 on a Unix system. My JDK version is:
java version "1.8.0"
Java(TM) SE Runtime Environment (build pxa6480sr3ifix-20160713_01(SR3+IX90174+IV85763))
IBM J9 VM (build 2.8, JRE 1.8.0 Linux amd64-64 Compressed References 20160713_311397 (JIT enabled, AOT enabled)
J9VM - R28_Java8_SR3_20160713_0915_B311397
JIT - tr.r14.java.green_20160329_114288
GC - R28_Java8_SR3_20160713_0915_B311397_CMPRSS
J9CL - 20160713_311397)
JCL - 20160421_01 based on Oracle jdk8u91-b14
Any advise would be nice. I searched for IBM WebSpehre forums, but couldn't find any. Thanks in advance.
This may help:
How to verify the Unlimited Strength Jurisdiction Policy Files used
on local_policy.jar & US_export_policy.jar and also How to check the
list of ciphers used by IBM Java?
https://www.ibm.com/support/pages/node/1171564
I have a Grails application that I have recently upgraded to 3.3 from 2.5. Generally things are working but today we ran across a problem that seems to be shared by others but I cannot find a solution.
In a controller I have a method that appends a string to the response.outputStream.
The code now appears as
response.status = OK.value()
response.contentType = 'text/csv;charset=UTF-8'
response.setHeader "Content-disposition", "attachment; filename=rcCandidate.csv"
response.outputStream << converted
response.outputStream.flush()
response.outputStream.close()
based on a suggestion found here
http://sergiodelamo.es/grails-tips-how-to-output-csv-from-a-grails-3-controller/
This code executes just fine on my test environment
$ grails -version
| Grails Version: 3.3.5
| Groovy Version: 2.4.15
| JVM Version: 1.8.0_162
but fails badly on the production server
$ java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
$ apt list | grep tomcat
tomcat7/trusty-security,trusty-updates,now 7.0.52-1ubuntu0.13 all [installed]
The failures are reported starting with:
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/WriteListener
followed by a stack trace, then this
Caused by: java.lang.NoClassDefFoundError: javax/servlet/WriteListener
then more stack trace and similar messages about WriteListener
I have seen suggestions to replace this line
provided "org.springframework.boot:spring-boot-starter-tomcat"
with
compile "org.springframework.boot:spring-boot-starter-tomcat"
But as pointed out here
https://docs.grails.org/latest/guide/deployment.html
that is not a good idea, and indeed when I tried it, tomcat did not start up.
I believe I've read somewhere that I might be able to cure this problem by replacing Tomcat7 with Tomcat8; however right now I'm running Ubuntu 14.04 on the server and Tomcat8 is not on offer in the repositories, so it's not quite straightforward to test that.
Does anyone have any suggestions for me? Thanks in advance.
You can fix this by adding #CompileStatic to your method, but that is not always feasible. We have fixed this problem in our applications by adding a static utility method:
#CompileStatic
public static sendResponseData(ServletOutputStream outputStream, String s) { // but this could be byte[] s or InputStream s or whatever you need
outputStream << s
}
and then calling that instead of the left shift operation.
You may need to add additional method signatures so that they can be statically compiled but the concept is the same. If I recall correctly, the left shift operator here uses some annotation or something (clearly I don't remember details!) that is not included by default (on Tomcat 7) but is also not needed.
Note that we also added
#CompileStatic
public static flushOutputStream(ServletOutputStream outputStream) {
outputStream.flush()
}
for convenience since that one has to be statically compiled as well.
I am trying for first time to use h2o package in R. My problem comes when I try to use h2o.init() function I have the next error message
Error in value[[3L]](cond) :
You have a 32-bit version of Java. H2O works best with 64-bit Java.
Please download the latest Java SE JDK 7 from the following URL:
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
In addition: Warning message:
In normalizePath(path.expand(path), winslash, mustWork) :
path[1]="C:\Program Files\Java\jre1.8.0_111\bin/bin/java.exe": El sistema no puede encontrar la ruta especificada
I have followed the solutions here and there But I still have the same error things become worst since i do not have admin rights. Does any one can point me somewhere or give me some guide lines to get this solve?? This is driving me crazy.
My sesion info is
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Java version:
java version "1.8.0_131"
JAVA(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) Client VM (build 25.131-b11, mixed mode)
In your local system environment you can set the JAVA_HOME as below:
JAVA_HOME=C:\\PATH_TO_YOUR_JAVA_1.8_INSTALL
After that you can check and confirm that your command line environment shows 64bit Java along with Sys.getenv call shows the 64 bit Java 1.8 as your java environment.
> Sys.getenv("JAVA_HOME")
[1] "/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home"
If it is not set in R environment then you can set it as below too:
> Sys.setenv(JAVA_HOME= "/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home")
Make sure to restart R/Rstudio with clean session so you have updated R with new environment. After that when you will call h2o initialize function it will pickup the right Java to get it started.
h2o.init()
Node JS application is working fine with Linux, windows and Solaris. But Node JS is not working in SPARC system because it is not supporting V8 engine.
Myself found a External project called AVATAR, which is used to run NODE JS Programs in JVM (Java Virtual Machine) using the JAVA 8 inbuilt JavaScript Engine – Nashron.
In their official site they have provided me (.so) file for Linux, (.dll) file for Windows using that we compiled the program. By using those files (.so & .dll) we successfully executed Node JS programs in Linux, windows with JAVA 8.
I used same linux (.so) file to run on SPARC platform and it throws below error.
Error Occurred :
-bash-4.1$ java -Djava.library.path=dist -jar dist/avatar-js.jar HttpServer.js
Exception in thread "main" java.lang.UnsatisfiedLinkError: /export/home/thiru/LinuxAVatar/dist/libavatar-js.so: ld.so.1: java: fatal: /export/home/thiru/LinuxAVatar/dist/libavatar-js.so: wrong ELF data format: ELFDATA2LSB (Possible cause: endianness mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1938)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1854)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at com.oracle.libuv.LibUV.<clinit>(LibUV.java:33)
at com.oracle.avatar.js.Server.<init>(Server.java:166)
at com.oracle.avatar.js.Server.<init>(Server.java:140)
at com.oracle.avatar.js.Server.<init>(Server.java:128)
at com.oracle.avatar.js.Server.main(Server.java:122)
I have attached the basic HTTP Server Program in NODE JS which I used to run in JVM using avatar.
Could you please provide some feasibility for the below points:
1.Running NODE JS on SPARC system,
2.Is there any build for that .so file for SPARC,
3.shall I use any other Java Script Engines instead of Nashron in SPARC (ex: Spider Monkey).
Link For Official Site: https://avatar-js.java.net/
Procedure to run Avatar : http://blog.jonasbandi.net/2014/03/running-nodejs-applications-on-jvm-with.html
Version of Oracle Solaris OS : Oracle Solaris 11.3 SPARC
JAVA Version :
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java Hotspot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
Thanks in Advance.
var http = require('http');
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
server.listen(8000);
console.log("Server running at http://127.0.0.1:8585/");
Project Avatar from Oracle is dead.
Officially it's called "development is on hold", but... you know!
See also my blogpost about this: http://www.n-k.de/2015/02/current-status-of-oracles-project-avatar.html
The mentioned alternative "Nodyn" is also dead.
So, you have to look for another option to run node.js on your desired platform.
I am running Mac OS X 10.7.5 on VMware player.
I have installed these on my system -
I have jdk-7u12-ea-bin-b07-macosx-x86_64-27_dec_2012.dmg
jre-7u10-macosx-x64.dmg
netbeans-7.2.1-ml-javase-macosx.dmg
I have set java Java Home pointing to java 1.7. On command prompt it showing version as -
Java(TM) SE Runtime Environment (build 1.7.0_12-ea-b07)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b28, mixed mode)
Whenener I am trying to run a jar file created from my JavaFX application. It throw this fatal error on commd prompt-
# A fatal error has been detected by the Java Runtime Environment:
# SIGSEGV (0xb) at pc=0x00007fff88a54fdf, pid=404, tid=18947
# JRE version: Java(TM) SE Runtime Environment (7.0_12-b07) (build 1.7.0_12-ea-b07)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.0-b28 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C [libobjc.A.dylib+0x9fdf] objc_msgSend_fixup+0x5f
# Failed to write core dump. Core dumps have been disabled. To
enable core dumping, try "ulimit -c unlimited" before starting Java
again
# An error report file with more information is saved as:
# /Users/User/Desktop/JavaFX/hs_err_pid404.log
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
Abort trap: 6
Details of fatal error while ex
http://neelamsharma.s3.amazonaws.com/jarerrorlog.log
On launching netbeans it producing this fatal error -
http://neelamsharma.s3.amazonaws.com/hs_err_while%20_running_netbeans.log
On opening Java Preferences from System Preferences it showing this fatal erros -
http://neelamsharma.s3.amazonaws.com/javapreferences.log
I am unable to do anything on Mac OS X, how can I get rid of this errors ?
Uninstall the EA jdk and use a released version.
I logged an issue for this problem: http://javafx-jira.kenai.com/browse/RT-28144
Neelam, all you need is to change the prism.order system property BEFORE JavaFX loads your javafx.application.Applcation class.
If your class with public static void main(String[]) extends the javafx.application.Application class then move the main(String[]) method to another class, Main.java for example.
2) Add to your main(String[]) method some code that changes the prism.order property to "sw" (software rendering), for example:
public class Main {
public static void main(String[] args) {
AccessController.doPrivileged(new PrivelegedAction<Void>() {
#Override
public Void run() {
Properties props = System.getProperties();
props.put("prism.order", "sw");
Application.launch(YourApplication.class);
return null;
}
});
}
}