RHive installation : Error in rhive.connect - r

I was installing rhive on my cluster. I followed below link for installation.
https://github.com/nexr/RHive
Everything went smooth except last line. When i tried to connect r with hive server , it is throwing below exception.
> library(RHive)
Loading required package: rJava
Loading required package: Rserve
> rhive.connect("127.0.0.1", 10000, hiveServer2)
Error: java.lang.UnsupportedClassVersionError: org/apache/hadoop/conf/Configuration : Unsupported major.minor version 51.0
>
Java Version
java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
Does anyone has any clue here?

Issues got resolved when I changed my JAVA_HOME to jdk6. It looks like jdk7 is not supported.
echo $JAVA_HOME
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.36.x86_64/jre

Related

"Java exception occurred during rJava bootstrap" when trying to use tabulizer

I'm running Mac OS 10.13.6, and using RStudio 1.1.8, R 3.5.3, Java 11. In case hardware might matter, I'm using a 2013 MacBook Air.
I'm trying to run the extract_table function from the r tabulizer package on the Correlates of War World Religion Codebook, available here. I seem to be getting stuck because of an error with rJava. The rJava library seems to load in RStudio just fine, but when I run the following line:
lst <- tabulizer::extract_tables("/Users/[me]/Downloads/wrp-codebook-bibliography.pdf", encoding="UTF-8")
or try to load the tabulizer library, I receive the following error:
WARNING: Initial Java 12 release has broken JNI support and does NOT work. Use stable Java 11 (or watch for 12u if avaiable).
ERROR: Java exception occurred during rJava bootstrap - see stderr for Java stack trace.
Exception in thread "main" java.lang.NullPointerException
at java.base/jdk.internal.reflect.Reflection.verifyMemberAccess(Reflection.java:130)
at java.base/java.lang.reflect.AccessibleObject.slowVerifyAccess(AccessibleObject.java:673)
at java.base/java.lang.reflect.AccessibleObject.verifyAccess(AccessibleObject.java:666)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:638)
at java.base/java.lang.reflect.Field.checkAccess(Field.java:1075)
at java.base/java.lang.reflect.Field.get(Field.java:416)
Error: .onLoad failed in loadNamespace() for 'tabulizerjars', details:
call: .jcheck(silent = FALSE)
error: java.lang.NullPointerException.jcall(f, "Ljava/lang/Object;", "get", .jcast(ic, "java/lang/Object"))new("jobjRef", jobj = <pointer: 0x10caa0870>, jclass = "java/lang/NullPointerException")
EDIT: the below section has been update for clarity based on a comment received.
At first I thought it was that I needed to switch from Java 12 to Java 11, so I found a helpful post on SO and used the following commands to make that switch, with no instances of RStudio or R running while I did it:
MacBook-Air:~ $ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
12, x86_64: "Java SE 12" /Library/Java/JavaVirtualMachines/jdk-12.jdk/Contents/Home
11.0.2, x86_64: "Java SE 11.0.2" /Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-12.jdk/Contents/Home
MacBook-Air:~ $ export JAVA_HOME=`/usr/libexec/java_home -v 1.6.0_65-b14-462`
The problem has persisted since them and when I double-check my version of Java in the terminal, I get this:
MacBook-Air:~ $ java -version
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
So it looks to me like I'm running 11.
However, I also still have 12 installed:
MacBook-Air:~ $ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
12, x86_64: "Java SE 12" /Library/Java/JavaVirtualMachines/jdk-12.jdk/Contents/Home
11.0.2, x86_64: "Java SE 11.0.2" /Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home
I'm not sure if R is looking at version 12 instead, or how to redirect it, or if there is another issue here all together. Unfortunately, I wasn't able to find anything on google or SO about this error specifically in the context of R and rJava.
Please let me know if I can provide any additional information.
Thanks!
Navigate to /Library/Java/JavaVirtualMachines and remove JDK 12
Reinstall JDK 11.
sudo R CMD javareconf in the terminal.
I re-installed rJava and it worked!
Using: install.packages("rjava")

start_session() from RWebdriver package doesn't work

