Given the following code: ```spreadsheet = New spr...
# cfml-general
d
Given the following code:
Copy code
spreadsheet = New spreadsheetLibrary.Spreadsheet();
reportname = "report.xlsx";
spreadsheet.downloadFileFromQuery( data=qRecords, filename=reportname, xmlFormat=true, streamingXml=true );
using the Spreadsheet library (https://github.com/cfsimplicity/spreadsheet-cfml) with Lucee (latest) on ubuntu and getting the error: “The parameter [filename] to function [downloadFileFromQuery] is required but was not passed in”. The above code clearly is passing the filename argument. Am I missing something?
a
And the error context is def pointing to that third line of code? And the code it reproduces in the context struct is that same line of code. Is that code exactly what you have, or is it an approximation?
d
I simplified the reportname into a static string for the example, but otherwise that is the code. The query qRecords is a query result from a queryMap call where I am adding some cols. The error is def pointing to the line with the downloadFileFromQuery() call
a
Yeah, check the value of
reportname
. I suspect it's null.
d
Actually, I think my Caching setting was hiding my code changes - I had set the Inspect Templates to Never - I wasn’t planning on making changes but discovered the reports not working.
Now onto the actual spreadsheet cfc error:
Copy code
java.lang.reflect.InvocationTargetException
a
OK that's me out of my depth then. Gotta say it's quite odd to have code caching switched on in dev though.
1
d
It’s a legacy system - moving from an large EC2 instance to a new smaller instance as the client moves gradually away from using the application.
1
The exports were working on the old instance and I have a vague memory of missing fonts being an issue. The stack error is:
Copy code
lucee.runtime.exp.NativeException: java.lang.reflect.InvocationTargetException
at java.desktop/sun.font.FontManagerFactory$1.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.font.FontManagerFactory.getInstance(Unknown Source)
at java.desktop/java.awt.Font.getFont2D(Unknown Source)
at java.desktop/java.awt.Font.canDisplayUpTo(Unknown Source)
at java.desktop/java.awt.font.TextLayout.singleFont(Unknown Source)
at java.desktop/java.awt.font.TextLayout.<init>(Unknown Source)
at org.apache.poi.ss.util.SheetUtil.getDefaultCharWidth(SheetUtil.java:285)
at org.apache.poi.xssf.streaming.AutoSizeColumnTracker.<init>(AutoSizeColumnTracker.java:117)
at org.apache.poi.xssf.streaming.SXSSFSheet.<init>(SXSSFSheet.java:84)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.createAndRegisterSXSSFSheet(SXSSFWorkbook.java:705)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(SXSSFWorkbook.java:724)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(SXSSFWorkbook.java:102)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at lucee.runtime.reflection.pairs.MethodInstance.invoke(MethodInstance.java:56)
at lucee.runtime.reflection.Reflector.callMethod(Reflector.java:877)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:831)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1762)
at spreadsheet_cfc$cf.udfCall4(/spreadsheetLibrary/Spreadsheet.cfc:736)
I have reverted back to the old cf_poi custom tag which will work for the most part - it falls over with larger reports.
1
Thanks for suggestions.
Just for personal reference if I have the “Never” setting for Inspect Templates set, which button in the Lucee admin clears those templates from the cache - or is that a manual remove of the compiled files?
a
Dunno sorry. I always have to hunt around for settings in Lucee admin: I don't find it the most intuitive UX.
(not as bad as the way CFAdmin is now, but not as good as how CFAdmin used to be).
😎 1
☝🏻 2
d
Thanks. Agree about admin ux. Some of the labelling/naming could be improved for an easy win. Haven't used ACF since v11 but the ui was a bit easier to understand.
z
Install fonts if you're on Linux headless?
d
I have a feeling it was that but I can't seem to find a reliable source with installation instructions. Will do some more googling 👍
z
Lucee JIRA or forum, on phone
👍 1
c
As Zack says, this has come up before with POI on certain Linux configs that don't have fonts configured. I'm afraid I don't have much in the way of Linux expertise, but these might help? • https://stackoverflow.com/questions/55791235/pentaho-poi-throws-invocationtargetexceptionhttps://dev.lucee.org/t/fixed-adoptopenjdk-and-fontconfig-error-ubuntu-18-04/5119https://github.com/cfsimplicity/spreadsheet-cfml/issues/161
c
I had a very similar problem when using spreadsheet functions in a docker container. I had to re-install
fontconfig
and copy the DejyVu-fonts to
/usr/share/fonts/truetype/dejavu/
👍 1
c