Skip to content

Instantly share code, notes, and snippets.

@wilgeno
Last active July 10, 2017 09:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wilgeno/e85dfd15522add4db8e1d1bc1a427af9 to your computer and use it in GitHub Desktop.
Save wilgeno/e85dfd15522add4db8e1d1bc1a427af9 to your computer and use it in GitHub Desktop.
CF 2016 clearTrustedCache
<cfscript>
adminUser = "admin";
adminPW = "password";
thefile = "/absolute/path/to/file.cfm";
adminObj = createObject("component","cfide.adminapi.administrator");
adminObj.login(adminPW, adminUser);
adminRuntime = createObject("component","cfide.adminapi.runtime");
adminRuntime.clearTrustedCache(thefile);
</cfscript>
@wilgeno
Copy link
Author

wilgeno commented Dec 22, 2016

coldfusion.security.SecurityManager$UnauthenticatedCredentialsException
at coldfusion.security.SecurityManager.authenticateAdmin(SecurityManager.java:2474)
at coldfusion.runtime.RuntimeServiceImpl.clearTemplateListFromCache(RuntimeServiceImpl.java:2068)
at sun.reflect.GeneratedMethodAccessor144.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at coldfusion.runtime.StructBean.invoke(StructBean.java:508)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:3168)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:3068)
at cfruntime2ecfc902273094$funcCLEARTRUSTEDCACHE.runFunction(/CFIDE/adminapi/runtime.cfc:886)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:492)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:425)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:388)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:339)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:234)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:650)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:439)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:409)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:3091)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:3068)
at cfapifacade2ecfc220263449$funcCLEARTRUSTEDCACHE.runFunction(E:\ColdFusion2016\cfusion\wwwroot\CFIDE\adminapi\clearTrustedCache\apifacade.cfc:86)

Line 86 in the stack trace is the same as line 7 in the code above.

@wilgeno
Copy link
Author

wilgeno commented Dec 27, 2016

The code is the stripped down and sanitized version of what is failing. The code fails at line 7 of the above code when on the production server.

@vishru
Copy link

vishru commented May 2, 2017

Inside CF 2016 - Administrator \ security \ usermanager

Create a new user and give him API privileges and i got it to work with that user. The default admin did not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment