Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Error Occurs at new XSSFWorkbook(fis)

kyle June 4, 2024

I have confirmed that my fis is functioning correctly and that my packages are available.

if (file.exists() && file.canRead()){
log.debug(" before fis")
def fis = new FileInputStream(file)
log.debug(" after fis")
if (fis.available() > 0) {
log.debug("FileInputStream is valid and has data")
def workbook = new XSSFWorkbook(fis)
log.debug(" after workbook")
}
}

Code to Check Class Source:


def checkClassSource(String className) {
try {
Class clazz = Class.forName(className)
def protectionDomain = clazz.getProtectionDomain()
def codeSource = protectionDomain.getCodeSource()
if (codeSource != null) {
log.info("Class $className is loaded from: ${codeSource.getLocation()}")
} else {
log.info("Class $className is loaded from an unknown source")
}
} catch (ClassNotFoundException e) {
log.error("Class not found: $className", e)
}
}

def classesToCheck = [
"org.apache.poi.xssf.usermodel.XSSFWorkbook",
"org.apache.poi.ss.usermodel.Workbook",
"org.apache.xmlbeans.XmlObject",
"org.apache.commons.collections4.CollectionUtils"
]

classesToCheck.each { className ->
checkClassSource(className)
}

2024-06-04 19:57:42,835 INFO [runner.ScriptBindingsManager]: Class org.apache.poi.xssf.usermodel.XSSFWorkbook is loaded from: file:/opt/jira/lib/poi-ooxml-3.17.jar

2024-06-04 19:57:42,836 INFO [runner.ScriptBindingsManager]: Class org.apache.poi.ss.usermodel.Workbook is loaded from: file:/opt/jira/lib/poi-3.17.jar

2024-06-04 19:57:42,836 INFO [runner.ScriptBindingsManager]: Class org.apache.xmlbeans.XmlObject is loaded from: file:/opt/jira/lib/xmlbeans-2.6.0.jar

2024-06-04 19:57:42,836 INFO [runner.ScriptBindingsManager]: Class org.apache.commons.collections4.CollectionUtils is loaded from: file:/proj/srv_jira_admin/test_jira_data/plugins/installed-plugins/plugin_14513148309700049936_groovyrunner-7.13.0.jar

 

I have verified that all required classes are available and loaded from the correct sources. However, the error persists at the line def workbook = new XSSFWorkbook(fis). Any insights or suggestions would be greatly appreciated.

1 answer

0 votes
kyle June 4, 2024

The code hasn't changed, but it worked the next day. Why?

Suggest an answer

Log in or Sign up to answer