I am using MyBatis 3.1.1, mybatis-ehcache 1.0.0, mybatis-spring 1.1.0 with Spring 3.0.6 and Ehcache 2.0 for caching. I would also like to use Terracotta for a distributed cache at some future date.
I am forced to deploy my application in a container that is itself an application. Unfortunately, it uses Ehcache itself. This would not be a problem except the classloader of this container application is used by my application to find . And of course it does not find my version but the container version which then cannot find my application ehcache.xml.
I have tried moving my config file to the container classpath and that seems to work. I have also tried to remove the container Ehcache JAR, which also works. Unfortunately, neither is an option moving forward.
So I am wondering what I can do. Is there a way to configure MyBatis to use a specific version of Ehcache? Alternatively, I could configure my ehcaches through MyBatis, but I am worried I won't have access to the full range of Ehcache properties, especially the terracotta element. Here is my ehcache.xml
Could I write my own class that wraps org.mybatis.caches.ehcache.EhcacheCache and somehow loads the correct Ehcache library or at least config file?
Or should I cut my losses and try to use a different caching solution?