Macbook Pro M1 issues connecting to oracle database with R - java

I am using an M1 MBP running Monterey and trying to connect to an oracle database to pull data into R. Currently I am trying to setup RJDBC but am open to other options if there is something easier to use.
When I try to load RJDBC I am getting:
Loading required package: rJava
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(jli, FALSE)
error: unable to load shared object '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib':
dlopen(/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib, 0x000A): tried: '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/libjli.dylib' (no such file)
Error: package ‘rJava’ could not be loaded
I have seen a few similar posts:
How to install rJava package in Mac with M1 architecture
Problem with R studio on Mac with Monterey and arm system
And am wondering what the best course of action here is. Would it be better to try and instal the arm version of java or the arm version of R?

JavaAppletPlugin no longer exists.
Java Applet technology has been retired, phased out across all platforms including macOS.
See Oracle white paper, Java Client Roadmap Update.
Contact the app publisher for an updated modern release. The release you have must be from many years ago.

Resolved by downloading ARM version of java:
https://www.oracle.com/java/technologies/downloads/#jdk17-mac

Related

Apple M1 - Cannot Load rJava for xlsx package in R

I am currently working on an assignment that requires me to utilize the xlsx package in R. I have installed both "xlsx" and "rJava" packages, and have installed the most recent edition of Java to my computer.
However, when I try to load the "xlsx" package, I receive the following error:
enter image description here
> library(xlsx)
Error: package or namespace load failed for ‘xlsx’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(jli, FALSE)
error: unable to load shared object '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib':
dlopen(/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib, 0x000A): tried: '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))
Any suggestions of how to fix this so I am able to use the xlsx package?
Thanks.
Tried searching for solutions that suggested I used a different non-Java based package to open the files, read it may be M1 Mac incompatible with Java.

Error linking JNA library on AdoptOpenJDK on MacOS

