This is a weird one...
I have a shiny app that calls out to a database using a JDBC connection with a .jar file that is supplied with the app bundle. The code runs fine on other machines and looks like:
driver <- RJDBC::JDBC(driverClass = "net.snowflake.client.jdbc.SnowflakeDriver",
classPath = "localfile.jar")
conn <- RJDBC::dbConnect(driver, url, username, password)
RJDBC::dbGetQuery(conn, statement = sql)
However on Connect, this code throws an error when run as the default rstudio-connect user:
Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1], :
java.lang.NoClassDefFoundError: Could not initialize class
net.snowflake.client.core.SFTrustManager
On a hunch, I added a super user on the RStudio Connect host machine to the rstudio-connect group and ran the app under that user and it works!
I'm at a loss here... what possible permissions could the default rstudio-connect user be lacking such that this file (or something Java related) is not accessible? I feel like there are so many possibilities I'm hoping someone knowledgeable could help narrow it down.