Repository navigation
The requested class 'org.apache.commons.csv.CSVFormat' could not be found in the loaded jars/directories. #381
Description
Activity
Hi Sung
I've just run the test suite using CF 2018,0,19,330149 via commandbox and all tests passed ok.
Could you provide a bit more detail, e.g. the code you're trying to run and the stack trace of the error?
Hi Julian,
Well, the server cycles overnight, and now it works with no error! Very mysterious. The very long stack trace appears below. The file I'm trying to read is about 170MB, which the code was able to handle before without trouble. The last error refereces spreadsheetcfml\javaLoader\JavaLoader.cfc, on line 563.
Also...I was totally wrong about the CF version! Sorry about that. Here's the real info:
Server Product | ColdFusion (2021 Release)
Version | 2021.0.10.330161
Tomcat Version | 9.0.60.0
Edition | Standard
Operating System | Windows Server 2019
OS Version | 10.0
Update Level | D:/ColdFusion2021/cfusion/lib/updates/chf20210010.jar
Adobe Driver Version | 5.1.4 (Build 0001)
coldfusion.runtime.CustomException: The requested class could not be found. at coldfusion.tagext.lang.ThrowTag.doStartTag(ThrowTag.java:139) at coldfusion.runtime.CfJspPage._emptyTag(CfJspPage.java:5191) at cfJavaLoader2ecfc1686595915$funcTHROWEXCEPTION.runFunction(D:\webfiles\DataAccess\spreadsheetcfml\javaLoader\JavaLoader.cfc:563) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:623) at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:516) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:463) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:438) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:310) at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:5011) at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:4991) at cfJavaLoader2ecfc1686595915$funcCREATE.runFunction(D:\webfiles\DataAccess\spreadsheetcfml\javaLoader\JavaLoader.cfc:90) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:623) at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:553) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:516) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:463) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:438) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:310) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:975) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:696) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:503) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4254) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4217) at cfclass2ecfc1894005924$funcLOADCLASSUSINGJAVALOADER.runFunction(D:\webfiles\DataAccess\spreadsheetcfml\helpers\class.cfc:37) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:623) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:553) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:516) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:463) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:438) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:310) at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:5011) at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:4991) at cfclass2ecfc1894005924$funcLOADCLASS.runFunction(D:\webfiles\DataAccess\spreadsheetcfml\helpers\class.cfc:20) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:623) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:553) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:516) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:463) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:438) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:310) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:975) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:696) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:503) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4254) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4217) at cfSpreadsheet2ecfc1291611931$funcCREATEJAVAOBJECT.runFunction(D:\webfiles\DataAccess\spreadsheetcfml\Spreadsheet.cfc:151) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:623) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:553) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:516) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:463) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:438) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:310) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:975) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:696) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:503) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4254) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4217) at cfBaseCsv2ecfc751891992$funcCREATEPREDEFINEDFORMAT.runFunction(D:\webfiles\DataAccess\spreadsheetcfml\objects\BaseCsv.cfc:117) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:623) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:553) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:516) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:463) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:438) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:310) at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:5011) at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:4991) at cfBaseCsv2ecfc751891992$funcINIT.runFunction(D:\webfiles\DataAccess\spreadsheetcfml\objects\BaseCsv.cfc:12) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:623) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:553) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:516) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:463) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:438) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:310) at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:5011) at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:4991) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4279) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4217) at cfReadCsv2ecfc502204288$funcINIT.runFunction(D:\webfiles\DataAccess\spreadsheetcfml\objects\ReadCsv.cfc:10) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:623) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:553) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:516) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:463) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:438) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:310) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:975) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:696) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:503) at coldfusion.runtime.CFPage.___createObjectInternal(CFPage.java:16909) at coldfusion.runtime.CFPage._createObject(CFPage.java:16866) at cfSpreadsheet2ecfc1291611931$funcREADCSV.runFunction(D:\webfiles\DataAccess\spreadsheetcfml\Spreadsheet.cfc:1222) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:623) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:553) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:516) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:463) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:438) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:310) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:975) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:696) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:503) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4254) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:4217) at cfWFMgrEEReport2ecfm1553970755.runPage(D:\webfiles\tlm\heavy\reports\WFMgrEEReport.cfm:192) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:257) at coldfusion.tagext.lang.IncludeTag.handlePageInvoke(IncludeTag.java:749) at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:578) at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:573) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:43) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:162) at coldfusion.filter.IpFilter.invoke(IpFilter.java:45) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:97) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:60) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62) at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:151) at coldfusion.CfmServlet.service(CfmServlet.java:231) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:311) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:46) at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:47) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at coldfusion.inspect.weinre.MobileDeviceDomInspectionFilter.doFilter(MobileDeviceDomInspectionFilter.java:57) at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:47) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at jdk.internal.reflect.GeneratedMethodAccessor107.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.intergral.fusionreactor.j2ee.filterchain.WrappedFilterChain.doFilter(WrappedFilterChain.java:134) at com.intergral.fusionreactor.j2ee.filter.FusionReactorRequestHandler.doNext(FusionReactorRequestHandler.java:772) at com.intergral.fusionreactor.j2ee.filter.FusionReactorRequestHandler.doHttpServletRequest(FusionReactorRequestHandler.java:344) at com.intergral.fusionreactor.j2ee.filter.FusionReactorRequestHandler.doFusionRequest(FusionReactorRequestHandler.java:207) at com.intergral.fusionreactor.j2ee.filter.FusionReactorRequestHandler.handle(FusionReactorRequestHandler.java:809) at com.intergral.fusionreactor.j2ee.filter.FusionReactorCoreFilter.doFilter(FusionReactorCoreFilter.java:36) at jdk.internal.reflect.GeneratedMethodAccessor106.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.intergral.fusionreactor.j2ee.filterchain.WrappedFilterChain.doFilter(WrappedFilterChain.java:71) at jdk.internal.reflect.GeneratedMethodAccessor105.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.intergral.fusionreactor.agent.filter.FusionReactorStaticFilter.doFilter(FusionReactorStaticFilter.java:54) at com.intergral.fusionreactor.agent.pointcuts.NewFilterChainPointCut$1.invoke(NewFilterChainPointCut.java:42) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:377) at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:463) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:889) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1743) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:834)Oh, and as far as the code I'm executing, it's super vanilla. Here's the operative snippet:
spreadsheet = New DataAccess.spreadsheetcfml.Spreadsheet(); path = "[dir of file]"; result = {};When the error occurred, it happened immediately -- like no delay whatsoever, so there was zero processing. CF couldn't find the class and it just stopped cold right away.
Sounds like something odd going on with JavaLoader, but I'm afraid I've no idea what exactly.
Just to be sure, I re-ran the test suite with the latest update of CF21 (update 17, i.e. 2021,0,17,330334) and there were no problems.
If you are on CF21 update 10, then perhaps applying the latest update might make a difference? But then again I've not seen this error on previous releases. Sounds like it could just be some specific condition that hopefully has gone now you've restarted.
Hi Julian,
I'm afraid I'm still getting this error on my CF2021 Update 18 production box. When I try to delete the spreadsheetcfml directory and copy over what works in the lower envirnoments, this is the file that I cannot overwrite due to it being locked: spreadsheetcfml\javaLoader\lib\classloader-20120103162851.jar
I can't get that file to release unless I recycle the service.
Sorry, Sung, but as I say this seems to be an issue with JavaLoader and something specific in your environment. I've just run the Spreadsheet CFML test suite again with ColdFusion 2021 Update 19 and all tests pass, including the
ReadCsv()ones.Having jar files that have been loaded by your JRE locked until it's restarted is normal I think.
Sung, one thing you could try is to bypass JavaLoader, which I've just made slightly easier. You'll need to download the latest
developbranch of the library and then set the path to the library's/libdirectory usingthis.javaSettingsin yourApplication.cfc. Something like this:this.javaSettings = { loadPaths = [ ".\spreadsheetCFML\lib\" ] }Then to instantiate the library (again it must be the current develop branch), do this:
spreadsheet = New spreadsheetCFML.Spreadsheet( loadJavaClassesUsing="javaSettings" )That should cause all java classes to be loaded directly, avoiding JavaLoader.
The reason JavaLoader is used by default though is that it prevents potential class clash errors where you've got 2 versions of the same jar in use by your CF engine, so you'll need to watch out for that.
Thanks so much for this update, Julian! Works great, no more errors or locked JARs. My only fear is what you wrote about class clash errors. Can you elaborate on this a bit? The last thing I want is for this to work but then for the rest of the site to crash!
My only fear is what you wrote about class clash errors. Can you elaborate on this a bit?
Class clashes can happen when you've got different versions of the same java library in your class path. ColdFusion's spreadsheet functionality is supported by an older version of Apache POI so if you loaded the newer version as well via Spreadsheet CFML the engine might be confused as to which one to use. See this blog post for a bit more detail.
But you might be OK with ACF21 which is OSGi based and allows you run it without the spreadsheet package, and it might even work with it installed, I haven't tested it.
Reacted by sungjwoo
On one of my boxes, I'm suddenly getting this error:
"The requested class 'org.apache.commons.csv.CSVFormat' could not be found in the loaded jars/directories."
Running CF 2018 Update 10. It's all been working fine for a month. I have all the necessary directories.
There's a file that's being used:
..\spreadsheetcfml\javaLoader\lib\classloader-20120103162851.jar