Quantcast
Channel: KNIME RSS
Viewing all articles
Browse latest Browse all 4157

InvocationTargetException while reading xlsx file using poi

$
0
0

Hi all,

my goal is to simply read a .xlsx file to later put it into a data table for further usage.

i have attached the package structure. there shouldn't be nothing wrong.

this is my java code:

	File existingXlsx = new File("D:\\somewhere\\Test.xls");
		System.out.println("File Exists: " + existingXlsx.exists());


		Workbook workbook = new XSSFWorkbook(new FileInputStream(
				existingXlsx));

		Sheet worksheet = workbook.getSheet("Sheet1");
		Row row1 = worksheet.getRow(0);
		Cell cellA1 = row1.getCell((short) 0);
		String a1Val = cellA1.getStringCellValue();


		System.out.println("A1x: " + a1Val);

 

I executed this java code in a java appliction and it works. so the java code is right. but when i am integrating this into KNIME i get the following exception. btw. when i use the given xls-reader provided from KNIME and try to browse for .xlsx files, i also get an InvocationTargetException. Please help! Thx in advance!

org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
    at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:62)
    at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:403)
    at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:155)
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:207)
    at siemenst.ct.test.Test123NodeModel.execute(Test123NodeModel.java:121)
    at org.knime.core.node.NodeModel.execute(NodeModel.java:732)
    at org.knime.core.node.NodeModel.executeModel(NodeModel.java:566)
    at org.knime.core.node.Node.invokeFullyNodeModelExecute(Node.java:1128)
    at org.knime.core.node.Node.execute(Node.java:915)
    at org.knime.core.node.workflow.NativeNodeContainer.performExecuteNode(NativeNodeContainer.java:556)
    at org.knime.core.node.exec.LocalNodeExecutionJob.mainExecute(LocalNodeExecutionJob.java:95)
    at org.knime.core.node.workflow.NodeExecutionJob.internalRun(NodeExecutionJob.java:179)
    at org.knime.core.node.workflow.NodeExecutionJob.run(NodeExecutionJob.java:110)
    at org.knime.core.util.ThreadUtils$RunnableWithContextImpl.runWithContext(ThreadUtils.java:328)
    at org.knime.core.util.ThreadUtils$RunnableWithContext.run(ThreadUtils.java:204)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.knime.core.util.ThreadPool$MyFuture.run(ThreadPool.java:123)
    at org.knime.core.util.ThreadPool$Worker.run(ThreadPool.java:246)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:60)
    ... 18 more
Caused by: java.lang.ClassCastException: org.openxmlformats.schemas.drawingml.x2006.main.impl.ThemeDocumentImpl cannot be cast to org.openxmlformats.schemas.drawingml.x2006.main.ThemeDocument
    at org.openxmlformats.schemas.drawingml.x2006.main.ThemeDocument$Factory.parse(Unknown Source)
    at org.apache.poi.xssf.model.ThemesTable.<init>(ThemesTable.java:44)
    ... 23 more


Viewing all articles
Browse latest Browse all 4157

Trending Articles