• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Chart Cache Error in ColdFusion 2021

New Here ,
Oct 13, 2022 Oct 13, 2022

Copy link to clipboard

Copied

I am trying to move our site over to ColdFusion 2021 and the same code that runs in ColdFusion 10 (yes, very old), will not run in CF 2021. The CF Admin is set to save the Cached files in: E:\ColdFusion2021\cfusion\tmpCache\CFFileServlet\_cf_chart. When I watch that folder as the code is being run, rather than have all of the PNG images appear as the code is generating them, only two files are created. 

 

%0043%0046_%0043hart_%0043ache%004danager.data  - type is "DATA File" and size is 0 KB

.ehcache-diskstore.lock  - type is "LOCK File" and size is 0 KB.

 

The obvious conclusion is that there must be a file permissions issue, but we gave "Everyone" full control, as well as the user that ColdFusion is running under - it makes no difference. After those files are created, the only way to delete them is to reboot the system.

 

Any thoughts would be greatly appreciated.

Thanks

Curt

Views

259

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 15, 2022 Oct 15, 2022

Hi Curt,

I think your code is OK. As expected, the chart's display is suppressed because you are using cfchart's name attribute.

 

To obtain the chart as a PNG file, add the following lines of code just after the cfchart end-tag:

 

<cfset savedChartFilePath = getTempFile(getTempDirectory(),"shift_img") & ".png"> 
<cfset fileWrite(savedChartFilePath, shift_img_file)>
<p>The saved file is: <cfoutput>#savedChartFilePath#</cfoutput></p>

 

 

Votes

Translate

Translate
Adobe Employee ,
Oct 14, 2022 Oct 14, 2022

Copy link to clipboard

Copied

Hi Curt,

Can you please share the same code what you are doing with cfchart?

 

Thanks,
Priyank Shrivastava

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 14, 2022 Oct 14, 2022

Copy link to clipboard

Copied

We created a small sample piece of code to test it - below is the code:

 

<cfchart format="png" seriesplacement="stacked" yaxistitle="Total SF Printed" chartheight="500" chartwidth="2000" name="shift_img_file" showlegend="yes" fontsize="20" fontbold="yes" title="North Warehouse">

<cfchartseries type="bar" seriescolor="##6D78AD" serieslabel="Shift 1">
<cfloop from="09/01/2022" to="09/30/2022" index="index_date" step="#CreateTimeSpan(1,0,0,0)#">
<cfchartdata item="#dateFormat(index_date,'mm/dd')#" value="#randRange(100,900)#">
</cfloop>
</cfchartseries>

<cfchartseries type="bar" seriescolor="##51CDA0" serieslabel="Shift 2">
<cfloop from="09/01/2022" to="09/30/2022" index="index_date" step="#CreateTimeSpan(1,0,0,0)#">
<cfchartdata item="#dateFormat(index_date,'mm/dd')#" value="#randRange(100,900)#">
</cfloop>
</cfchartseries>
</cfchart>

<h3>Done!!!</h3>

 

It runs fine on the ColdFusion 10 server (running under Windows Server 2012). It will not run on the ColdFusion 2021 (Windows Server 2019) or even under ColdFusion 2016 (also running on Windows Server 2012).  

 

One thing that is puzzling is that after the routine runs, I cannot delete the two temporary files that are created in the cache directory. But, if I either reboot the system OR if I stop the ColdFusion Applcation service and then re-start it, the files get automatically deleted.

 

Thanks in advance for any thoughts you may have.

 

Curt

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 15, 2022 Oct 15, 2022

Copy link to clipboard

Copied

Hi Curt,

I think your code is OK. As expected, the chart's display is suppressed because you are using cfchart's name attribute.

 

To obtain the chart as a PNG file, add the following lines of code just after the cfchart end-tag:

 

<cfset savedChartFilePath = getTempFile(getTempDirectory(),"shift_img") & ".png"> 
<cfset fileWrite(savedChartFilePath, shift_img_file)>
<p>The saved file is: <cfoutput>#savedChartFilePath#</cfoutput></p>

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 18, 2022 Oct 18, 2022

Copy link to clipboard

Copied

Did that suggestion help?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 18, 2022 Oct 18, 2022

Copy link to clipboard

Copied

BKBK,

Yes, your suggestion worked. Turns out in CF10, the <cfchart> function would automatically write the file to the cache folder but it doesn't do that in later versions. I was seeing the temporary files being created as the only output, thinking it was getting stuck in the process. 

 

Thank you for your help.

 

Curt

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 18, 2022 Oct 18, 2022

Copy link to clipboard

Copied

LATEST

Glad to hear. Thanks for the update.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation