Thanks for doing this! :-)
A couple suggestions:
1) You imply right at the beginning that your post is oriented toward AS users, but I recommend you state flat-out that your example is for running in the AS. That's because CacheManagerLocator doesn't exist outside the AS so people trying it outside the AS will fail.
2) The "sfsb-cache" is meant for EJB3 SFSB replication. It's technically possible to use it for other purposes, but I'd recommend creating a separate config, particular if clustered EJB3 SFSBs are deployed in your AS.
Note also that sfsb-cache doesn't integrate with the standard JTA transaction manager running in the AS, so if your app needs JTA integration you'd need a different config.
BTW, a (hopefully) helpful link for this general topic is http://www.jboss.org/file-access/default/members/jbossclustering/freezone/docs/cluster_guide/5.1/html/jbosscache.chapt.html#jbosscache-custom-deployment
Now updated. Many thanks for your feedback.
By the way, using CacheManagerLocator 'tastes' decidely old-fashioned. Are there any plans for JBoss Cache/Infinispan to support something like a @Cache injection annotation for member variables? Something like:
@Cache(name='sfsb-cache') private Cache<Object, Object> mMyCache;
I've tried exactly what you are suggesting here without any success.
If I use CacheManagerLocator then I get InvalidParameterException, because returned CacheManager is always null.
I tried to go directly via JNDI context and can see the returned Object is null.
However, I can see my caches eagerly started and I can see reference to java:CacheManager in JMX-CONSOLE. So, it seems that CacheManager bound to JNDI is not initialized or the wrong Object is bound.
I even added <depends>CacheManager</depends> to my application with no effect.
I could not find any help on this topic, so any suggestions on how to make it work would be greatly appreciated.
I'm running JBoss.5.1.0-GA with ALL configuration, so all the jars should be available there.