I am using Hibernate 3.2.0 with JBoss 4.0.4, in an enterprise application. I have configured hibernate-service.xml to use the EhCacheProvider as a provider for the second level cache. I use ehcache 1.2.4.
The ehcache-1.2.4.jar is placed in the libs directory of the current server.
The problem is that ehcache uses an external configuration file (ehcache.xml). At startup, ehcache.xml is automatically searched in classpath. I tried to place ehcache.xml in several directories (in the same directory with hibernate-service.xml, in the root of the ear, in the directory where hibernate.cfg.xml is located), but none of the solutions worked. I keep getting an error that the configuration file ehcache.xml couldn't be found. ([net.sf.ehcache.config.ConfigurationFactory] No configuration found.)
The only place I put ehcache.xml and it worked ok was inside the ehcache-1.2.4.jar (the jar is in the libs directory of the current server). If I put it there, ehcache.xml is found at startup and everything works all right (but this is a very ugly solution).
Isn't threre any way to put ehcache.xml inside the ear so that it will be found at startup, when the hibernate Mbean is initialized?
Thanks!