One my coworkers had and issue where she couldn’t run cfreport from her site. The error from the site was rather unhelpfull:
ROOT CAUSE: java.lang.NoClassDefFoundError: Could not initialize class coldfusion.runtime.report.Report at coldfusion.tagext.lang.ReportTag.doEndTag(ReportTag.java:581) at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2662) at cfprintLabels2ecfm1064228503.runPage(D:\sites\********\www\common\widgets\printLabels.cfm:49)
Initially Google only came with one hit when searching for this, and it didn’t provide any solution. Since it was a simple report to generate Avery labels in pdf I recommeded a workaround: use a pdf form template and fill out the addresses through cfpdfform. But today when I saw a WEB-INF/cfusion/tmpCache/CFFileServlet/_cf_report/ folder on my development system I suddenly realized the problem might be caused by a sandbox issue. The site is on a shared server and sandboxes default to the site folder and all subfolders, but nothing outside that. And as it turns out ColdFusion tries to do something with WEB-INF/cfusion/tmpCache/CFFileServlet/_cf_report/ so the sandbox will need access to that folder for cfreport to work. Once we allowed access to the Sandbox to this folder, cfreport started working again.
In case you are interested, the script to add a directory to all sandboxes is here:
<!--- For Sandbox stuff use the platform specific directory delimiter ---> <cfset cftempdir = server.ColdFusion.rootDir & "\tmpCache\-" /> <cfset adminPassword = "" /> <cfset administrator = CreateObject('component', 'cfide.adminapi.administrator')> <cfset security = CreateObject('component', 'cfide.adminapi.security') /> <!--- Login ---> <cfif NOT administrator.login(adminPassword)> <cfthrow message="Login failed" detail="Unable to login to the CF adminAPI."> </cfif> <!--- Collect the defined sandboxes---> <cfset sandBoxes = security.getSecuritySandboxes() /> <cfloop collection="#sandBoxes#" item="box"> <!--- Test if it is a user-sanbox and not a system-sandbox and add the tmpCache folder ---> <cfif Left(box, 12) IS "z:\websites\"> <cfset security.setSecuredFolder( directory=box , folder=cftempdir ) /> </cfif> </cfloop>
Other tags that won’t work in a sandbox
This issue appears to be new in CF 8 because aparently it had worked before in a similar sandbox on CF 7. Several more tags have problems if you typically limit sandbox access to the folder the code is in and to subfolders. My current list is
|cfdocument||font directory (c:\windows\fonts\)|
|cffile upload||J2EE server temp dir (c:\JRUN4\servers\cfusion\SERVER-INF\temp\cfusion.war-tmp\)|
So who has discovered any other tags that need access to special directories to work properly?