After running the Cache Taglib successfully in a JBoss 4.x.x environment for many months, I have suddenly experienced a very nasty NullpointerException on the frontpage of our high volume site, where the tag is used to cache dynamic list contents in session scope. I have not configured the tag using a CacheUtil class but using the default parameters. This happened for all users/sessions requesting the front page. An immediate restart of JBoss solved the issue - but obviously this is highly worrying. I have scoured bugzilla and tried to Google for something similar from CacheTag users to no avail. Looking into the LRUCache class and comparing to my stack trace it seems that in same strange scenario the key can be null, but still return valid entries from the cache. A NullPointerException then occurs when trying to update the LRU list in the noteUsed method afterwords. 18:12:53,755 ERROR [Engine] StandardWrapperValve[jsp]: Servlet.service() for ser vlet jsp threw exception java.lang.NullPointerException at java.util.LinkedList.remove(LinkedList.java:220) at org.apache.taglibs.cache.LRUCache.noteUsed(LRUCache.java:199) at org.apache.taglibs.cache.LRUCache.get(LRUCache.java:115) at org.apache.taglibs.cache.CacheTag.doStartTag(CacheTag.java:49) at org.apache.jsp.index_jsp._jspService(index_jsp.java:528) Could this be a threading issue or what?
It certainly could be a threading/concurrency issue. I've never used the taglib before, but I took a quick look through the code. It's a bit disturbing that there's literally no synchronization anywhere in the taglib when it's likely that caches are stored in shared scopes (session and application).
Resolving. Taglib has been retired.