xlconnect icon indicating copy to clipboard operation
xlconnect copied to clipboard

Errors in running code in vignettes

Open thierry-FreeBSD opened this issue 1 year ago • 4 comments

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?

thierry-FreeBSD avatar Sep 19 '22 20:09 thierry-FreeBSD

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.

spoltier avatar Sep 20 '22 09:09 spoltier

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

thierry-FreeBSD avatar Sep 20 '22 17:09 thierry-FreeBSD

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.

spoltier avatar Oct 21 '22 10:10 spoltier

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.

thierry-FreeBSD avatar Oct 21 '22 21:10 thierry-FreeBSD