aws / aws/amazon-sagemaker-examples

Cannot load rJava and RDBC packages to connect to Aurora

Open
#3,234 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
11k
Forks
7k
Avg merge
8h 29m
Merged PRs (30d)
8

Description

**Link to the notebook**
[Add the link to the notebook.](https://github.com/aws-samples/amazon-sagemaker-r-kernel-access-data-sources/blob/master/notebooks/aurora_connect.ipynb)

**Describe the bug**
The lifecycle configuration shown [here](https://github.com/aws-samples/amazon-sagemaker-r-kernel-access-data-sources/blob/master/lc_scripts/SageMaker_LC_Script.sh) does not have the dependencies required to load the `RJDBC` package. The notebook returns an error because the `rJava` package cannot be found.

**To reproduce**
Launch the CloudFormation template, load the `aurora_connect.ipynb` notebook, enter the required fields as described in the notebook. The error message will appear when trying to load the `rJava` and `RJDBC` packages.

**Logs**
If applicable, add logs to help explain your problem.

`Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/home/ec2-user/anaconda3/envs/R/lib/R/library/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
Traceback:

1. library(rJava)
2. tryCatch({
. attr(package, "LibPath") <- which.lib.loc
. ns <- loadNamespace(package, lib.loc)
. env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)
. }, error = function(e) {
. P <- if (!is.null(cc <- conditionCall(e)))
. paste(" in", deparse(cc)[1L])
. else ""
. msg <- gettextf("package or namespace load failed for %s%s:\n %s",
. sQuote(package), P, conditionMessage(e))
. if (logical.return && !quietly)
. message(paste("Error:", msg), domain = NA)
. else stop(msg, call. = FALSE, domain = NA)
. })
3. tryCatchList(expr, classes, parentenv, handlers)
4. tryCatchOne(expr, names, parentenv, handlers[[1L]])
5. value[[3L]](cond)
6. stop(msg, call. = FALSE, domain = NA)`

Contributor guide

Open the contributing guide

Research direction

Begin with lc_scripts/SageMaker_LC_Script.sh and reproduce through notebooks/aurora_connect.ipynb after launching the CloudFormation template. Verify that the lifecycle setup provides the dependencies needed by rJava and RJDBC, and that the notebook loads both packages without the reported libjvm.so error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, jupyter-notebook, r, shell
Domain
cloud, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.