OHDSI Home | Forums | Wiki | Github

getDbCovariateData() gives me a strange java-error: Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod"

Hi there!

Today i run into a strange error, that I can’t get pass. It appears when running the getDbCohortMethodData()-function, and I pin-pointed it further to the getDbCovariateData()-call in that function, and line 135 in getDbCovariateData:

for (i in 1:length(covariateSettings)) {
    fun <- attr(covariateSettings[[i]], "fun")
    args <- list(connection = connection,
                 oracleTempSchema = oracleTempSchema,
                 cdmDatabaseSchema = cdmDatabaseSchema,
                 cohortTable = cohortDatabaseSchemaTable,
                 cohortId = cohortId,
                 cdmVersion = cdmVersion,
                 rowIdField = rowIdField,
                 covariateSettings = covariateSettings[[i]],
                 aggregated = aggregated)
    tempCovariateData <- do.call(eval(parse(text = fun)), args)

The error I get is:

Error in .jcall(“RJavaTools”, “Ljava/lang/Object;”, “invokeMethod”, cl, :
java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Integer (java.lang.String and java.lang.Integer are in module java.base of loader ‘bootstrap’)

Even stranger, when I run the exact same code last week, it didn’t give me an error. I’ve let a colleage run the same code, he don’t get an error. I’ve checked:

  • R version: 4.0.3
  • R studio version: 1.4.1106
  • options()$java.parameters: -Xmx512m
  • packageVersion(“rJava”): 1.0.4
  • packageVersion(“FeatureExtraction”): 3.1.1
  • packageVersion(“DatabaseConnector”): 4.0.2
  • cmd > java -version: openjdk version 16.0.1

All the above are exactly the same as on my colleagues computer, that can run.

Have anyone experienced anything similar? Something must be off at my side, but I just can’t figure out exactly what… Any help or thoughts appreciated!