Unable to call rJava library from within a R UDTF

I am writing in the hopes that someone may have encountered this issue and may be able to help. In one of our projects, I need to access Vertica database from within a Vertica R UDTF. This requires calling library RJDBC and rJava from within R UDTF. rJava is the pre-requisite for RJDBC package. When rJava library is called from within R UDTF, it gives the following error:

ERROR 3399: Failure in UDx RPC call InvokeProcessPartition(): Error calling processPartition() in User Defined Object [testv1p] at [/scratch_a/release/svrtar19690/vbuild/vertica/OSS/UDxFence/RInterface.cpp:1387], error code: 0, message: Exception in processPartitionForR: [package or namespace load failed for ‘rJava’]

The interesting thing is that it works just fine if I try to call the rJava library from regular R session but not from within R UDTF.

Has anyone encountered this before? Or have you attempted to connect to Vertica database from within R UDTF or R UDX? If so, would you provide some tips to resolve this? I have tried a lot of things discussed in the net but unfortunately none worked. From all the research that I have done, I feel this has to do with the system level R UDTF and how it interacts with JAVA JDK and rJava.

Any information you can provide would be appreciated.

Below is my code for R UDTF:

Main Function

testv1 <- function(y)
setwd("/path to the code")
vDriver <- JDBC(driverClass="com.vertica.jdbc.Driver", classPath="/home/userid/vertica-jdbc-8.1.1-7.jar")
myresults<-dbGetQuery(vertica,"select 1,2 from dual")

Factory function

testv1Factory <- function()

Any information is appreciated. I have put a lot of hours in researching but I have exhausted my search.



  • Options
    HibikiHibiki Vertica Employee Employee

    Hi Shree,

    Can you add the following to /etc/bashrc and try to run this function?

    export LD_LIBRARY_PATH=/opt/vertica/R/lib:/data/qb_workspaces/jenkins2/ReleaseBuilds/Grader/REL-9_2_0-x_grader/build/third-party/install/lib:/usr/lib/jvm/java-1.8.0-openjdk-

    Please change the directory of JAVA_HOME according to your environment.

    Best regards,


Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file