I've installed package from git_hub under RStudio by:
install_github(repo = "Rwebdriver",username = "crubba")
Downloaded and started Selenium server v.3.3.1 from the command prompt by:
>java -jar seleniumXXX.jar
When I'm trying to run this command under RStudio:
start_session(root = "http://localhost:4444/wd/hub/", browser ="firefox")
I'm getting an error:
Error in serverDetails$value[[1]] : subscript out of bounds
I haven't any idea what is it.
Is anybody help me?
RStudio Version 0.99.903
R version 3.3.3
RWebdriver Version 0.1
OS - Windows 10
selenium server version 3.3.1
Java Version 8 update 121 (build 1.8.0_121-b13)

RJDBC connection to RedShift produces a .jfindClass class not found error on Windows

Good morning, I'm trying to connect amazon redshift but when I run this command
driver <- JDBC("com.amazon.redshift.jdbc41.Driver", "RedshiftJDBC41-1.1.9.1009.jar", identifier.quote="`")
I get this error:
Error in .jfindClass(as.character(driverClass)[1]) : class not found
I have R version 3.2.2 on Windows 7
J("java.lang.System")$getProperty("java.version")
[1] "1.7.0_67"
java -version
java version "1.7.0_76"
Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)
I am using 1.1.7.1007 driver in scala without any problem
did you do
install.packages("RJDBC",dep=TRUE)
And full path to the jar?

rJava loading error- "character vector expected"

I am using 64 bit windows 7 & 64 bit R 3.2.0. I have downloaded rJava package, but it is giving an error as follows.
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dirname(this$RuntimeLib) error: a character vector argument
expected In addition: Warning message: package ‘rJava’ was built under
R version 3.2.2 Error: package or namespace load failed for ‘rJava’
I searched stackoverflow for answers, and did the following:
1) Added the jvm.dll file to my PATH variable, i.e. in the following directory:
C:\Program Files\Java\jdk1.8.0_25\jre\bin\
2) I am using 64 bit R 3.2.0 & checked if the JVM version was 64 bit or not, typing the following on the command line:
java -d64 -version
It gave the following output:
C:\Users\xyz> java -d64 -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
So at least the JVM matches with R.
So what more needs to be done to make rJava work? I also checked my PATH variable and it seems okay.
I know this is way too late, but did you try switching R versions as a diagnostic step?
For RStudio 1.0.136: Tools -> Global Options... -> General: R version: Change - Choose 32 bit.
Changing versions worked for me and prompted me to revisit my java installation. (Ended up just using R32)
Got the same error with R64:
Loading required package: XLConnectJars
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dirname(this$RuntimeLib)
error: a character vector argument expected
Error: package ‘XLConnectJars’ could not be loaded
Was running RStudio on Windows 10 using machine's default R64.
Ya must specify where the jdk is. For example:
Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jdk1.8.0_161')
then it should work.

Problems requiring rJava in Windows

I am using a 64-bit machine, with the latest version of R (3.1.2), the latest RStudio version (0.98.1091) and the latest JAVA (Version 8 Update 31).
I tried to require rJava (rJava_0.9-6) and the result is the following error:
require(xlsx)
Carregando pacotes exigidos: rJava
Error : .onLoad falhou em loadNamespace() para 'rJava', detalhes:
chamada: fun(libname, pkgname)
erro: No CurrentVersion entry in Software/JavaSoft registry! Try re-installing Java and make sure R and Java have matching architectures.
Failed with error: ‘package ‘rJava’ could not be loaded’
I already tried to re-install Java with no sucess.
Does anybody know how can I solve this problem?
I think the problem on this occasion is that your Java is 32-bit, whereas your R is 64-bit. This is why you get a R and Java have different architectures error.
In order to check what your Java version is on Windows type:
java -d64 -version
on the command line as it is mentioned here.
I think that once you install the correct Java version i.e. the 64-bit on this occasion then loading your xlsx library will work!
The architecture of Java you get for install from the regular Java download web page depends on the architecture of browser you’re using (32-bit or 64-bit) when you download it. This happens without any fanfare. Try the Java manual download page, select the 64-bit version of Java for your OS, install it, and then (after restarting R) try your R packages again.

Resources