rJava issue on Posit Connect

After updating Java packages on Posit Connect server, an issue with the Java dependency (rJava) appeared, which causes Java-based applications to fail.

The root cause seems to be missing linkage to Java (libjvm.so):

  error: unable to load shared object '/opt/rstudio-connect/mnt/packrat/4.4.1/v2/library/rJava/7ca62a0003c51d5684b8d70e8a7d0404/rJava/libs/rJava.so':
  libjvm.so: cannot open shared object file: No such file or directory

libjvm.so itself definitely exists on server, however Connect cannot find its path.

 java -version
openjdk version "1.8.0_462"
OpenJDK Runtime Environment (build 1.8.0_462-b08)
OpenJDK 64-Bit Server VM (build 25.462-b08, mixed mode)

ls -l /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.462.b08-2.el8.x86_64/jre/lib/amd64/server/libjvm.so
-rwxr-xr-x. 1 root root 23943112 Jul 11 18:08 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.462.b08-2.el8.x86_64/jre/lib/amd64/server/libjvm.so

I am thinking about adding some paths to the /etc/rstudio-connect/rstudio-connect.gcfg file, but I cannot find any guidance or examples on this matter.

Any advice would be appreciated.

You may want to start by running R CMD javareconf as described here: Appendix A β€” Essential and useful other programs under a Unix-alike – R Manuals :: R Installation and Administration ΒΆ If details of your java installation have changed, your R installations need to be updated thus.

If you are using a supervisor script, that may also have a value of JAVA_HOME set that may need updating.

Yes, I have run javareconf command, but it didn't help

And here is what we have in /opt/R/4.3.1/lib/R/etc/ldpaths

After all, sudo /opt/R/4.4.1/bin/R CMD javareconf helped to configure the paths for R 4.4.1 which is default version for our Connect (when I did which R I got the wrong version, thus configured paths for the wrong R).

Hope this case may help other users as well.

Thanks for help and info!

The screenshot you shared appears to reference R 4.3.1. The error in your initial post indicates that R 4.4.1 is in use by the content. You'll need to run R CMD javareconf for each version of R on the system.