Leftbower / cfspreadsheet-lucee-5

A cfspreadsheet extension for Lucee 5
23 stars 10 forks source link

invocation target exception #27

Closed zaic82 closed 1 year ago

zaic82 commented 4 years ago

Hi,

I am getting invocationtargetexception when I invoke cfspreadsheet tag. I am on Lucee5.x intsalled on linux machine. I installed plugin both using instructions given and from admin tool. The plugin working on my local machine. The error i am receiving is shown in image attached, error

Thank you

Leftbower commented 4 years ago

What is the code that you are running when you get this error? Can we see the full error/stacktrace? What are the differences between your local machine (where it works) and the machine where it doesn't work?

zaic82 commented 4 years ago

Hi, Thank you for your response. The dev is windows machine and test is Linux (centos); this is the only difference.

====code =========

code

========================full error================== Lucee 5.3.6.61 Error (java.lang.InternalError)

Message | java.lang.reflect.InvocationTargetException Stacktrace | The Error Occurred in/org/cfpoi/spreadsheet/Spreadsheet.cfc: line 907called from /org/cfpoi/spreadsheet/Spreadsheet.cfc: line 864called from /org/cfpoi/spreadsheet/Spreadsheet.cfc: line 238called from /spreadsheet.cfc: line 186called from /data/lucee/tomcat/webapps/ROOT/admin/helios/excelFile.cfm: line 10 Java Stacktrace | lucee.runtime.exp.NativeException: java.lang.reflect.InvocationTargetException  at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:86)  at java.base/java.security.AccessController.doPrivileged(Native Method)  at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)  at java.desktop/java.awt.Font.getFont2D(Font.java:497)  at java.desktop/java.awt.Font.canDisplayUpTo(Font.java:2250)  at java.desktop/java.awt.font.TextLayout.singleFont(TextLayout.java:469)  at java.desktop/java.awt.font.TextLayout.(TextLayout.java:530)  at org.apache.poi.ss.util.SheetUtil.getDefaultCharWidth(SheetUtil.java:275)  at org.apache.poi.ss.util.SheetUtil.getColumnWidth(SheetUtil.java:250)  at org.apache.poi.ss.util.SheetUtil.getColumnWidth(SheetUtil.java:235)  at org.apache.poi.xssf.usermodel.XSSFSheet.autoSizeColumn(XSSFSheet.java:501)  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  at java.base/java.lang.reflect.Method.invoke(Method.java:566)  at lucee.runtime.reflection.pairs.MethodInstance.invoke(MethodInstance.java:56)  at lucee.runtime.reflection.Reflector.callMethod(Reflector.java:876)  at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:829)  at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1710)  at org.cfpoi.spreadsheet.spreadsheet_cfc$cf.udfCall3(/org/cfpoi/spreadsheet/Spreadsheet.cfc:907)  at org.cfpoi.spreadsheet.spreadsheet_cfc$cf.udfCall(/org/cfpoi/spreadsheet/Spreadsheet.cfc)  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)  at lucee.runtime.type.UDFImpl.call(UDFImpl.java:217)  at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:779)  at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:785)  at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1710)  at org.cfpoi.spreadsheet.spreadsheet_cfc$cf.udfCall3(/org/cfpoi/spreadsheet/Spreadsheet.cfc:864)  at org.cfpoi.spreadsheet.spreadsheet_cfc$cf.udfCall(/org/cfpoi/spreadsheet/Spreadsheet.cfc)  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)  at lucee.runtime.type.UDFImpl.call(UDFImpl.java:217)  at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:779)  at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:785)  at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1710)  at org.cfpoi.spreadsheet.spreadsheet_cfc$cf.udfCall1(/org/cfpoi/spreadsheet/Spreadsheet.cfc:238)  at org.cfpoi.spreadsheet.spreadsheet_cfc$cf.udfCall(/org/cfpoi/spreadsheet/Spreadsheet.cfc)  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)  at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207)  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:681)  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:568)  at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1917)  at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:864)  at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1729)  at spreadsheet_cfc$cf.udfCall(/spreadsheet.cfc:186)  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)  at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207)  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:681)  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:568)  at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1917)  at lucee.runtime.tag.CFTag.cfcStartTag(CFTag.java:384)  at lucee.runtime.tag.CFTag.doStartTag(CFTag.java:178)  at admin.helios.excelfile_cfm$cf.call(/admin/helios/excelFile.cfm:10)  at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:945)  at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:837)  at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:216)  at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:42)  at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2416)  at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2406)  at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2381)  at lucee.runtime.engine.Request.exe(Request.java:43)  at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1127)  at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:1073)  at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:97)  at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:51)  at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)  at mod_cfml.core.invoke(core.java:152)  at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)  at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373)  at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)  at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590)  at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)  at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)  at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.lang.InternalError: java.lang.reflect.InvocationTargetException  ... 91 more Caused by: java.lang.reflect.InvocationTargetException  at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)  at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)  at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)  at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:84)  ... 90 more Caused by: java.lang.NullPointerException  at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1262)  at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225)  at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:107)  at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:719)  at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:367)  at java.base/java.security.AccessController.doPrivileged(Native Method)  at java.desktop/sun.font.SunFontManager.(SunFontManager.java:312)  at java.desktop/sun.awt.FcFontManager.(FcFontManager.java:35)  at java.desktop/sun.awt.X11FontManager.(X11FontManager.java:56)  ... 95 more Timestamp | 9/9/20 9:39:40 PM EDT

Leftbower commented 4 years ago

Thanks. It appears the error is being thrown when the autoSizeColumnFix function is being called. Specifically it's this line of code:

getActiveSheet().autoSizeColumn( javacast("int", arguments.columnIndex), true )

However, as it's a java invocationtargetexception reflection error, I can't really see what's happening. I do not have Linux so I am unable to test your environment, but as this appears to be a java refection exception, I am guessing it is something different in your java installations between your Windows local machine and your Linux machine? Are they identical? If not are you able to try the same java version as is working on Windows to see if that is the issue?

The extension is (mostly) written in CFML, so you can did into the Spreadsheet.cfc an setup some try/catch/dump blocks to isolate what is happening?

moonpo commented 3 years ago

@zaic82 did you find a solution I'm having the same errors on fresh install of Lucee 5.3.7.47 on Ubuntu 20

andmayfi92 commented 3 years ago

I am also just having this issue on some fresh installs. I am 90% sure it was working previously and it definitely works on my local. Going to start throwing debug catches at it but any pointers would be appreciated.

moonpo commented 3 years ago

@andmayfi92 it's down to the java version you use on your system I narrow it to that. I didn't have the time to go further on that but for sure AdoptOpenJDK has some issue with the Apache POI and cfspreadsheet. You can create an empty spreadsheet it will work but at the moment you try to write something in it will failed. It's something with some fonts not included in that java version.

andmayfi92 commented 3 years ago

@moonpo thanks we are definitely using the AdoptOpenJDK 11.0.9.1. I will try a few others and see what I can get working.

andmayfi92 commented 3 years ago

I found this issue again after another server threw the same error. Solution below for those using AdoptOpenJDK 11.0.9.1

sudo su yum install fontconfig yum install https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/c/cabextract-1.9-7.el7.x86_64.rpm yum install https://downloads.sourceforge.net/project/mscorefonts2/rpms/msttcore-fonts-installer-2.6-1.noarch.rpm fc-cache -fv service lucee_ctl restart