I sucessfully installed RApache on my Debian 11 server. The following R script runs flawlessly when being executed via URL/Apache:
y = rnorm(100)
print(y)
Sadly, another script with rJava/RJDBC embedded causes an internal server error:
Sys.setenv(LD_LIBRARY_PATH = "/usr/lib/jvm/default-java/bin/java")
options(java.parameters = c("-Djdk.tls.client.protocols=TLSv1.2"))
library(RJDBC)
# Verbindungsinformationen
server <- "172.20.10.84\\SESQL"
database <- "SEMESS"
username <- " "
password <- " "
# JDBC-Treiber laden
jdbc_driver <- "/etc/mssql-jdbc-12.2.0.jre11.jar"
drv <- JDBC(driverClass = "com.microsoft.sqlserver.jdbc.SQLServerDriver", classPath = jdbc_driver)
# Verbindung aufbauen
conn <- dbConnect(drv, sprintf("jdbc:sqlserver://%s;databaseName=%s;encrypt=true;trustServerCertificate=true", server, database), username, password)
dbDisconnect(conn)
The script runs smoothly when being excuted with Rscript test.R.
When making an sudo tail -f /var/log/apache2/error.log it shows:
libjvm.so: cannot open shared object file: No such file or directory
Error: package 'rJava' could not be loaded
Any hints for me for fixing this problem? I already tried to add SetEnv LD_LIBRARY_PATH with the Java Library Path to my Apache 000-default.conf.
Any help is highly appreciated.