question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot Export Tables to Excel

See original GitHub issue

Prerequisites

Description

In Table View, I try to export a table of data to Excel. It looks like it all works, I save on my Desktop but then nothing actually happens (the document doesn’t appear). I asked a teammate to do the same thing, he went through the same process as I did, and it worked, so not sure what the issue is?

This seems to be an intermittent issue and the exception is:

java.io.IOException: The system cannot find the path specified
	at java.io.WinNTFileSystem.createFileExclusively(Native Method)
	at java.io.File.createTempFile(Unknown Source)
	at org.apache.poi.util.TempFile$DefaultTempFileCreationStrategy.createTempFile(TempFile.java:105)
	at org.apache.poi.util.TempFile.createTempFile(TempFile.java:60)
	at org.apache.poi.xssf.streaming.SheetDataWriter.createTempFile(SheetDataWriter.java:80)
	at org.apache.poi.xssf.streaming.SheetDataWriter.<init>(SheetDataWriter.java:63)
	at org.apache.poi.xssf.streaming.SheetDataWriter.<init>(SheetDataWriter.java:68)
	at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheetDataWriter(SXSSFWorkbook.java:292)
	at org.apache.poi.xssf.streaming.SXSSFSheet.<init>(SXSSFSheet.java:69)
	at org.apache.poi.xssf.streaming.SXSSFWorkbook.createAndRegisterSXSSFSheet(SXSSFWorkbook.java:624)
Caused: java.lang.RuntimeException
	at org.apache.poi.xssf.streaming.SXSSFWorkbook.createAndRegisterSXSSFSheet(SXSSFWorkbook.java:628)
	at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(SXSSFWorkbook.java:645)
	at au.gov.asd.tac.constellation.views.tableview2.TableViewUtilities$ExportToExcelFilePlugin.execute(TableViewUtilities.java:191)
	at au.gov.asd.tac.constellation.pluginframework.templates.SimplePlugin.run(SimplePlugin.java:65)
[catch] at au.gov.asd.tac.constellation.graph.node.pluginframework.DefaultPluginEnvironment$1.call(DefaultPluginEnvironment.java:125)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Steps to Reproduce

  1. [First Step]
  2. [Second Step]
  3. [and so on…]

Expected behaviour: Tables get exported to an Excel File

Actual behaviour: Tables are not being exported to an Excel File

Reproduces how often: Sometimes

Additional Information

N/A

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
serpens24commented, May 4, 2020

Basic steps to reproduce:

  1. Open a windows Explorer window to %TEMP% and another to Desktop
  2. Start Constellation, Create a new empty graph and open the Table View
  3. In Table view,select to view Nodes
  4. In Tableview, select Export to Excel, select Desktop, then enter the name test1
  5. Confirm that a directory poifiles has been created inside %TEMP% if it didn’t already exist
  6. From Windows Explorer delete the directory poifiles
  7. In constellation, in TableView elect Export to Excel, select Desktop, then enter the name test2 NOTE: At this point, often I find the file test2 is not created on the desktop - if it’s not created there, is seems to be created ‘elsewhere’. My suspicion is there is some form of race condition such that when the POI library checks for the poifiles directory and creates it if it does not exist, if this directory isn’t created fast enough the failure occurs.
1reaction
serpens24commented, May 4, 2020

I searched google for the lower level exception and found the following: https://stackoverflow.com/questions/29285076/java-apache-poi-sxssfworkbook-unable-to-create-sheets

https://bz.apache.org/bugzilla/show_bug.cgi?id=57200

This appears to be the same issue … I will dig into these wider issues and look for a solution. An extract from the second link:

_SXSSF creates a temporary file when its saved using the class org.apache.poi.util.TempFile. When a tempfile is first created, the directory name is saved within this class, in the static singleton DefaultTempFileCreationStrategy object. This directory is only created on the first save and its never checked if this directory still exists, as you can see below:

    public File createTempFile(String prefix, String suffix) throws IOException {
        // Identify and create our temp dir, if needed
        if (dir == null)
        {
            dir = new File(System.getProperty("java.io.tmpdir"), "poifiles");
            dir.mkdir();
            if (System.getProperty("poi.keep.tmp.files") == null)
                dir.deleteOnExit();
        }

The directory is automatically deleted when the virtual machine exits. (I believe the directory is also created automatically when you load an xlsx using the event api).

So, if you have two applications both loading and saving excels and you then close one this directory is automatically deleted. Now both applications used exactly the same temp directory. Therefore if you try to save your file in the second application which is still open, an IOException is instead raised as it tries to create the tmp file in the no-longer existing directory. The user cannot save their xlsx any longer._

Read more comments on GitHub >

github_iconTop Results From Across the Web

Export data to Excel - Microsoft Support
Table or query. Note: Forms and reports cannot be exported without their formatting. All fields and records in the underlying object are exported....
Read more >
Error Exporting to Excel | MadgeTech
Error Exporting to Excel · Go to 'Apps & Features' in Windows and find the Microsoft Office entry · Select the entry and...
Read more >
Unable to export an attribute table to an Excel file in ArcGIS Pro
Solution or Workaround · Open the ArcGIS Pro project. · In the Contents pane, browse to and right-click the layer. Click Data >...
Read more >
How to Export MS Access Table data to Excel Spreadsheet
This video explains how you can export data from MS Access table to excel spreadsheet. MS Access allows to export the entire data...
Read more >
Unable to Export output tables to Excel 2007 and higher (*.xlsx)
I am using IBM SPSS Statistics 19 or 20 release and attempting to export a Statistics output table. I have Microsoft Excel 2007...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found