There's no standard way to create stuff in a .war except through a servlet init(). You can use a "startup servlet" to create a cache, but for JBoss it's best to use a "sar".
Thanks for your response!
I think I haven't well explained my question.
Actually my problem is that I'd like to use a simillar "context listener" in a web service project, just as the "ServletContextListener " has done in a web application (WAR). The package structure of a web service project is different from a web application project. E.g. there is no "web.xml" file in a web serivce project package.