I am having the exact same issue reported in this StackOverflow
question:
http://stackoverflow.com/questions/25101559/xssfworkbook-constructor-is-undefined
To reproduce, use these Gradle dependencies:
dependencies {
compile (
'org.apache.camel:camel-core:2.14.1',
'org.apache.camel:camel-mail:2.14.1',
'org.apache.poi:poi:3.8',
'org.apache.poi:poi-ooxml:3.8',
'org.apache.commons:commons-lang3:3.3.2'
)
}
Which pull in all of the following transitive dependencies:
camel-core-2.14.1.jar
camel-mail-2.14.1.jar
commons-codec-1.9.jar
commons-lang3-3.3.2.jar
FastInfoset-1.2.12.jar
istack-commons-runtime-2.16.jar
jaxb-api-2.2.7.jar
jaxb-core-2.2.7.jar
jaxb-impl-2.2.7.jar
jsr173_api-1.0.jar
mail-1.4.7.jar
poi-3.11.jar
poi-ooxml-3.11.jar
poi-ooxml-schemas-3.11.jar
slf4j-api-1.6.6.jar
stax-api-1.0.1.jar
xmlbeans-2.6.0.jar
Then run this Groovy code (or modify it into Java for the same effect):
package com.me.myapp
import org.apache.commons.lang3.exception.ExceptionUtils
import org.apache.poi.xssf.usermodel.XSSFWorkbook
class Driver {
static void main(String[] args) {
try {
println "About to read a file into a handler."
File file = new File("C:\\Users\\myuser\\sample.xlsx")
println "File ${file} read into a handler."
XSSFWorkbook spreadsheet = new XSSFWorkbook(file)
println "Spreadsheet initialized successfully."
} catch(Throwable t) {
println ExceptionUtils.getStackTrace(t)
}
}
}
When that runs, you'll get:
About to read a file into a handler.
File C:\Users\myuser\sample.xlsx read into a handler.
groovy.lang.GroovyRuntimeException: Could not find matching constructor
for: org.apache.poi.xssf.usermodel.XSSFWorkbook(java.io.File)
at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1723)
at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1526)
at
org.codehaus.groovy.runtime.callsite.MetaClassConstructorSite.callConstructor(MetaClassConstructorSite.java:46)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:232)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:244)
at
io.hotmeatballsoup.paperstream.ws.service.routes.Driver.main(Driver.groovy:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at
groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1440)
at
org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:888)
at
groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:285)
at groovy.lang.GroovyShell.run(GroovyShell.java:522)
at groovy.lang.GroovyShell.run(GroovyShell.java:511)
at groovy.ui.GroovyMain.processOnce(GroovyMain.java:650)
at groovy.ui.GroovyMain.run(GroovyMain.java:381)
at groovy.ui.GroovyMain.process(GroovyMain.java:367)
at groovy.ui.GroovyMain.processArgs(GroovyMain.java:126)
at groovy.ui.GroovyMain.main(GroovyMain.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:106)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:128)
I have verified that the 3.11 versions are what my IDE (Eclipse) is
using, and that my Eclipse sees the XSSFWorkbook(java.io.File) on its
classpath.
If you look at that StackOverflow question, you'll see MANY other people
are having this exact same problem. **Please advise.** If this is a
bug, I would be happy to patch/fix, but would ask for some expert
guidance from the community.
Best,
Zac
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]