xlsx icon indicating copy to clipboard operation
xlsx copied to clipboard

xlsx file not loading and throwing a Java Exception error

Open ChristelSwift opened this issue 1 year ago • 2 comments

i've just changed to a new mac and had to go through this fix to stop R from crashing when launching xlsx.

Now i get this error when i try to load a spreadsheet that didn't cause any issue on my previous machine:

Error in .jcheck() : 
  Java Exception <no description because toString() failed>.jcall(cell, "I", "getCellType")new("jobjRef", jobj = <pointer: 0x12e60f822>, jclass = "java/lang/Throwable")

here's my session info:

R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.3

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/London
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] readxl_1.4.3    RJDBC_0.2-10    DBI_1.2.0       lubridate_1.9.3 forcats_1.0.0   stringr_1.5.1  
 [7] dplyr_1.1.4     purrr_1.0.2     readr_2.1.5     tidyr_1.3.1     tibble_3.2.1    ggplot2_3.4.4  
[13] tidyverse_2.0.0 xlsx_0.6.5      rJava_1.0-11   

loaded via a namespace (and not attached):
 [1] gtable_0.3.4      compiler_4.3.2    tidyselect_1.2.0  scales_1.3.0      R6_2.5.1         
 [6] generics_0.1.3    knitr_1.45        munsell_0.5.0     pillar_1.9.0      tzdb_0.4.0       
[11] rlang_1.1.3       utf8_1.2.4        stringi_1.8.3     xfun_0.41         timechange_0.3.0 
[16] cli_3.6.2         withr_3.0.0       magrittr_2.0.3    grid_4.3.2        rstudioapi_0.15.0
[21] hms_1.1.3         lifecycle_1.0.4   vctrs_0.6.5       glue_1.7.0        cellranger_1.1.0 
[26] xlsxjars_0.6.1    fansi_1.0.6       colorspace_2.1-0  tools_4.3.2       pkgconfig_2.0.3  

and the java version is:

> system("java -version")
openjdk version "21.0.2" 2024-01-16
OpenJDK Runtime Environment Homebrew (build 21.0.2)
OpenJDK 64-Bit Server VM Homebrew (build 21.0.2, mixed mode, sharing)

any idea what the issue might be?

many thanks

ChristelSwift avatar Feb 02 '24 12:02 ChristelSwift

Interesting! It seems to me that toString() is failing on some cell in your spreadsheet when we try to get the cell type .jcall(cell, "I", "getCellType"). It may be that we need to update our Java library (which has been long in the works 😅 ) in order to pick up a new cell type? Is this spreadsheet shareable? It would be great if you have a simple shareable spreadsheet that reproduces the error!

colearendt avatar Mar 27 '24 18:03 colearendt

sure, i created a copy of it removing all rows but one. This tiny version also fails on my machine:

read_xlsx_test.xlsx

ChristelSwift avatar Apr 02 '24 13:04 ChristelSwift