miraisolutions / xlconnect

XLConnect: Excel Connector for R
130 stars 32 forks source link

Errors in running code in vignettes #177

Open thierry-FreeBSD opened 1 year ago

thierry-FreeBSD commented 1 year ago

XLConnect is available as a FreeBSD port, and it used to run fine: see https://www.freshports.org/math/R-cran-XLConnect.

But since some days, the tests fail with the hereunder message:

* checking running R code from vignettes ... ERROR
Errors in running code in vignettes:
when running code in 'XLConnect.Rnw'
  ...

> if (file.exists("XLConnectExample1.xlsx")) file.remove("XLConnectExample1.xlsx")

> require(XLConnect)

> wb <- loadWorkbook("XLConnectExample1.xlsx", create = TRUE)

  When sourcing 'XLConnect.R':
Error: NoClassDefFoundError (Java): org/apache/poi/openxml4j/exceptions/InvalidFormatException
Execution halted

  'XLConnect.Rnw' using 'UTF-8'... failed
  'XLConnectImpatient.Rnw' using 'latin1'... OK
* checking re-building of vignette outputs ... NOTE
Error(s) in re-building vignettes:
  ...
--- re-building 'XLConnect.Rnw' using Sweave
Loading required package: XLConnect
XLConnect 1.0.5 by Mirai Solutions GmbH [aut],
  Martin Studer [cre],
  The Apache Software Foundation [ctb, cph] (Apache POI),
  Graph Builder [ctb, cph] (Curvesapi Java library),
  Brett Woolridge [ctb, cph] (SparseBitSet Java library)
https://mirai-solutions.ch
https://github.com/miraisolutions/xlconnect

Error: processing vignette 'XLConnect.Rnw' failed with diagnostics:
 chunk 4 (label = simpleEx1) 
Error : NoClassDefFoundError (Java): org/apache/poi/openxml4j/exceptions/InvalidFormatException

--- failed re-building 'XLConnect.Rnw'

--- re-building 'XLConnectImpatient.Rnw' using Sweave
--- finished re-building 'XLConnectImpatient.Rnw'

SUMMARY: processing the following file failed:
  'XLConnect.Rnw'

Error: Vignette re-building failed.
Execution halted

* checking PDF version of manual ... OK
* DONE
Status: 1 ERROR, 2 NOTEs

I guess that the problem is caused by the upgrade of some dependency, but I cannot see which one… Any idea?

spoltier commented 1 year ago

Hi @thierry-FreeBSD I can't see from the page you provided what the previous version was. XLConnect requires apache POI, we have upgraded to 4.1 since 1.0 in March 2020. If you're using the version from the master branch, it is now requiring POI 5.2.2, which also upgrades most transitive dependencies. The jars are downloaded at load time, there could be an issue with that.

From the error you provided, the POI dependency is causing the issue.

thierry-FreeBSD commented 1 year ago

I'm using POI 4.1.2 with XLConnect 1.0.5, no recent change with them.

spoltier commented 1 year ago

Not sure if this will help, but 1.0.6 is now available on CRAN. It uses a newer version of poi. If the problem persists it must be an issue with downloading the JAR dependencies, which happens the first time the package is loaded.

thierry-FreeBSD commented 1 year ago

Thanks for the notification!

I have updated POI to 5.2.3 and XLConnect to 1.0.6 and this is better.

But there remains a problem with vignettes: Error: NoClassDefFoundError (Java): org/apache/poi/openxml4j/exceptions/InvalidFormatException

I shall investigate this problem.