I am trying to run some JUnit tests over cassandra. But I get the following error:
[08/12/19 10:48:40:411](main)([]) INFO - c.h.c.c.e.EmbeddedCassandra - Starting embedded Cassandra server.
8/12/19 10:48:41:497](main)([]) ERROR - o.a.c.u.NativeLibraryDarwin - Failed to link the C library against JNA. Native methods will be unavailable.
java.lang.UnsatisfiedLinkError: /private/var/folders/ty/wl4gxf352m328101m101hwh40000gn/T/jna--321969061/jna10641195286884112036.tmp: dlopen(/private/var/folders/ty/wl4gxf352m328101m101hwh40000gn/T/jna--321969061/jna10641195286884112036.tmp, 1): no suitable image found. Did find:
/private/var/folders/ty/wl4gxf352m328101m101hwh40000gn/T/jna--321969061/jna10641195286884112036.tmp: code signature in (/private/var/folders/ty/wl4gxf352m328101m101hwh40000gn/T/jna--321969061/jna10641195286884112036.tmp) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
It was running well until I changed to mac mojave and re-setup everything. I think it is an issue related to permissions may be or JNA?
IDE: IntelliJ
Java: AdoptOpenJDK 11.0.4
JNA: 4.2.2
Any kind of help will be highly appreciated!
This is the result of a bug in AdoptOpenJDK jdk-11.0.4+11 on macOS, persisting through 11.2.
It will be fixed in the jdk-11.0.4+11.3 release.
If you can't wait for the new release you can temporarily resolve by downgrading to 11.0.3+7
What version of cassandra unit? Support for java 11 (https://issues.apache.org/jira/browse/CASSANDRA-9608) isn't in until cassandra 4 and I dont think embedded cassandra is setup for that yet

PredictionIO: Installing JDBC driver for postgresql on OSX

I'm trying to follow the PredictionIO tutorial for a text classification enginge provided here. I'm using OSX and PredictionIO together with PostgreSQL.
When trying to import data into my naked App with the command
pio import --appid 1 --input data/stopwords.json
I get the following error:
Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost/pio
So obviously the JDBC driver is missing or not linked appropriately. Here's where my trouble begins. Naively I downloaded the postgres jdbc driver from this source. I read that I need to add it to java's "CLASSPATH", so I tried this by adding
export CLASSPATH=$CLASSPATH:~/java-extensions/postgresql-9.4.1207.jre6.jar
to my bash configuration. Unfortunatly this does not work. A similar error situation is discussed here - but with my knowledge I'm not able to extract useful hints from it.
--
Version details:
psql (PostgreSQL) 9.4.5 installed via homebrew
OSX Yosemite
PredictionIO 0.9.5
pio status reports "Your system is all ready to go."
See this Google Group thread: https://groups.google.com/d/topic/predictionio-user/yJexMh5HpHc/discussion
tl;dr :
Fixed in next release of PredictionIO (v0.9.6), coming soon.
Workaround for earlier PIO versions :
pio train -- --driver-class-path WHEREVER/postgresql-9.4-1204-jdbc41.jar
As alex9311 pointed out, the pio import nowadays accepts a flag to specify the driver location:
pio import --appid 1 --input data/stopwords.json --driver-class-path WHEREVER/postgresql-9.4-1204-jdbc41.jar
See also this SO question

oracle sql developer connection error

I can't get the connection to work for Oracle WebLogic 12c using SQL Developer. Here is the error that I get when I click connect:
An error was encountered performing the requested operation:
/usr/lib/java/libocijdbc11.dylib: dlopen(/usr/lib/java/libocijdbc11.dylib, 1): Library not loaded: /ade/b/2475221476/oracle/rdbms/lib/libclntsh.dylib.11.1
Referenced from: /usr/lib/java/libocijdbc11.dylib
Reason: image not found
Vendor code 0
When I click Test in the Settings of SQL Developer I get the following log:
Testing the Instant Client located at /usr/lib/java
Testing client directory ... OK
Testing loading Oracle JDBC driver ... OK
Testing checking Oracle JDBC driver version ... OK
Driver version: 11.2.0.3.0
Testing testing native OCI library load ... Failed:
Error loading the native OCI library
The native OCI driver could not be loaded. The system propertyjava.library.path
contains the entries from the environment variable DYLD_LIBRARY_PATH.
Check it to verify that the expected native library
directory /usr/lib/java is present and precedes any other client installations.
java.library.path = /Users/gasim/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
Here is an outline of my setup:
Operating system: OSX Mavericks (10.9.4 to be specific)
The Java SE Runtime version: "1.8.0" (build "1.8.0_11-b12")
Oracle Instant is located under /usr/lib/java. The directory is set in the SQL Developer (through Database > Advanced)
The Oracle server is up and running with default parameters (localhost:7001) and I can access the web admin console.
Oracle Instant Client version: 11.2.0.4.0
java.library.path = /Users/gasim/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
The directory listing of /usr/lib/java:
BASIC_README
adrci
genezi
libclntsh.dylib.11.1
libnnz11.dylib
libocci.dylib.11.1
libociei.dylib
libocijdbc11.dylib
ojdbc5.jar
ojdbc6.jar
uidrvci
xstreams.jar
The thing is, libocijdbc11.dylib does exist in /usr/lib/java and that directory is in the library path of java. I just don't get it. Am I missing something here? What else can I try for solving this problem or at least debugging deeper?
I'll tell you how I solved, finally...
I'm running OSX 10.9.4, with jboss 7.1.1.Final installed through brew, and an env variable JBOSS_HOME=/usr/local/opt/jboss-as/libexec.
I already had an ojdbc.jar in $JBOSS_HOME/modules/com/oracle/main, version 11.2.0.3, so I downloaded Instant Client version 11.2.0.3.
I commented any JAVA_OPTS that was populating java.library.path with instantclient libraries, like this:
#JAVA_OPTS="$JAVA_OPTS -Djava.library.path=$JBOSS_HOME/instantclient_11_2"
I copied, for being comfortable, instantclient_11_2 inside $JBOSS_HOME.
It's just a matter of doing:
export DYLD_LIBRARY_PATH=$JBOSS_HOME/instantclient_11_2
$JBOSS_HOME/bin/standalone.sh
It now works. Now I have another problem to solve:
Native Library /usr/local/Cellar/jboss-as/7.1.1.Final/libexec/instantclient_11_2/libocijdbc11.dylib already loaded in another classloader

unknown sqlite error - java mac os 10.5 - unsatisfied link error

I just recently started getting this error for a completely unknown reason.
The code has not changed since last run time.
Any ideas?
java.lang.UnsatisfiedLinkError: /private/var/folders/l8/l8xdyr88GEO5adGKtmu9XU+++TI/-Tmp-/sqlite-3.7.2-libsqlitejdbc.jnilib: no suitable image found. Did find: /private/var/folders/l8/l8xdyr88GEO5adGKtmu9XU+++TI/-Tmp-/sqlite-3.7.2-libsqlitejdbc.jnilib: unknown required load command 0x80000022
update on root cause:
java.sql.Connection conn = DriverManager.getConnection(mySQL);
where mySQL = "jdbc:sqlite:/Users/Jason/seeking.db"
This file 100% exists. This connection attempt is causing the error.
//////////////SOLUTION:
I had switched my java (Mac system preferences for java) preference to load Java SE 6 as a priority. This will not work with the SQLite jdbc library.
J2SE 5.0 is needed for this library to behave properly (it seems).
Hope this helps someone else down the road!!

Categories

Resources