[3.7.0] Null Pointer Exception in cache monitor for caching on Railo

Hi
I have set up an eh cache lite in my railo server admin, called coldbox.
I specified my template cache like this…

caches = { // Named cache for all coldbox event and view template caching "template" = { provider = "coldbox.system.cache.providers.RailoColdBoxProvider", properties = {cacheName="coldbox"} } }

all good.

I can go to a page that has

`
#renderView(view=’/test/cache/includes/snippet’,cache=true,cacheTimeout=“60”,cacheLastAccessTimeout=“30”)#

`
and it works.

However in the cachebox profiler when i click on the template cache in the drop down i get Null Pointer Exception.

`

Application Execution ExceptionError Type: railo.commons.io.cache.exp.CacheException : 0

Error Messages: there is no default object cache defined, you need to define this default cache in the Railo Administrator

Tag Context:
ID: ??
LINE: 49
Template: C:\Users\Adrian\Dropbox\Code\CFWorkspace\ref.l\coldbox\system\cache\providers\railo-lib\RailoStats.cfc
ID: ??
LINE: 22
Template: C:\Users\Adrian\Dropbox\Code\CFWorkspace\ref.l\coldbox\system\cache\providers\railo-lib\RailoStats.cfc
ID: ??
LINE: 18
Template: C:\Users\Adrian\Dropbox\Code\CFWorkspace\ref.l\coldbox\system\cache\report\skins\default\CacheReport.cfm
ID: ??
LINE: 109
Template: C:\Users\Adrian\Dropbox\Code\CFWorkspace\ref.l\coldbox\system\cache\report\ReportHandler.cfc
ID: ??
LINE: 78
Template: C:\Users\Adrian\Dropbox\Code\CFWorkspace\ref.l\coldbox\system\cache\report\monitor.cfm

`

Is something missing?
In the docs it says that it only uses the default cache by default if a cacheName is not provided and it works in the page code.
Is this a bug or incorrect configuration by me.

Thanks

Can you show the full Java thread dump. That line of CF code is:

var props = cacheGetProperties(“object”);

Hmm, that doesn’t seem correct though. The input to that function can be a default cache type OR a named cache. If I were to guess, I’d say you don’t have a default object cache. If you had an object cache, that would return data, but not necessarily the correct data.

I think this is a bug in the RailoStats.cfc. Lines 49 and 57 probably need to be:

var props = cacheGetProperties( getCacheProvider().getConfiguration().cacheName );

Give that a test and see if it works.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Thanks Brad, that worked.I was a bit confused by what this meant by the default object cache in the doco. I have figured it out now that it means create an eh cache with any name e.g. bob and save it, then you get the option of then assigning that cache to object as hopefully the attached image shows. I initially thought i needed to create a cache called default. Simples when you know.

But did you make the code change I suggested? My point wasn’t that you needed a default object cache, it was that I think there is a bug in RailoStats.cfc and it doesn’t show when you have a default object cache. Furthermore, if your default object cache is different from the named cache used in your railo provider, you’ll get incorrect stats.

Once you confirmed that my suggested code change fixed the issue, I was going to put in a ticket to get it fixed.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Yes, the code you suggested worked with the named cache. The default implementation works with the default object cache and i was just trying to explain more what that meant as it wasnt obvious to me at first how to set this up on Railo.