Writing excel to sharepoint location results in Execute failed: ("NullPointerException"): null

Hi all,

I’m trying to write an excel file to a sharepoint location and it results in a error:
Execute failed: (“NullPointerException”): null

The workflow first opens the same file, does some changes and updates, and then tries to overwrite the file, but fails. The excel writer node starts working and at 75% it fails with an error. A temporary file is saved in the sharepoint location but i cannot open it.

I have successfully written the file to a local location, so it does not seem to be an issue with the data/table itself, but rather with the sharepoint connection. I also tried writing to a new file on the sharepoint location, but this results in the same error.

The log is showing this:
2021-10-12 11:12:36,788 : ERROR : KNIME-Worker-135-Excel Writer 4:463 : : Node : Excel Writer : 4:463 : Execute failed: (“NullPointerException”): null
java.lang.NullPointerException
at org.knime.ext.sharepoint.filehandling.GraphApiUtil.unwrapIOE(GraphApiUtil.java:109)
at org.knime.ext.sharepoint.filehandling.fs.SharepointSeekableByteChannel.uploadLarge(SharepointSeekableByteChannel.java:173)
at org.knime.ext.sharepoint.filehandling.fs.SharepointSeekableByteChannel.copyToRemote(SharepointSeekableByteChannel.java:112)
at org.knime.ext.sharepoint.filehandling.fs.SharepointSeekableByteChannel.copyToRemote(SharepointSeekableByteChannel.java:1)
at org.knime.filehandling.core.connections.base.TempFileSeekableByteChannel.close(TempFileSeekableByteChannel.java:164)
at org.knime.filehandling.core.connections.FSSeekableByteChannel.close(FSSeekableByteChannel.java:89)
at java.nio.channels.Channels$1.close(Channels.java:178)
at org.knime.filehandling.core.connections.FSOutputStream.close(FSOutputStream.java:104)
at java.io.FilterOutputStream.close(FilterOutputStream.java:159)
at org.knime.ext.poi3.node.io.filehandling.excel.writer.table.ExcelMultiTableWriter.saveWorkbook(ExcelMultiTableWriter.java:158)
at org.knime.ext.poi3.node.io.filehandling.excel.writer.table.ExcelMultiTableWriter.saveFile(ExcelMultiTableWriter.java:147)
at org.knime.ext.poi3.node.io.filehandling.excel.writer.table.ExcelMultiTableWriter.writeTables(ExcelMultiTableWriter.java:126)
at org.knime.ext.poi3.node.io.filehandling.excel.writer.ExcelTableWriterNodeModel.write(ExcelTableWriterNodeModel.java:195)
at org.knime.ext.poi3.node.io.filehandling.excel.writer.ExcelTableWriterNodeModel.execute(ExcelTableWriterNodeModel.java:162)
at org.knime.core.node.NodeModel.executeModel(NodeModel.java:576)
at org.knime.core.node.Node.invokeFullyNodeModelExecute(Node.java:1245)
at org.knime.core.node.Node.execute(Node.java:1025)
at org.knime.core.node.workflow.NativeNodeContainer.performExecuteNode(NativeNodeContainer.java:558)
at org.knime.core.node.exec.LocalNodeExecutionJob.mainExecute(LocalNodeExecutionJob.java:95)
at org.knime.core.node.workflow.NodeExecutionJob.internalRun(NodeExecutionJob.java:201)
at org.knime.core.node.workflow.NodeExecutionJob.run(NodeExecutionJob.java:117)
at org.knime.core.util.ThreadUtils$RunnableWithContextImpl.runWithContext(ThreadUtils.java:334)
at org.knime.core.util.ThreadUtils$RunnableWithContext.run(ThreadUtils.java:210)
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)
Suppressed: java.nio.channels.ClosedChannelException
at sun.nio.ch.FileChannelImpl.ensureOpen(FileChannelImpl.java:110)
at sun.nio.ch.FileChannelImpl.size(FileChannelImpl.java:300)
at org.knime.filehandling.core.connections.base.TempFileSeekableByteChannel.close(TempFileSeekableByteChannel.java:158)
at org.knime.filehandling.core.connections.FSSeekableByteChannel.close(FSSeekableByteChannel.java:89)
at java.nio.channels.Channels$1.close(Channels.java:178)
at org.knime.filehandling.core.connections.FSOutputStream.close(FSOutputStream.java:104)
… 18 more

Does anybody have an idea of what is going wrong?

Regards,
Mark

Hello,

What nodes do you use before the Excel Writer to create a connection to the sharepoint and how are they configured?

Greetings
Torben

1 Like

I’m using the microsoft authentication and the sharepoint online connector node to set up the sharepoint connection. In the authentication node i have selected the read/write option.

Any specific option you are thinking about?

1 Like

Hi @maroelof

looking through the code, there is a bug in our code that handles an error response from Sharepoint. This bug results in this rather non-descriptive NullPointerException (I have opened an internal ticket for the bug). But the NullPointerException only occurs if there was an error response coming from Sharepoint while trying to do a multi-part upload (we use multi-part uploads for files >4MB).

To figure out what the Sharepoint error response is, could you try use the Excel Writer to write a small file (smaller than 4MB) to the same location? For small files we do not use multi-part uploads, and hence we should be able to see the actual Sharepoint error response. I suspect it might be a permissions issue on the Sharepoint side.

Best,
Björn

4 Likes

Hi Björn,

i just successfully saved a small excel file to the sharepoint using the same workflow. So there is no error message to share in this case.

Gr,
Mark

1 Like

I also just saved the file I had issues with onto sharepoint. The only difference is that now i’m working at the office, and i had the issues at home. I will check whether it still does not work at home when i login there.

I am also getting the same null pointer exception error using a similar workflow (MS Authentication + Sharepoint Connector) while writing to an xlsx file.

I have the same issue :frowning: can someone please help with ideas on how to solve it?