This content has been marked as final.
Show 4 replies
-
1. Re: JBoss Cache run from within an application WAR file...
carlabramsson Aug 15, 2006 11:42 AM (in response to astrien)Hi John!
Simply put a config-file in the root of your classpath (web-inf/classes for example) and then write a wrapper (singleton) around the the TreeCache that starts the cache.
Code to init the cache. You could call this block from a ContextListener in you webbapp.try { cache = new TreeCache(); } catch (Exception e) { throw new Exception("Could not create cache!",e); } PropertyConfigurator config = new PropertyConfigurator(); // configure tree cache. Needs to be in the classpath try { config.configure(cache, "my-treecache-config.xml"); } catch (ConfigureException e) { throw new Exception("Could not configure cache!",e); } try { cache.startService(); } catch (Exception e) { throw new Exception("Could not start cache!",e); }
Then create whatever put-, get-, remove-methods you need in the wrapper.
The treecache instance will register itself and can be found in your jmx-console.
Hope this helps! -
2. Re: JBoss Cache run from within an application WAR file...
manik Aug 17, 2006 7:56 AM (in response to astrien)Thanks for this, Carl. Would you be interested in documenting this on the JBC wiki, perhaps on http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheMBeans ?
I'd do it myself but I'd rather you get the credit for it. :-)
Thanks,
Manik -
3. Re: JBoss Cache run from within an application WAR file...
carlabramsson Aug 17, 2006 8:46 AM (in response to astrien)Sure! Will do it later today when i got the time....
Still struggling with my own problem.... http://jboss.org/index.html?module=bb&op=viewtopic&t=88713 -
4. Re: JBoss Cache run from within an application WAR file...
carlabramsson Aug 17, 2006 1:21 PM (in response to astrien)Updated the wiki with info: http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheMBeans