Copy link to clipboard
Copied
Hi,
We are currently migrating an old CF10 server to CF2018; theres been very few problems. A lot of the pages have the ability to export their views to xls. When the system gets to the SpreadSheetWrite() call, a java runtime reflection exception is thrown:
java.lang.reflect.InvocationTargetException
It seems like java is throwing the error in such a way that CF isnt able to resume so my catch never gets triggered, so I cant get any additional information. Haven't been able to figure out a way to catch and unwind the java error and the CF logs don't seem to have anything in them.
I've tried the traditional CF catch "any" and I've tried catching "java.lang.Exception", but processing seems to end the moment SpreadSheetWrite() is called.
I've also dumped the spreadsheet object prior to the write call, it appears to be properly formed in memory. I tried the same function on multiple sites within the server, they are all exhibiting the same behavior.
Does anyone have any suggestions on how I can possibly catch this exception and unroll it?
any advice would be greatly approeciated
Dave
Hello,
This issue is resolved.
I was finally able to unwrap the exception stack; it turned out to be a null pointer exception. Java was trying to instantiate a FontManager; had me scratching my head for a bit, but after some digging I found an article on-line talking about the PDFService having some prerequisites on Linux:
http://blog.immanuelnoel.com/2014/07/15/coldfusion-11-pdf-service-prerequisites-on-linux/
The stack trace was referencing x11-ibm-type1, so I gave the above a shot, and just l
...Copy link to clipboard
Copied
I have a different answer than you expected: I would assert that the cfspreadsheet should not fail that way, so instead of better handling it, I would propose that you investigate if there was a problem in how you updated the CF2018 you are testing against. Do you have access to the CF Admin, and the CF logs? That will make this easiest.
First, can you confirm (in the CF Admin "settings summary" page) that you've updated it beyond what it came with originally? They most recent was 8, from last week. If you may do that, it's CRITICAL that you then do an "upgrade" of the web connector, or CF sites served via IIS or Apache will break until you do. For more on that, see a post I did, Three reasons your sites may break, and how to fix them, after applying March 2020 update to CF2018 ... .
Second, whatever last update you may have done (to CF2018), have you checked to make sure that there were 0 errors, as reflected in the update log? I discuss that here: Having problems after applying a CF update? What to check, and how to recover!
Let us know what you find there, and if all checks out, then while I appreciate you still want to solve the error handling, you can find more detail about the error in the CF logs, especially the exception.log, which may help. (I'll leave others to help with more on the error handling, if it's possible with such an error.)
One last thing: if you could create a very small, simple example that demonstrates the error (in just a few self-contained lines), then you could either share that for others to confirm for you here--or better, run it on the cffiddle.org site, if possible. I realize you may feel you can't do either.
Copy link to clipboard
Copied
Hi Charlie,
I appreciate the feedback. We are currently running ColdFusion 2018 Update 7; update 8 needs to wait for the weekend, I cant afford the downtime just this second.
We're running CentOS Linux 7 (Core)
The exception logs were, of course, the first place I ran to when I first started running into this error. Nothing shows up there. There are currently 199 log entries; I go back and run the code, generate the exception, go back to the logs, still same 199 log entries. It "appears" like this exception is stopping all processing (otherwise my own catch would be reached).
heres a snippet:
public void function wildtest( required string path_name ) {
spObj = spreadsheetNew();
spreadsheetCreateSheet(spObj,"A");
spreadsheetaddrow(spObj,"x,x,x,x,x",3,1);
spreadsheetsetActiveSheet(spObj,"A");
spreadsheetaddrow(spObj,"z,z,z,z,z",3,1);
spreadsheetsetActiveSheetNumber(spObj,1);
spreadsheetaddrow(spObj,"a,b,c,d,e",3,1);
writedump(spObj);
try{
SpreadsheetWrite(spObj,"#arguments.path_name#", "yes");
} catch("java.lang.Exception" error) {
writeOutput( "<p>Caught <strong>JAVA RUNTIME</strong></p>" );
writeDump( var = error, show = "type,message" );
} catch ( "any" error ) {
writeOutput( "<p>Caught <strong>CF ANY</strong></p>" );
writeDump( var = error, show = "type,message" );
}
}//eof wildtest()
The writedump() is in the middle so you can see the spreadsheet is well formed in memory before the write gets called. The write is alone in the try/catch because I slowly backed code out of the block as I pinpointed which function was causing this issue.
The error simply comes up as:
An Internal Error Has Occured:
java.lang.reflect.InvocationTargetException
I tried it on cffiddle, but I dont have permission to write to disk so I get a permissive exception (which is further than I've gotten with my own).
This all essentially says I have a problem unique to me and my environment, which leads me back to my original question:
How can I unwind a reflective exception that stops coldfusion processing?
thanks again
Dave
Copy link to clipboard
Copied
Just a quick update to say I applied update 8
thanks for your notes on the connector; a lot easier that hand compiling a new one like under CF8 🙂
Copy link to clipboard
Copied
I'm not sure about this, but I seem to recall that some spreadsheet operations require Open Office. So, you might just need to reinstall Open Office, or IBM Office or whatever it's called nowadays. Charlie can probably let you know if this is a possible issue.
Dave Watts, Eidolon LLC
Copy link to clipboard
Copied
Dave,
I think it's now called Libre Office. I've heard it's better than OO ever was. IDK.. haven't used it.
But I am interested in what you mentioned. Never heard that, before. We are running CF without OO/LO/MSO on it and have never run in to what dtb26 is describing. Then again, we are running CF2016, not 2018.
dtb, I don't know if this will help, or not, but I did a quick Google search and found this.
HTH,
^ _ ^
UPDATE: What version of Java are you running with CF2018? Is your environment sandboxed? Sandbox has caused us quite a few headaches.
Copy link to clipboard
Copied
Hi,
Thanks for the information. I'm somewhat familiar with Libre; I believe that was the split branch of OpenOffice after Sun gave up Star Office (but before they reclaimed it) to open source. Can't recall for sure what the split was about, Libre wanted to charge or something like that. I'm getting too old to keep all these stories straight 🙂
I believe Coldfusion 2018 ships with Java 9 JRE bundled; I'll have to double check in the morning, but I'm pretty sure its 9.
Thanks also for the link; the reflection layer is the whole reason this is an issue; if the underlying error would get logged somewhere I could be well on my way. As it is, I'm stuck I think; I need Coldfusion to generate the exception, but its looking increasingly like an unhandled exception, so it never resumes processing.
My next task is to refactor two sites that were using CFTree; I'm not sure which effort is worse 🙂
Thanks for your input!
Dave
Copy link to clipboard
Copied
My next task is to refactor two sites that were using CFTree; I'm not sure which effort is worse
I do not envy your task list. My condolences.
V/r,
^ _ ^
Copy link to clipboard
Copied
Hello,
This issue is resolved.
I was finally able to unwrap the exception stack; it turned out to be a null pointer exception. Java was trying to instantiate a FontManager; had me scratching my head for a bit, but after some digging I found an article on-line talking about the PDFService having some prerequisites on Linux:
http://blog.immanuelnoel.com/2014/07/15/coldfusion-11-pdf-service-prerequisites-on-linux/
The stack trace was referencing x11-ibm-type1, so I gave the above a shot, and just like that, all my problems went away.
Thanks to everyone that offered advice and input.
Dave
Copy link to clipboard
Copied
Good sleuth work! Thanks for posting your solution.